diff --git a/mozilla/calendar/Makefile b/mozilla/calendar/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/makefile.win b/mozilla/calendar/makefile.win deleted file mode 100644 index b8c231060ce..00000000000 --- a/mozilla/calendar/makefile.win +++ /dev/null @@ -1,91 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# An NMAKE file to set up and adjust trex's build system for -# Client build. Client build should invoke NMAKE on this file -# instead of invoking gmake directly. -# - -DEPTH = .. -include <$(DEPTH)\config\config.mak> - -# -# Backslashes are escape characters to gmake, so flip all backslashes -# in $(MOZ_TOOLS) to forward slashes and pass that to gmake. -# - -GMAKE = $(MOZ_TOOLS)\bin\gmake.exe MOZ_TOOLS_FLIPPED=$(MOZ_TOOLS:\=/) - -#GMAKE_PR_FLAGS = PR_CLIENT_BUILD=1 PR_CLIENT_BUILD_WINDOWS=1 -GMAKE_PR_FLAGS = - -# -# The Client's debug build uses MSVC's debug runtime library (/MDd). -# - -!ifdef MOZ_DEBUG -GMAKE_DBG_FLAGS = USE_DEBUG_RTL=1 -!else -GMAKE_DBG_FLAGS = BUILD_OPT=1 -!endif - -!if "$(MOZ_BITS)" == "16" -!ifdef MOZ_DEBUG -GMAKE_DBG_FLAGS = -!else -GMAKE_DBG_FLAGS = BUILD_OPT=1 -!endif - -GMAKE_OS_FLAGS = OS_TARGET=WIN16 -!else - -GMAKE_OS_FLAGS = OS_TARGET=WIN95 - -!ifdef MOZ_DEBUG -GMAKE_DBG_FLAGS = USE_DEBUG_RTL=1 -!else -GMAKE_DBG_FLAGS = BUILD_OPT=1 -!endif - -!ifdef MOZ_DEBUG -PR_OBJDIR = WIN954.0_DBG.OBJD -!else -PR_OBJDIR = WIN954.0_OPT.OBJ -!endif - -!endif - -# -# The rules. Simply invoke gmake with the same target -# for Win16, use the watcom compiler with the MSVC headers and libs -# - -# this rule is needed so that nmake with no explicit target will only build -# all, and not build all the targets named below in succession! -default:: all - -export libs:: - -install:: - $(GMAKE) $(GMAKE_PR_FLAGS) $(GMAKE_DBG_FLAGS) $(GMAKE_OS_FLAGS) - -# a rule like this one must only be used for explicitly named targets! -all install:: - $(GMAKE) $(GMAKE_PR_FLAGS) $(GMAKE_DBG_FLAGS) $(GMAKE_OS_FLAGS) - -depend: - $(GMAKE) $(GMAKE_PR_FLAGS) $(GMAKE_DBG_FLAGS) $(GMAKE_OS_FLAGS) depend - -clobber_all clobber: - $(GMAKE) $(GMAKE_PR_FLAGS) $(GMAKE_DBG_FLAGS) $(GMAKE_OS_FLAGS) clobber_all - -show: - @echo "MAKEFLAGS = $(MAKEFLAGS)" diff --git a/mozilla/calendar/manifest.mn b/mozilla/calendar/manifest.mn deleted file mode 100644 index 49a64215569..00000000000 --- a/mozilla/calendar/manifest.mn +++ /dev/null @@ -1,20 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = .. -DEPTH = .. - -IMPORTS = \ - $(NULL) - -RELEASE = trex - -DIRS = modules - - diff --git a/mozilla/calendar/modules/Makefile b/mozilla/calendar/modules/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/Makefile b/mozilla/calendar/modules/core/Makefile deleted file mode 100644 index 980c28963b6..00000000000 --- a/mozilla/calendar/modules/core/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/capi/Makefile b/mozilla/calendar/modules/core/capi/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/capi/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/capi/local/Makefile b/mozilla/calendar/modules/core/capi/local/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/capi/local/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/capi/local/inc/Makefile b/mozilla/calendar/modules/core/capi/local/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/capi/local/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/capi/local/inc/capi.h b/mozilla/calendar/modules/core/capi/local/inc/capi.h deleted file mode 100644 index 1fc84e70f7a..00000000000 --- a/mozilla/calendar/modules/core/capi/local/inc/capi.h +++ /dev/null @@ -1,315 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * capi.h - * - * sman - * 30-Jun-98 - */ - -#ifndef __JULIAN_LOCAL_CAPI_H -#define __JULIAN_LOCAL_CAPI_H - -#include "jdefines.h" -#include -#include "nscore.h" -#include "nscalexport.h" - -typedef void* CAPISession; -typedef void* CAPIHandle; -typedef void* CAPIStream; -typedef long CAPIStatus; - -#define CAPI_THISINSTANCE 1 -#define CAPI_THISANDPRIOR 2 -#define CAPI_THISANDFUTURE 3 - -#define CAPI_CALLBACK_CONTINUE 0 -#define CAPI_CALLBACK_DONE -1 - -#if 0 -#define CAPI_ERR_OK 0 - -#define CAPI_ERR_CALLBACK 1 -#define CAPI_ERR_COMP_NOT_FOUND 2 -#define CAPI_ERR_CORRUPT_HANDLE 3 -#define CAPI_ERR_CORRUPT_SESSION 4 -#define CAPI_ERR_CORRUPT_STREAM 5 -#define CAPI_ERR_DATE 6 -#define CAPI_ERR_DATE_RANGE 7 -#define CAPI_ERR_EXPIRED 8 -#define CAPI_ERR_FLAGS 9 -#define CAPI_ERR_HOST 10 -#define CAPI_ERR_INTERNAL 11 -#define CAPI_ERR_IO 12 -#define CAPI_ERR_NO_MEMORY 13 -#define CAPI_ERR_NOT_IMPLEMENTED 14 -#define CAPI_ERR_NULL_PARAMETER 15 -#define CAPI_ERR_PROPERTIES_BLOCKED 16 -#define CAPI_ERR_REQUIRED_PROPERTY_MISSING 17 -#define CAPI_ERR_SECURITY 18 -#define CAPI_ERR_SERVER 19 -#define CAPI_ERR_UID 20 -#define CAPI_ERR_USERNAME_PASSWORD 21 -#endif - -typedef int (*CAPICallback)( - void* pData, /* i: caller-defined data, the value */ - /* supplied in CAPI_SetStreamCallbacks */ - char* pBuf, /* i: buffer to read or write */ - size_t iSize, /* i: the number of characters in pBuf */ - size_t* piTransferred); /* o: the number of characters from pBuf that */ - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -NS_CALENDAR CAPIStatus CAPI_Capabilities( - const char** ppsVal, /* o: a string describing the capabilities */ - const char* psHost, /* i: server host */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - /* were processed. */ - -NS_CALENDAR CAPIStatus CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier); /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - -NS_CALENDAR CAPIStatus CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: pointer to a list of handles to destroy */ - int iHandleCount, /* i: number of valid handles in pHList */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR CAPIStatus CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iCount, /* i: number of valid handles in ppH */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR CAPIStatus CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_CALENDAR CAPIStatus CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_CALENDAR CAPIStatus CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_CALENDAR CAPIStatus CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH); /* o: handle */ - -NS_CALENDAR CAPIStatus CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR CAPIStatus CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession); /* o: the session */ - -NS_CALENDAR CAPIStatus CAPI_SetStreamCallbacks ( - CAPISession s, /* i: login session handle */ - CAPIStream* pStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback,/* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback,/* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR CAPIStatus CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream stream ); /* i: stream for reading data to store */ - - -/* - * NETSCAPE EXTENSIONS TO CAPI - */ -NS_CALENDAR CAPIStatus CAPI_LogonCurl( - const char* psCurl, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession); /* o: the session */ - - -#ifdef __cplusplus -} -#endif - -/* The ok error */ -#define CAPI_ERR_OK ((CAPIStatus) 0x00) - -/* Masks for checking for fields of error codes */ -#define CAPI_ERRMASK_MODE_FIELD ((CAPIStatus) 0xFF << 24) -#define CAPI_ERRMASK_TYPE_FIELD ((CAPIStatus) 0x1F << 19) -#define CAPI_ERRMASK_ERR1_FIELD ((CAPIStatus) 0x1F << 14) -#define CAPI_ERRMASK_ERR2_FIELD ((CAPIStatus) 0x3F << 8) -#define CAPI_ERRMASK_VENDOR_FIELD ((CAPIStatus) 0xFF) - -/* Masks for checking for errors at various levels */ - -#define CAPI_ERRMASK_TYPE ((CAPIStatus) CAPI_ERRMASK_TYPE_FIELD) -#define CAPI_ERRMASK_ERR1 ((CAPIStatus) CAPI_ERRMASK_TYPE + CAPI_ERRMASK_ERR1_FIELD) -#define CAPI_ERRMASK_ERR2 ((CAPIStatus) CAPI_ERRMASK_ERR1 + CAPI_ERRMASK_ERR2_FIELD) -#define CAPI_ERRMASK_VENDOR ((CAPIStatus) CAPI_ERRMASK_ERR2 + CAPI_ERRMASK_VENDOR_FIELD) - -/* The non fatal error bit */ - -#define CAPI_ERRMODE_FATAL ((CAPIStatus) 0x1 << 24)) - -/* The various error types (field 2) */ -#define CAPI_ERRTYPE_DATA ((CAPIStatus) 0x1 << 19) -#define CAPI_ERRTYPE_SERVICE ((CAPIStatus) 0x2 << 19) -#define CAPI_ERRTYPE_API ((CAPIStatus) 0x3 << 19) -#define CAPI_ERRTYPE_SECURITY ((CAPIStatus) 0x4 << 19) -#define CAPI_ERRTYPE_LIBRARY ((CAPIStatus) 0x5 << 19) - -/* Data errors */ - -/* field 3 values */ -#define CAPI_ERR1_ICAL ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x1 << 14 )) -#define CAPI_ERR1_MIME ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x2 << 14 )) -#define CAPI_ERR1_DATE ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x3 << 14 )) -#define CAPI_ERR1_ID ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x4 << 14 )) - -/* field 4 values */ -#define CAPI_ERR2_MIME_NONE ((CAPIStatus) CAPI_ERR1_MIME + (0x1 << 8)) -#define CAPI_ERR2_MIME_NOICAL ((CAPIStatus) CAPI_ERR1_MIME + (0x2 << 8)) - -#define CAPI_ERR2_DATE_RANGE ((CAPIStatus) CAPI_ERR1_DATE + (0x1 << 8)) -#define CAPI_ERR2_DATE_FORMAT ((CAPIStatus) CAPI_ERR1_DATE + (0x2 << 8)) - -#define CAPI_ERR2_ID_USERID ((CAPIStatus) CAPI_ERR1_ID + (0x1 << 8)) -#define CAPI_ERR2_ID_HOSTNAME ((CAPIStatus) CAPI_ERR1_ID + (0x2 << 8)) - -/* field 5 values (Vendor specific errors) */ - -#define CAPI_ERR_IDUSERID_INIFILE ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x01) -#define CAPI_ERR_IDUSERID_FORMAT ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x02) -#define CAPI_ERR_IDUSERID_NONE ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x03) -#define CAPI_ERR_IDUSERID_MANY ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x04) -#define CAPI_ERR_IDUSERID_NODE ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x05) - -/* - * Service errors - */ - -/* field 3 values */ -#define CAPI_ERR1_MEMORY ((CAPIStatus) CAPI_ERRTYPE_SERVICE + (0x1 << 14 )) -#define CAPI_ERR1_FILE ((CAPIStatus) CAPI_ERRTYPE_SERVICE + (0x2 << 14 )) -#define CAPI_ERR1_NETWORK ((CAPIStatus) CAPI_ERRTYPE_SERVICE + (0x3 << 14 )) - -/* field 4 values */ -#define CAPI_ERR2_NETWORK_TIMEOUT ((CAPIStatus) CAPI_ERR1_NETWORK + (0x1 << 8)) - - -/* - * API errors - */ - -/* field 3 values */ -#define CAPI_ERR1_FLAGS ((CAPIStatus) CAPI_ERRTYPE_API + (0x1 << 14)) -#define CAPI_ERR1_NULLPARAM ((CAPIStatus) CAPI_ERRTYPE_API + (0x2 << 14)) -#define CAPI_ERR1_CALLBACK ((CAPIStatus) CAPI_ERRTYPE_API + (0x3 << 14)) -#define CAPI_ERR1_HANDLE ((CAPIStatus) CAPI_ERRTYPE_API + (0x4 << 14)) -#define CAPI_ERR1_SESSION ((CAPIStatus) CAPI_ERRTYPE_API + (0x5 << 14)) -#define CAPI_ERR1_STREAM ((CAPIStatus) CAPI_ERRTYPE_API + (0x6 << 14)) - -/* field 4 values */ -#define CAPI_ERR2_HANDLE_NULL ((CAPIStatus) CAPI_ERR1_HANDLE + (0x1 << 8)) -#define CAPI_ERR2_HANDLE_BAD ((CAPIStatus) CAPI_ERR1_HANDLE + (0x2 << 8)) - -#define CAPI_ERR2_SESSION_NULL ((CAPIStatus) CAPI_ERR1_SESSION + (0x1 << 8)) -#define CAPI_ERR2_SESSION_BAD ((CAPIStatus) CAPI_ERR1_SESSION + (0x2 << 8)) - -#define CAPI_ERR2_STREAM_NULL ((CAPIStatus) CAPI_ERR1_STREAM + (0x1 << 8)) -#define CAPI_ERR2_STREAM_BAD ((CAPIStatus) CAPI_ERR1_STREAM + (0x2 << 8)) - -/* - * Security errors - */ - -/* field 3 values */ -#define CAPI_ERR1_READ ((CAPIStatus) CAPI_ERRTYPE_SECURITY + (0x1 << 14)) -#define CAPI_ERR1_WRITE ((CAPIStatus) CAPI_ERRTYPE_SECURITY + (0x2 << 14)) - -/* field 4 values */ -#define CAPI_ERR2_READ_PROPS ((CAPIStatus) CAPI_ERR1_READ + (0x1 << 8)) - -#define CAPI_ERR2_WRITE_AGENDA ((CAPIStatus) CAPI_ERR1_WRITE + (0x1 << 8)) -#define CAPI_ERR2_WRITE_EVENT ((CAPIStatus) CAPI_ERR1_WRITE + (0x2 << 8)) - - -/* - * Library errors - */ -/* field 3 values */ -#define CAPI_ERR1_INTERNAL ((CAPIStatus) CAPI_ERRTYPE_LIBRARY + (0x1 << 14)) -#define CAPI_ERR1_IMPLENTATION ((CAPIStatus) CAPI_ERRTYPE_LIBRARY + (0x2 << 14)) - -/* field 4 values */ -#define CAPI_ERR2_INTERNALEXPIRY ((CAPIStatus) CAPI_ERR_INTERNAL + (0x1 << 8)) - -#endif /* __JULIAN_LOCAL_CAPI_H */ diff --git a/mozilla/calendar/modules/core/capi/local/inc/manifest.mn b/mozilla/calendar/modules/core/capi/local/inc/manifest.mn deleted file mode 100644 index 7a8cd0167e7..00000000000 --- a/mozilla/calendar/modules/core/capi/local/inc/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - capi.h \ - privcapi.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor julian nls shell trex diff --git a/mozilla/calendar/modules/core/capi/local/inc/privcapi.h b/mozilla/calendar/modules/core/capi/local/inc/privcapi.h deleted file mode 100644 index e7f6665ee97..00000000000 --- a/mozilla/calendar/modules/core/capi/local/inc/privcapi.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** -*** Private CAPI header file. -*** Defines the opaque types. -**/ -#ifndef __JULIAN_PRIVATE_CAPI_H -#define __JULIAN_PRIVATE_CAPI_H - -#include "nsString.h" -#include "xp_mcom.h" -#include "jdefines.h" -#include "julnstr.h" -#include "nspr.h" -#include "plstr.h" -#include "nsCurlParser.h" - -typedef struct -{ - nsCurlParser* pCurl; - char* psUser; /* i: Calendar store (and ":extra" information ) */ - char* psPassword; /* i: password for sUser */ - char* psHost; /* i: calendar server host (and :port) */ -} PCAPISESSION; - -typedef struct -{ - PCAPISESSION *pSession; - char* psFile; - nsCurlParser* pCurl; -} PCAPIHANDLE; - -typedef struct -{ - CAPICallback pfnSndCallback; /* i: Snd iCalendar data */ - void* pCallerSndDataBuf; /* i: Data buffer pointer Snd function */ - void* userDataRcv; /* i: a user supplied value */ - CAPICallback pfnRcvCallback; /* i: Rcv iCalendar data */ - void* userDataSnd; /* i: a user supplied value */ - long lFlags; /* i: bit flags (none at this time; set to 0) */ -} PCAPIStream; - -#endif /* __JULIAN_PRIVATE_CAPI_H */ \ No newline at end of file diff --git a/mozilla/calendar/modules/core/capi/local/manifest.mn b/mozilla/calendar/modules/core/capi/local/manifest.mn deleted file mode 100644 index e94c397fe52..00000000000 --- a/mozilla/calendar/modules/core/capi/local/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/core/capi/local/src/Makefile b/mozilla/calendar/modules/core/capi/local/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/core/capi/local/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/core/capi/local/src/capi.cpp b/mozilla/calendar/modules/core/capi/local/src/capi.cpp deleted file mode 100644 index a59afeec2b6..00000000000 --- a/mozilla/calendar/modules/core/capi/local/src/capi.cpp +++ /dev/null @@ -1,1410 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/**************************************************************** -*** Local CAPI -*** Steve Mansour -*****************************************************************/ -#include "jdefines.h" -#include -#include -#include -#include - -#include "capi.h" /* public capi file */ -#include "privcapi.h" /* private capi implementation */ - - -/* julian includes */ -#include "nscal.h" -#include "icalcomp.h" -#include "icalredr.h" -#include "icalfrdr.h" -#include "ptrarray.h" -#include "jlog.h" - -#ifdef XP_PC -#include "io.h" -#endif - -/**************************************************************** -*** UTILITY ROUTINES -*** In case we want to actually put this code into a dll, -*** this section should contain all the external calls. -*****************************************************************/ -size_t CAPI_strlen(const char * s) -{ - return strlen(s); -} - -char *CAPI_mktemp( char *psTemplate ) -{ -// XXX: Port this -#ifdef XP_PC - return _mktemp(psTemplate); -#else - return (nsnull); -#endif -} - -int CAPI_access( const char *path, int mode ) -{ -#ifdef XP_PC - return _access(path,mode); -#else - return (0); -#endif -} - -void *CAPI_malloc(size_t i) -{ - return malloc( i ); -} - -void CAPI_free(void *p) -{ - if (0 != p) - free(p); -} - -int CAPI_unlink( const char *filename ) -{ -// XXX: Port this -#ifdef XP_PC - int iStatus = _unlink(filename); - if (iStatus < 0) - { - int iError = errno; - //TRACE( _sys_errlist[errno] ); - return iError; - } -#endif - return 0; -} - -char *CAPI_strdup(const char* s) -{ - if (0 != s) - { - char* p = (char *) malloc( 1 + strlen(s) ); - if (0 == p) - return 0; - return strcpy(p,s); - } - return 0; -} - -FILE *CAPI_fopen(const char *psFile, const char *psFlags) -{ - return fopen(psFile,psFlags); -} - -size_t CAPI_fread( void *buffer, size_t size, size_t count, FILE *stream ) -{ - return fread( buffer, size, count, stream ); -} - -size_t CAPI_fwrite( const void *buffer, size_t size, size_t count, FILE *stream ) -{ - return fwrite( buffer, size, count, stream ); -} - -int CAPI_fclose(FILE *pFile ) -{ - return fclose(pFile); -} - -void *CAPI_memcpy( void *dest, const void *src, size_t count ) -{ - return memcpy(dest,src,count); -} - -void *CAPI_memset( void *dest, int c, size_t count ) -{ - return memset(dest,c,count); -} - -/************************************************************************/ - -/** - * This is a useful piece of code but it's in the wrong - * place. Given a path, it ensures that the path exists, creating - * whatever needs to be created. - * @return 0 on success - * file creation errors otherwise. - */ -PRInt32 CAPI_EnsureUserPath( JulianString& sPath ) -{ - JulianString sTmp; - PRInt32 i; - nsCurlParser::ConvertToFileChars(sPath); - for (i = 0; -1 != (i = sPath.Strpbrk(i,"/\\")); i++ ) - { - sTmp = sPath.Left(i); - if (PR_SUCCESS != PR_Access(sTmp.GetBuffer(), PR_ACCESS_EXISTS)) - { - /* - * Try to create it... - */ - if (PR_SUCCESS != PR_MkDir(sTmp.GetBuffer(),PR_RDWR)) - { - PRInt32 iError = PR_GetError(); - return iError; - } - } - } - - /* - * OK, the path was there or it has been created. Now make - * sure we can write to it. - */ - if (PR_SUCCESS != PR_Access(sPath.GetBuffer(), PR_ACCESS_WRITE_OK)) - { - PRInt32 iError = PR_GetError(); - return iError; - } - - return 0; -} - - - -/**************************************************************** -*** MIME / ICAL ASSEMBLY FUNCTIONS -*****************************************************************/ -UnicodeString & createMimeStartHeader(UnicodeString & u) -{ - u = "MIME-Version: 1.0\r\n"; - u += "Content-Type: multipart/text\r\n"; - u += " boundary=\"5ZY4HSUIYKHTPFPN7Q30ROE94YXWQNBI\"\r\n"; - u += "Content-Transfer-Encoding: 7bit\r\n"; - u += "\r\n"; - u += "This is a multipart message in MIME format containing iCalendar data.\r\n"; - return u; -} - -UnicodeString & appendSeperator(UnicodeString & u) -{ - u += "--5ZY4HSUIYKHTPFPN7Q30ROE94YXWQNBI\r\n"; - return u; -} - -UnicodeString & appendMultipartMessageHeader(UnicodeString & u, UnicodeString & filename) -{ - appendSeperator(u); - u += "Content-Type: text/calendar\r\n"; - u += "Content-Disposition: attachment; filename=\""; - u += filename; - u += "\"\r\n"; - u += "Content-Transfer-Encoding: 7-bit\r\n\r\n"; - return u; -} - -UnicodeString & appendBeginVCalendar(UnicodeString & u) -{ - u += "BEGIN:VCALENDAR\r\n"; - return u; -} - -UnicodeString & appendEndVCalendar(UnicodeString & u) -{ - u += "END:VCALENDAR\r\n\r\n"; - return u; -} - - -/**************************************************************** -*** CAPI FUNCTIONS -*****************************************************************/ - -/** - * return the implementation specific information - */ -CAPIStatus CAPI_Capabilities( - const char** ppsVal, /* o: a string describing the capabilities */ - const char* psHost, /* i: server host */ - long lFlags ) /* i: bit flags (none at this time; set to 0) */ -{ - static char* tpsCap = "Vendor: Netscape\n\ -Version: 1.0\n\ -ServerVersion: 1.0 (localhost)\n\ -CAPIVersion: 1.0\n\ -fanout: no\n\ -atomicTransactions: no\n"; - - *ppsVal = tpsCap; - - return CAPI_ERR_OK; -} - -/** - * Delete an event from a list of calendar handles - */ -#define DEL_EXIT(x) {iRetStatus = x; goto DELEVENT_EXIT;} - -CAPIStatus CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier) /* i: one of CAPI_THISINSTANCE, CAPI_THISANDPRIOR, - CAPI_THISANDFUTURE only valid if recurrence-id - is non-NULL */ -{ - - /* - * Read the entire calendar into an NSCalendar : pCal - * Read the supplied event to delete into another ns calendar : pCalDel - * Search for the event in pCalDel in pCal. - * If found delete it from pCal then save pCal - */ - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIHANDLE* pHandle; - NSCalendar *pCal = 0; - CAPIStatus iRetStatus = CAPI_ERR_OK; - ICalReader * pRedr = 0; - JLog* pLog = 0; - UnicodeString uFilename; - t_bool bWriteStatus; - size_t iHits; - ErrorCode status = ZERO_ERROR; - VEvent *pEvent; - JulianPtrArray* pEventList = 0; - - if (0 == pSession) - return CAPI_ERR2_SESSION_BAD; - if (0 == pHList) - return CAPI_ERR2_HANDLE_BAD; - - for (int i = 0; i < iHandleCount; i++) - { - pHandle = (PCAPIHANDLE*) pHList[i]; - if (0 == pHandle) - DEL_EXIT(CAPI_ERR2_HANDLE_BAD) - - /* - * create an NSCalendar, pCal - */ - pCal = new NSCalendar(pLog); - if (pCal == 0) - DEL_EXIT(CAPI_ERR1_INTERNAL) - - /* - * Try to load pHandle->psFile in pCal. - * If the file doesn't exist, we don't have to create it and - * load it, because we're deleting events anyway. If there's nothing - * there to start with, there's nothing to delete. - */ - if (CAPI_access(pHandle->psFile, 00 /*F_OK*/)) - continue; - pRedr = (ICalReader *) new ICalFileReader(pHandle->psFile, status); - if (pRedr == 0) - DEL_EXIT(CAPI_ERR1_INTERNAL) - if (FAILURE(status)) - DEL_EXIT(CAPI_ERR1_INTERNAL) - - /* - * Load original datastore... - */ - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - delete pRedr; pRedr = 0; - - /* - * Try to find the event - */ - pEventList = pCal->getEvents(); - if (0 != pEventList) - { - pEvent = 0; - iHits = 0; - for (int j = 0; j < pEventList->GetSize(); j++) - { - pEvent = (VEvent *) pEventList->GetAt(j); - if (0 == pEvent) - continue; - if (0 == (pEvent->getUID().compare(psUID))) - { - /* - * need to check recurrence id here... - */ - iHits++; - pEventList->RemoveAt(j); - delete pEvent; - pEvent = 0; - --j; - } - } - } - - - /* - * Write the updated calendar store out to disk... - */ - if (iHits > 0) - { - pCal->export(pHandle->psFile, bWriteStatus); - if (!bWriteStatus) - DEL_EXIT(CAPI_ERR1_INTERNAL); - } - - delete pCal; - pCal = 0; - - } - - -DELEVENT_EXIT: - if (0 != pCal) - delete pCal; - if (0 != pRedr) - delete pRedr; - - return iRetStatus; -} - -/** - * Destroy a list of handles. - */ -CAPIStatus CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: array of handles to destroy */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - PCAPIHANDLE* pHandle; - int i; - for (i = 0; i < iHandleCount; i++ ) - { - pHandle = (PCAPIHANDLE *)pHList[i]; - if (pHandle != 0) - { - if (pHandle->pCurl) - delete pHandle->pCurl; - CAPI_free(pHandle->psFile); - CAPI_free(pHandle); - } - } - return CAPI_ERR_OK; -} - -/** - * Destroy a list of streams - */ -CAPIStatus CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iCount, /* i: number of valid handles in ppH */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - PCAPIStream** paS = (PCAPIStream **) pS; - for (int i = 0; i < iCount; i++) - CAPI_free(paS[i]); - return CAPI_ERR_OK; -} - -/** - * return events that have alarms set to go off in the supplied time range. - */ -CAPIStatus CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream) /* i: stream to which solution set will be written */ -{ - return CAPI_ERR1_IMPLENTATION; -} - -#define FBID_EXIT(x) {iRetStatus = x; goto FBID_EXIT;} -#define FBRANGE_EXIT(x) {iRetStatus = x; goto FBRANGE_EXIT;} -/** - * Fetch an event from the local data store that matches the supplied UID, - * recurrence id, and modifier. - */ -CAPIStatus CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream str) /* i: stream to which solution set will be written */ -{ - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIHANDLE* pHandle = (PCAPIHANDLE*)h; - PCAPIStream* pStream = (PCAPIStream*)str; - - size_t iLen; - size_t iAmountHandled; - char *p; - CAPIStatus iStatus; - CAPIStatus iRetStatus = CAPI_ERR_OK; - char *pBuf = 0; - size_t iBufSize = BUFSIZ; - NSCalendar * pCal = 0; - ICalReader * pRedr = 0; - JulianPtrArray * evtVctr = 0; - ICalComponent * ic = 0; - JLog * pLog = 0; - UnicodeString usEvt; - UnicodeString u; - UnicodeString uRid; - UnicodeString uModifier; - UnicodeString strFmt; - ErrorCode status = ZERO_ERROR; - int32 i = 0; - UnicodeString uFilename = "calendar.ics"; - char * pCopy = 0; - - if (0 == pSession) - return CAPI_ERR2_SESSION_BAD; - if (0 == pHandle) - return CAPI_ERR2_HANDLE_BAD; - if (0 == pStream) - return CAPI_ERR2_STREAM_BAD; - - /* - * For this trivial implementation, we're going to read - * everything in the file and send it to the handler... - */ - if (0 != pStream->pfnRcvCallback) - { - /* - * We need an NSCalendar to do in-memory manipulations. - */ - pCal = new NSCalendar(pLog); - if (pCal == 0) - return CAPI_ERR1_INTERNAL; - evtVctr = new JulianPtrArray(); - if (evtVctr == 0) - FBID_EXIT(CAPI_ERR1_INTERNAL); - - /* - * Try to load pHandle->psFile in pCal - * if file error, return CAPI_ERR1_INTERNAL - */ - - if (CAPI_access(pHandle->psFile, 00 /*F_OK*/)) - { - FILE *pFile = 0; - if ( 0 == (pFile =CAPI_fopen(pHandle->psFile,"w"))) - FBID_EXIT(CAPI_ERR1_INTERNAL); - - if (0 != CAPI_fclose(pFile)) - FBID_EXIT(CAPI_ERR1_INTERNAL); - } - pRedr = (ICalReader *) new ICalFileReader(pHandle->psFile, status); - if (pRedr == 0) - FBID_EXIT(CAPI_ERR1_INTERNAL); - if (FAILURE(status)) - FBID_EXIT(CAPI_ERR1_INTERNAL); - - /* parse reader */ - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - - /* - * Apply the filter: - * JulianPtrArray EventVector - * pCal->GetEventsByID(&EventVector, psUID,dtRecurrenceID,iModifier ); - */ - /* TODO: use getEvents(uid, rid, range) */ - - u = psUID; - uRid = dtRecurrenceID; - uModifier = ""; - if (iModifier == CAPI_THISANDPRIOR) - uModifier = "THISANDPRIOR"; - else if (iModifier == CAPI_THISANDFUTURE) - uModifier = "THISANDFUTURE"; - - //pCal->getEvents(evtVctr, u); - pCal->getEventsByComponentID(evtVctr, u, uRid, uModifier); - - /* - * Stream out initialization ICAL: - * MIME header: - * Multipart-mime header: - * BEGIN:VCALENDAR - * separator - * END:VCALENDAR - */ - u = createMimeStartHeader(u); - appendMultipartMessageHeader(u, uFilename); - appendBeginVCalendar(u); - - if (0 == evtVctr->GetSize()) - { - appendEndVCalendar(u); - appendSeperator(u); - pCopy = u.toCString(""); - - if (pCopy != 0) - { - for(p = pCopy, iLen = CAPI_strlen(pCopy);iLen > 0; p += iAmountHandled) - { - iStatus = (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,iLen,&iAmountHandled); - if (CAPI_CALLBACK_CONTINUE != iStatus) - FBID_EXIT(CAPI_ERR1_CALLBACK); - iLen -= iAmountHandled; - } - delete [] pCopy; pCopy = 0; - } - else - { - FBID_EXIT(CAPI_ERR1_CALLBACK); - } - } - - /* - * For each event in EventVector... - * 0. TODO LATER: filter the event string by the supplied property list - * 1. Put an ICAL version of the event into sEvent - * - */ - ICalComponent::makeFormatString(ppsPropList, iPropCount, strFmt); - for (i = 0; i < evtVctr->GetSize(); i++) - { - ic = (ICalComponent *) evtVctr->GetAt(i); - - usEvt = ic->format(ICalComponent::componentToString(ic->GetType()), - strFmt, "", FALSE); - - // prepend MIME header to first event - // append END to last event - if (i == 0) - { - usEvt.insert(0, u); - } - if (i == evtVctr->GetSize() - 1) - { - appendEndVCalendar(usEvt); - appendSeperator(usEvt); - } - pCopy = usEvt.toCString(""); - if (pCopy == 0) - FBID_EXIT(CAPI_ERR1_MEMORY); - - for(p = pCopy, iLen = CAPI_strlen(pCopy);iLen > 0; p += iAmountHandled) - { - iStatus = (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,iLen,&iAmountHandled); - if (CAPI_CALLBACK_CONTINUE != iStatus) - FBID_EXIT(CAPI_ERR1_CALLBACK); - iLen -= iAmountHandled; - } - delete [] pCopy; pCopy = 0; - } - - /* - * Signal the end of transmission... - */ - (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,0,&iAmountHandled); - - -FBID_EXIT: - if (0 != pCal) - delete pCal; - if (0 != evtVctr) - delete evtVctr; - if (0 != pRedr) - delete pRedr; - if (0 != pCopy) - delete [] pCopy; - - } - return iRetStatus; -} - -/** - * Get a list of all the events that overlap a time range. - */ -CAPIStatus CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream str) /* i: stream to which solution set will be written */ -{ - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIHANDLE* pHandle = (PCAPIHANDLE*)pH; - PCAPIStream* pStream = (PCAPIStream*)str; - - size_t iLen; - size_t iAmountHandled; - char *p; - int i; - CAPIStatus iStatus; - CAPIStatus iRetStatus = CAPI_ERR_OK; - char *pBuf = 0; - size_t iBufSize = BUFSIZ; - - /* julian variables */ - NSCalendar * pCal = 0; - ICalReader * pRedr = 0; - JulianPtrArray * evtVctr = 0; - ICalComponent * ic = 0; - JLog * pLog = 0; - UnicodeString usEvt; - UnicodeString usHeader; - UnicodeString strFmt; - ErrorCode status = ZERO_ERROR; - char * pCopy = 0; - int32 j = 0; - DateTime start; - DateTime end; - UnicodeString uFilename; - UnicodeString uTemp; - - if (0 == pSession) - return CAPI_ERR2_SESSION_BAD; - if (0 == pH) - return CAPI_ERR2_HANDLE_BAD; - if (0 == pStream) - return CAPI_ERR2_STREAM_BAD; - - /* - * For this trivial implementation, we're going to read - * everything in the file and send it to the handler... - */ - if (0 != pStream->pfnRcvCallback) - { - /* - * For each handle, fetch events by range, print out event - * print mime-header if first handle. - * print mime-multipart stuff if first event. - */ - for (i = 0; i < iHandleCount; i++) - { - /*pCal = 0; - evtVctr = 0; - pRedr = 0; - pCopy = 0;*/ - pHandle = (PCAPIHANDLE *) pH[i]; - if (pHandle == 0) - { - return CAPI_ERR2_HANDLE_BAD; - } - - pCal = new NSCalendar(pLog); - if (pCal == 0) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - - evtVctr = new JulianPtrArray(); - if (evtVctr == 0) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - - /* - * Try to load pHandle->psFile in pCal - * if file error, return CAPI_ERR1_INTERNAL - */ - - if (CAPI_access(pHandle->psFile, 00 /*F_OK*/)) - { - FILE * pFile = 0; - if ( 0 == (pFile =CAPI_fopen(pHandle->psFile,"w"))) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - if (0 != CAPI_fclose(pFile)) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - } - - pRedr = (ICalReader *) new ICalFileReader(pHandle->psFile, status); - if (pRedr == 0) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - if (FAILURE(status)) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - - /* parse reader */ - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - - /* apply filter */ - uTemp = dStart; - start.setTimeString(uTemp); - uTemp = dEnd; - end.setTimeString(uTemp); - pCal->getEventsByRange(evtVctr, start, end); - - /* - * Stream out initialization ICAL: - * Mime headers, Multipart headers, seperator, BEGIN:VCALENDAR, END:VCALENDAR - */ - - /** - * create mime start header if this is the first handle of the list - */ - if (i == 0) - { - usHeader = createMimeStartHeader(usHeader); - } - else - { - usHeader = ""; - } - /** - * append mime-multipart header and BEGIN:VCALENDAR - */ - appendMultipartMessageHeader(usHeader, uFilename); - appendBeginVCalendar(usHeader); - - if (0 == evtVctr->GetSize()) - { - appendEndVCalendar(usHeader); - if (i == iHandleCount - 1) - { - appendSeperator(usHeader); - } - pCopy = usHeader.toCString(""); - - if (pCopy != 0) - { - for(p = pCopy, iLen = CAPI_strlen(pCopy);iLen > 0; p += iAmountHandled) - { - iStatus = (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,iLen,&iAmountHandled); - if (CAPI_CALLBACK_CONTINUE != iStatus) - FBRANGE_EXIT(CAPI_ERR1_CALLBACK); - iLen -= iAmountHandled; - } - delete [] pCopy; pCopy = 0; - } - else - { - FBRANGE_EXIT(CAPI_ERR1_CALLBACK); - } - } - else - { - ICalComponent::makeFormatString(ppsPropList, iPropCount, strFmt); - for (j = 0; j < evtVctr->GetSize(); j++) - { - ic = (ICalComponent *) evtVctr->GetAt(j); - - usEvt = ic->format(ICalComponent::componentToString(ic->GetType()), - strFmt, "", FALSE); - - // prepend mime-header to first handle, first event - // prepend multipart-header to first event, non-first handle - if (j == 0) - { - if (i == 0) - { - usEvt.insert(0, usHeader); - } - else - { - uTemp = ""; - appendMultipartMessageHeader(uTemp, uFilename); - usEvt.insert(0, uTemp); - } - } - // append END:VCALENDAR to last event. - if (j == evtVctr->GetSize() - 1) - { - appendEndVCalendar(usEvt); - if (i == iHandleCount - 1) - { - appendSeperator(usEvt); - } - } - - pCopy = usEvt.toCString(""); - if (pCopy == 0) - FBRANGE_EXIT(CAPI_ERR1_MEMORY); - - for(p = pCopy, iLen = CAPI_strlen(pCopy);iLen > 0; p += iAmountHandled) - { - iStatus = (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,iLen,&iAmountHandled); - if (CAPI_CALLBACK_CONTINUE != iStatus) - FBRANGE_EXIT(CAPI_ERR1_CALLBACK); - iLen -= iAmountHandled; - } - delete [] pCopy; pCopy = 0; - } - } - - /* - * we're paranoid about a path that doesn't delete something - */ - if (0 != pCal) - { - delete pCal; - pCal = 0; - } - if (0 != evtVctr) - { - delete evtVctr; - evtVctr = 0; - } - if (0 != pRedr) - { - delete pRedr; - pRedr = 0; - } - if (0 != pCopy) - { - delete pCopy; - pCopy = 0; - } - } - - /* - * Signal the end of transmission... - */ - (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,0,&iAmountHandled); - - } - -FBRANGE_EXIT: - if (0 != pCal) - delete pCal; - if (0 != evtVctr) - delete evtVctr; - if (0 != pRedr) - delete pRedr; - if (0 != pCopy) - delete pCopy; - - return iRetStatus; -} - -/** - * Return a handle to a specific calendar. In this implementation, - * the "user" should be the name of the file you want to open. - */ -CAPIStatus CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH) /* o: handle */ -{ - PCAPISESSION* pSession = (PCAPISESSION *) s; - PCAPIHANDLE* pHandle = (PCAPIHANDLE *) CAPI_malloc(sizeof(PCAPIHANDLE)); - if (0 == pSession) - return CAPI_ERR2_SESSION_NULL; - *pH = 0; - if (0 == pHandle) - return CAPI_ERR1_MEMORY; - - pHandle->pSession = pSession; - pHandle->pCurl = new nsCurlParser(u); - - /* - * For local capi, the user name is a file name. If it is not fully - * qualified, use the Curl in the session to fill in the missing parts. - */ - *pHandle->pCurl |= *pSession->pCurl; - - char* psLocalFile = pHandle->pCurl->ToLocalFile(); - pHandle->psFile = CAPI_strdup(psLocalFile); - PR_Free(psLocalFile); - - JulianString sPath = pHandle->pCurl->CSIDPath(); - if (NS_OK != CAPI_EnsureUserPath( sPath )) - { - // XXX do some error thing here... - // we should probably pop up a file dialog and let - // the user point us to a path to use. - return 1; - } - - *pH = pHandle; - return CAPI_ERR_OK; -} - -/** - * Close a session, release any associated memory. - */ -CAPIStatus CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - if (0 != s) - { - PCAPISESSION* pSession = (PCAPISESSION *) *s; - CAPI_free(pSession->psUser); - CAPI_free(pSession->psPassword); - CAPI_free(pSession->psHost); - delete pSession->pCurl; - CAPI_free(pSession); - *s = 0; - return CAPI_ERR_OK; - } - return CAPI_ERR2_SESSION_NULL; -} - -/** - * Open a session. - */ -CAPIStatus CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* ps) /* io: the session */ -{ - PCAPISESSION* pSession = (PCAPISESSION *) CAPI_malloc(sizeof(PCAPISESSION)); - *ps = 0; - if (0 == pSession) - return CAPI_ERR1_MEMORY; - pSession->psUser = CAPI_strdup(psUser); - pSession->psPassword = CAPI_strdup(psPassword); - pSession->psHost = CAPI_strdup(psHost); - - pSession->pCurl = new nsCurlParser(); - pSession->pCurl->SetHost(psHost); - pSession->pCurl->SetCSID(psUser); - - /* - * TODO: - * find / create the file associated with this user - */ - - *ps = (CAPISession) pSession; - return CAPI_ERR_OK; -} - -/** - * Open a session. - */ -CAPIStatus CAPI_LogonCurl( - const char* psCurl, /* i: the calendar url */ - const char* psPassword, /* i: password for sUser */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* ps) /* io: the session */ -{ - PCAPISESSION* pSession = (PCAPISESSION *) CAPI_malloc(sizeof(PCAPISESSION)); - *ps = 0; - if (0 == pSession) - return CAPI_ERR1_MEMORY; - pSession->psPassword = CAPI_strdup(psPassword); - - pSession->pCurl = new nsCurlParser(psCurl); - pSession->psUser = CAPI_strdup(pSession->pCurl->GetCSID().GetBuffer()); - pSession->psHost = CAPI_strdup(pSession->pCurl->GetHost().GetBuffer()); - - /* - * TODO: - * find / create the file associated with this user - */ - - *ps = (CAPISession) pSession; - return CAPI_ERR_OK; -} - -/** - * Set CAPI_Stream values - * pOpaqueStream is allocated if it is null. - */ -CAPIStatus CAPI_SetStreamCallbacks ( - CAPISession s, /* i: login session handle */ - CAPIStream* pOpaqueStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback, /* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback, /* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ) /* i: bit flags (none at this time; set to 0) */ -{ - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIStream* pRet = (PCAPIStream *)pOpaqueStream; - - if (0 == *pOpaqueStream) - { - pRet = (PCAPIStream *) CAPI_malloc(sizeof(PCAPIStream)); - if (0 == pRet) - return CAPI_ERR1_MEMORY; - CAPI_memset(pRet,0,sizeof(PCAPIStream)); - } - - pRet->pfnSndCallback = pfnSndCallback; - pRet->userDataSnd = userDataSnd; - pRet->pfnRcvCallback = pfnRcvCallback; - pRet->userDataRcv = userDataRcv; - - *pOpaqueStream = pRet; - - return CAPI_ERR_OK; -} - - -#define STOR_EXIT(x) {iRetStatus = x; goto STOREVENT_EXIT;} -/** - * Store the supplied event stream into the list of calendar stores pointed to - * by the supplied list of handles. - */ -CAPIStatus CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream str ) /* i: stream for reading data to store */ -{ - FILE *pFile; - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIHANDLE* pHandle; - PCAPIStream* pStream = (PCAPIStream*)(*(void **)str); - NSCalendar *pCal = 0; - char* pBuf = 0; - size_t iBufSize = BUFSIZ; - CAPIStatus iRetStatus = CAPI_ERR_OK; - CAPIStatus iStatus; - ICalReader * pRedr = 0; - JLog* pLog = 0; - UnicodeString uFilename; - int iTempFileCreated = 0; - int iWorking; - t_bool bWriteStatus; - size_t iLen; - ErrorCode status = ZERO_ERROR; - - if (0 == pSession) - return CAPI_ERR2_SESSION_BAD; - if (0 == pHList) - return CAPI_ERR2_HANDLE_BAD; - if (0 == pStream) - return CAPI_ERR2_STREAM_BAD; - - /* - * import the user supplied stream into pCal. - * In the interest of minimizing development time (ie, we're lazy) - * we're just going to save the user supplied data into a temporary file, - * import it into pCal, and write the result. - */ - - /* - * get a temporary file name... - */ - - char sTemplate[20]; - char* psTempFile; - sprintf(sTemplate,"CAPIXXXXXX"); - psTempFile = CAPI_mktemp( sTemplate ); - if( 0 == psTempFile) - return CAPI_ERR1_INTERNAL; - if( 0 == (pFile = CAPI_fopen(psTempFile,"w"))) - return CAPI_ERR1_INTERNAL; - - iTempFileCreated = 1; - pBuf = (char *) CAPI_malloc(iBufSize); - if (0 == pBuf) - STOR_EXIT(CAPI_ERR1_MEMORY); - - for( iWorking = 1; iWorking != 0; ) - { - iStatus = (*pStream->pfnSndCallback)( - pStream->userDataSnd, /* user data */ - pBuf, /* place to put the supplied data */ - iBufSize, /* the size of the buffer */ - &iLen); /* how much data was put in the buffer */ - if (iStatus > 0) - { - STOR_EXIT(CAPI_ERR1_CALLBACK); - } - else - { - if (iStatus == -1) - iWorking = 0; - if (iLen > 0) - { - if (iLen != CAPI_fwrite(pBuf,1,iLen,pFile)) - STOR_EXIT(CAPI_ERR1_CALLBACK); - } - } - } - - /* - * Temporary file has been written. Close pFile and import its contents into each - * of the caller supplied CAPI_handles - */ - if (0 != CAPI_fclose(pFile)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - pFile = 0; - CAPI_free(pBuf); - pBuf = 0; - - if (0 != pStream->pfnSndCallback) - { - - for (int i = 0; i < iHandleCount; i++) - { - pHandle = (PCAPIHANDLE*) pHList[i]; - if (0 == pHandle) - STOR_EXIT(CAPI_ERR2_HANDLE_BAD); - - /* - * create an NSCalendar, pCal - */ - pCal = new NSCalendar(pLog); - if (pCal == 0) - STOR_EXIT(CAPI_ERR1_INTERNAL); - - /* - * Try to load pHandle->psFile in pCal - * if file error, return CAPI_ERR1_INTERNAL - */ - - if (CAPI_access(pHandle->psFile, 00 /*F_OK*/)) - { - pFile = 0; - if ( 0 == (pFile =CAPI_fopen(pHandle->psFile,"w"))) - STOR_EXIT(CAPI_ERR1_INTERNAL); - - if (0 != CAPI_fclose(pFile)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - pFile = 0; - } - pRedr = (ICalReader *) new ICalFileReader(pHandle->psFile, status); - if (pRedr == 0) - STOR_EXIT(CAPI_ERR1_INTERNAL); - if (FAILURE(status)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - - /* - * Load original datastore... - */ - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - delete pRedr; pRedr = 0; - - - /* - * Import new event to store - */ - pRedr = (ICalReader *) new ICalFileReader(psTempFile, status); - if (pRedr == 0) - STOR_EXIT(CAPI_ERR1_INTERNAL); - if (FAILURE(status)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - delete pRedr; pRedr = 0; - - /* - * Write the updated calendar store out to disk... - */ - pCal->export(pHandle->psFile, bWriteStatus); - if (!bWriteStatus) - STOR_EXIT(CAPI_ERR1_INTERNAL); - - delete pCal; - pCal = 0; - - } - } - - if (0 != CAPI_unlink(psTempFile)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - iTempFileCreated = 0; - -STOREVENT_EXIT: - if (0 != pFile) - CAPI_fclose(pFile); - if (0 != pCal) - delete pCal; - if (0 != pRedr) - delete pRedr; - if (iTempFileCreated) - CAPI_unlink(psTempFile); - if (0 != pBuf) - CAPI_free(pBuf); - - return iRetStatus; -} - -/*************************************************************************************** -*** Simple test program -****************************************************************************************/ -#if 0 /* define test program */ -typedef struct -{ - char *p; - size_t iSize; -} CAPICTX; - -/** - * Send data to CAPI. This is invoked on calls such as CAPI_StoreEvent. - */ -int SndData(void* pData, char* pBuf, size_t iSize, size_t *piTransferred) -{ - CAPICTX* pCtx = (CAPICTX*)pData; - *piTransferred = (pCtx->iSize > iSize) ? iSize : pCtx->iSize; - CAPI_memcpy(pBuf, pCtx->p, *piTransferred ); - pCtx->iSize -= *piTransferred; - pCtx->p += *piTransferred; - return pCtx->iSize > 0 ? CAPI_CALLBACK_CONTINUE : CAPI_CALLBACK_DONE; -} - -/** - * Receive data from CAPI. This is invoked on calls such as - * CAPI_FetchEventsByID, CAPI_FetchEventsByRange. - */ -int RcvData(void* pData, char* pBuf, size_t iSize, size_t *piTransferred) -{ - CAPICTX* pCtx = (CAPICTX*)pData; - *piTransferred = (pCtx->iSize > iSize) ? iSize : pCtx->iSize; - CAPI_memcpy(pCtx->p, pBuf, *piTransferred ); - - /* - * for now, we're just going to print out whatever we get... - */ - { - char sBuf[2000]; - CAPI_memcpy(sBuf,pCtx->p,*piTransferred); - sBuf[*piTransferred]=0; - printf( "%s", sBuf ); - } - return CAPI_CALLBACK_CONTINUE; /* return values > 0 are error numbers. */ -} - -void main( int argc, char *argv[], char *envp[] ) -{ - char* psCap; - CAPIStatus s; - CAPISession Session; - CAPIHandle Handle; - char sBuf[BUFSIZ]; - CAPIStream SndStream; - CAPIStream RcvStream; - - CAPICTX MyCtx; - - if (CAPI_ERR_OK != (s = CAPI_Capabilities( &psCap, "localhost", 0 ))) - { - fprintf(stderr,"CAPI_Capabilities(): %ld\n", s); - exit(1); - } - - /* - * CAPABILITIES - */ - printf( "CAPI_Capabilities:\n%s\n", psCap ); - - /* - * LOGON - */ - if (CAPI_ERR_OK != (s = CAPI_Logon( "sman", "bla", "localhost", 0L, &Session ))) - { - fprintf(stderr,"CAPI_Logon(): %ld\n", s ); - exit(1); - } - printf("CAPI_Logon(): success\n" ); - - /* - * GET HANDLE - */ - if (CAPI_ERR_OK != (s = CAPI_GetHandle( Session, "c:/temp/junk.txt", 0, &Handle ))) - { - fprintf(stderr,"CAPI_Logon(): %ld\n", s ); - exit(1); - } - printf("CAPI_GetHandle(): success\n" ); - - /* - * STORE EVENT - */ - strcpy(sBuf,"Content-type: text/calendar\n\ -Content-encoding: 7bit\n\ -\n\ -BEGIN:VCALENDAR\n\ -METHOD:PUBLISH\n\ -PRODID:-//ACME/DesktopCalendar//EN\n\ -VERSION:2.0\n\ -BEGIN:VEVENT\n\ -ORGANIZER:mailto:a@example.com\n\ -DTSTART:19970701T200000Z\n\ -DTEND:19970701T220000Z\n\ -DTSTAMP:19970701T180000Z\n\ -SUMMARY:BIG TIME local capi store event\n\ -UID:QQIIDDLL098503945-34059873405-340598340@example.com\n\ -END:VEVENT\n\ -END:VCALENDAR\n" ); - MyCtx.p = sBuf; - MyCtx.iSize = strlen(sBuf); - if ( CAPI_ERR_OK != (s = CAPI_SetStreamCallbacks(Session, &SndStream, SndData, &MyCtx, 0, &MyCtx,0))) - { - fprintf(stderr,"CAPI_SetStreamCallbacks(): %ld\n", s ); - exit(1); - } - if ( CAPI_ERR_OK != (s = CAPI_StoreEvent( Session,&Handle,1,0,&SndStream))) - { - fprintf(stderr,"CAPI_StoreEvent(): %ld\n", s ); - exit(1); - } - - /* - * FETCH EVENT - */ - MyCtx.p = sBuf; - MyCtx.iSize = sizeof(sBuf); - if ( CAPI_ERR_OK != (s = CAPI_SetStreamCallbacks(Session, &RcvStream, 0,0,RcvData, &MyCtx,0))) - { - fprintf(stderr,"CAPI_SetStreamCallbacks(): %ld\n", s ); - exit(1); - } - if ( CAPI_ERR_OK != (s = CAPI_FetchEventsByID( Session,Handle,0,"098503945-34059873405-340598340@example.com",0,0,0,0,&RcvStream))) - { - fprintf(stderr,"CAPI_FetchEventsByID(): %ld\n", s ); - exit(1); - } - - /* - * DESTROY HANDLES - */ - if (CAPI_ERR_OK != (s = CAPI_DestroyHandles(Session, &Handle, 1, 0L))) - { - fprintf(stderr,"CAPI_DestroyHandles(): %ld\n", s ); - exit(1); - } - printf("CAPI_DestroyHandles(): success\n" ); - - /* - * LOGOFF - */ - if (CAPI_ERR_OK != (s = CAPI_Logoff( &Session, 0L))) - { - fprintf(stderr,"CAPI_Logoff(): %ld\n", s ); - exit(1); - } - printf("CAPI_Logoff(): success\n" ); - - if (0 != Session) - { - fprintf(stderr,"Session was not NULL after CAPI_Logoff\n"); - exit(1); - } - printf("CAPI Test Program: normal exit\n" ); -} -#endif /* define test program */ diff --git a/mozilla/calendar/modules/core/capi/local/src/config.mk b/mozilla/calendar/modules/core/capi/local/src/config.mk deleted file mode 100644 index 5564ccc3216..00000000000 --- a/mozilla/calendar/modules/core/capi/local/src/config.mk +++ /dev/null @@ -1,27 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -DNLS_DEFINE_STANDARD_TYPES=1 -INCLUDES += -I../inc -I$(GDEPTH)/include - - -LD_LIBS += \ - $(NATIVE_LIBNLS_LIBS) \ - cal_core_ical10 \ - util10 \ - $(NULL) - -EXTRA_LIBS += $(NSPR_LIBS) - diff --git a/mozilla/calendar/modules/core/capi/local/src/manifest.mn b/mozilla/calendar/modules/core/capi/local/src/manifest.mn deleted file mode 100644 index 1c7c2b7f0cd..00000000000 --- a/mozilla/calendar/modules/core/capi/local/src/manifest.mn +++ /dev/null @@ -1,27 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -LIBRARY_NAME = capilocal - -MODULE = trex - -CPPSRCS = \ - capi.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls netlib - diff --git a/mozilla/calendar/modules/core/capi/manifest.mn b/mozilla/calendar/modules/core/capi/manifest.mn deleted file mode 100644 index 80314e3daae..00000000000 --- a/mozilla/calendar/modules/core/capi/manifest.mn +++ /dev/null @@ -1,14 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS = local - diff --git a/mozilla/calendar/modules/core/config.mk b/mozilla/calendar/modules/core/config.mk deleted file mode 100644 index e4f7d0f363a..00000000000 --- a/mozilla/calendar/modules/core/config.mk +++ /dev/null @@ -1,40 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -I$(GDEPTH)/include - -ifeq ($(OS_ARCH), WINNT) -CFLAGS += /Zm1000 -endif - -LD_LIBS += \ - raptorbase \ - raptorhtmlpars \ - xpcom$(MOZ_BITS) \ - $(NATIVE_RAPTOR_WIDGET) \ - calcapi10 \ - cal_core_ical10 \ - util10 \ - xpcom$(MOZ_BITS) \ - $(NATIVE_LIBNLS_LIBS) \ - $(XP_REG_LIB) - -AR_LIBS += \ - cal_core_src \ - $(NULL) - - -EXTRA_LIBS += $(NSPR_LIBS) - diff --git a/mozilla/calendar/modules/core/htmlform/Makefile b/mozilla/calendar/modules/core/htmlform/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/htmlform/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/htmlform/inc/Makefile b/mozilla/calendar/modules/core/htmlform/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/htmlform/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/htmlform/inc/form.h b/mozilla/calendar/modules/core/htmlform/inc/form.h deleted file mode 100644 index c236c882dab..00000000000 --- a/mozilla/calendar/modules/core/htmlform/inc/form.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef _JULIAN_FORMS_H -#define _JULIAN_FORMS_H - -#include "julianform.h" -#include "julnstr.h" - -class JULIAN_PUBLIC JulianServerProxy -{ -public: - ICalComponent* ic; - - JulianServerProxy() {}; - virtual ~JulianServerProxy() {}; - ICalComponent* getByUid(char *uid) { return ic; }; - - void setICal(ICalComponent* i) { ic = i; }; - -}; - -#include "formFactory.h" - -typedef struct -{ - char* type; - char* data; -} form_data_combo; - -class JULIAN_PUBLIC JulianForm -{ -private: - - JulianString htmlForm; - char* mimedata; - char buttonLabel[2048]; - NSCalendar* imipCal; - pJulian_Form_Callback_Struct JulianForm_CallBacks; - /* added 7-7-98 */ - static XP_Bool ms_bFoundNLSDataDirectory; - JulianFormFactory* jff; - -public: - JulianForm(); - virtual ~JulianForm(); - - int32 refcount; /* Who's looking at this */ - int32 formDataCount; /* number of pointers in formData */ - PRMonitor * my_monitor; - - /* number of possible pointers in formData */ - #define formDataIndex 10 - form_data_combo formData[formDataIndex]; /* a pointer to an array of pointers that point to a type/data string */ - - char* contextName; - - XP_Bool StartHTML(); - char* getHTMLForm(XP_Bool Want_Detail, NET_StreamClass *this_stream = nil); - void setMimeData(char *mimedata); - void setCallbacks(pJulian_Form_Callback_Struct callBacks) { JulianForm_CallBacks = callBacks; }; - pJulian_Form_Callback_Struct getCallbacks() { return JulianForm_CallBacks; }; - - void setCalendar(NSCalendar* newCal) { imipCal = newCal; } - NSCalendar * getCalendar() { return imipCal; } - JulianPtrArray * getEvents() { if (imipCal) { return imipCal->getEvents(); } else return 0; } - - /* added 7-7-98 */ - static void setFoundNLSDataDirectory(XP_Bool bFound) { ms_bFoundNLSDataDirectory = bFound; } - static XP_Bool isFoundNLSDataDirectory() { return ms_bFoundNLSDataDirectory; } - - MWContext* getContext() { return (*JulianForm_CallBacks->FindNamedContextInList)((*JulianForm_CallBacks->FindSomeContext)(), contextName); } - - XP_Bool hasComment() { return getComment() != nil; } - char* getComment(); - char* getDelTo(); - - char* getLabel() { return buttonLabel; } - void setLabel(char *newlabel) { if (newlabel) XP_STRCPY(buttonLabel, newlabel); if (getCallbacks() && getCallbacks()->PlusToSpace) (*getCallbacks()->PlusToSpace)(buttonLabel); } -}; - -XP_BEGIN_PROTOS - -JulianForm* jform_CreateNewForm (char *calendar_mime_data, pJulian_Form_Callback_Struct callbacks, XP_Bool bFoundNLSDataDirectory); -void jform_DeleteForm (JulianForm *jf); -char* jform_GetForm (JulianForm *jf); -void jform_CallBack (JulianForm *jf, char *type); - -XP_END_PROTOS -#endif - diff --git a/mozilla/calendar/modules/core/htmlform/inc/formFactory.h b/mozilla/calendar/modules/core/htmlform/inc/formFactory.h deleted file mode 100644 index ccd246a2f79..00000000000 --- a/mozilla/calendar/modules/core/htmlform/inc/formFactory.h +++ /dev/null @@ -1,534 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef _JULIAN_FormFactory_H -#define _JULIAN_FormFactory_H - -#include "jdefines.h" -#include "julnstr.h" - -class JulianForm; -#if defined(XP_PC) -#pragma warning ( disable : 4251 ) -#endif - -const int32 jff_clip_events = 50; - -class JULIAN_PUBLIC JulianFormFactory -{ -friend class JulianForm; - -public: - JulianFormFactory(); - JulianFormFactory(NSCalendar& imipCal); - JulianFormFactory(NSCalendar& imipCal, JulianServerProxy* jsp); - JulianFormFactory(NSCalendar& imipCal, JulianForm& hostForm, pJulian_Form_Callback_Struct callbacks); - - /* - ** Call init before calling getHTML() - */ - void init(); - - virtual ~JulianFormFactory(); - - /* - ** Returns a new UnicodeString with html that is intended to be enclosed in a real html file. - ** Call is responable for disposing of the returned UnicodeString. - */ - XP_Bool getHTML(JulianString* htmlstorage, XP_Bool want_detail = FALSE); - XP_Bool getHTML(JulianString* OutString, NET_StreamClass *this_stream, XP_Bool want_detail = FALSE); - - /* - ** Sets the base NSCalendar. - */ - void setNSCalendar(NSCalendar& newCalendar) { firstCalendar = &newCalendar; } - - /* - ** These are the different form button types. The call back url will list - ** as it's first thing the type = the name. - */ - static JulianString Buttons_Details_Type; - static JulianString Buttons_Add_Type; - static JulianString Buttons_Close_Type; - static JulianString Buttons_Accept_Type; - static JulianString Buttons_Decline_Type; - static JulianString Buttons_Tentative_Type; - static JulianString Buttons_SendFB_Type; - static JulianString Buttons_SendRefresh_Type; - static JulianString Buttons_DelTo_Type; - static JulianString CommentsFieldName; - static JulianString DelToFieldName; - static JulianString SubjectSep; - -private: - NSCalendar* firstCalendar; // Base NSCalendar - ICalComponent* thisICalComp; // Current vEnvent or vFreeBusy that is being made into html - ICalComponent* serverICalComp; // Current Database Version vEnvent or vFreeBusy that is being made into html - XP_Bool detail; - JulianString* s; // Holds the html that is being built up. - JulianForm* jf; - JulianServerProxy* ServerProxy; // How to get to the server - int32 maxical; // # of vevetns otr vfreebusy in the array - int32 aref_count; // For muiltevent table of contents - int32 aref2_count; // For muiltevent each form. must be in sync with aref_count - pJulian_Form_Callback_Struct cb;// How to call code to create urls for the buttons - NET_StreamClass *outStream; // Could be streamed output. Optional - XP_Bool do_capi_login; // Default is not to ask for capi login info - - // Use by the freebusy table. In order. - enum FB_State { - Empty_State, - Free_State, - XParam_State, - Busy_State - }; - - nsCalDuration MinutesPerSlot; - int32 SlotsPerHour; - XP_Bool displayTimeZone; - int32 scaleType; // 1 = days 1 to 31, 2 = hours 0 to 24 - int32 slotsacross; - int32 hoursToDisplay; // 1 to 24. default is 24 hours - FB_State state; // For free, busy, skip state - FB_State new_state; - int32 count; - JulianString tz; - JulianString uTemp; - JulianString lineFormat; - char* TimeHour_HTML; - int32 start_hour; - int32 end_hour; - DateTime start; - DateTime end; - TimeZone* default_tz; - Period* p; - Freebusy* fb; - int32 fbIndex; - int32 pIndex; - JulianPtrArray* pv; - JulianPtrArray* fbv; - - // These bools show what types of ical objects are being used in this message - XP_Bool isEvent; - XP_Bool isFreeBusy; - - void SetDetail(XP_Bool newDetail) { detail = newDetail; }; - XP_Bool isDetail() { return detail;}; - XP_Bool isPreProcessed(JulianString& icalpropstr) { return (ICalPreProcess.IndexOf(icalpropstr.GetBuffer(), 0) >= 0); }; - XP_Bool isPostProcessed(JulianString& icalpropstr) { return (ICalPostProcess.IndexOf(icalpropstr.GetBuffer(), 0) >= 0); }; - - JulianString * doARef(JulianString& refText, JulianString& refTarget, JulianString* outputString); - JulianString * doFont(JulianString& fontText, JulianString* outputString); - JulianString * doItalic(JulianString& ItalicText, JulianString* outputString); - JulianString * doBold(JulianString& BoldText, JulianString* outputString); - JulianString * doBold(char* BoldText, JulianString* outputString); - - void doAddHTML(UnicodeString & moreHtml) { char*y = moreHtml.toCString(""); if (y) {*s += y; delete y;} flush_stream(); }; - void doAddHTML(JulianString & moreHtml) { *s += moreHtml; flush_stream();}; - void doAddHTML(JulianString * moreHtml) { *s +=*moreHtml; flush_stream();}; - void doAddHTML(char* moreHtml) { *s += moreHtml; flush_stream();}; - int32 flush_stream(); - - void doPreProcessing(char* icalpropstr); - void doPreProcessingDateTime(JulianString & icalpropstr, XP_Bool allday, DateTime &start, DateTime &end, ICalComponent &ic); - void doPreProcessingAttend(ICalComponent &ic); - void doPreProcessingOrganizer(ICalComponent &ic); - void doDifferenceProcessing(JulianString icalpropstr); - void doDifferenceProcessingAttendees(); - void doHeaderMuiltStart(); - void doHeaderMuilt(); - void doHeaderMuiltEnd(); - - void doProps(int32 labelCount, JulianString labels[], int32 dataCount, JulianString data[]); - void doHeader(JulianString HeaderText); - void doClose(); - void doStatus(); - void doSingleTableLine(JulianString & labelString, JulianString & dataString, XP_Bool addSpacer = TRUE); - void doCommentText(); - JulianString doCreateButton(JulianString InputType, JulianString ButtonName, XP_Bool addtextField = FALSE); - void doAddGroupButton(JulianString GroupButton_HTML); - void doAddButton(JulianString SingleButton_HTML); - void doMakeFreeBusyTable(); - - void HandleError(); - void HandlePublishVEvent(); - void HandlePublishVFreeBusy(XP_Bool isPublish); - void HandleRequestVEvent(); - void HandleRequestVFreeBusy(); - void HandleEventReplyVEvent(); - void HandleEventCancelVEvent(); - void HandleEventRefreshRequestVEvent(); - void HandleEventCounterPropVEvent(); - void HandleDeclineCounterVEvent(); - - char* getJulianErrorString(int32 ErrorNum); - -/* Table Utils Functions */ - void addLegend(); - void addTimeZone(); - void addMajorScale(); - void addMinorScale(); - void addTicksScale(); - /*void emptyRow();*/ - void makeHourFBTable(); - void makeDaysFBTable(); - void DaysLineInc(DateTime* dtTime); - void MonthLineInc(DateTime* dtTime); - void LineInc(DateTime* dtTime); - int32 LineCheck(DateTime& baseTime, DateTime& checkTime, DateTime& checkTimeEnd); - void enterState(FB_State newState, XP_Bool forse); - void checkPeriodBounds(DateTime& startofslot, DateTime& endofslot); - Period* getNextPeriod(); - int32 getFBType(); - - JulianString MoreErrors; - JulianString TooManyEvents; - JulianString error0; - JulianString error1; - JulianString error2; - JulianString error3; - JulianString error4; - JulianString error5; - JulianString error6; - JulianString error7; - - static char* Start_HTML; - static char* End_HTML; - static char* Props_Head_HTML; - static char* Props_HTML_Before_Label; - static char* Props_HTML_After_Label; - static char* Props_HTML_After_Data; - static char* Props_HTML_Empty_Label; - static char* Props_End_HTML; - static char* General_Header_Start_HTML; - static char* General_Header_Status_HTML; - static char* General_Header_End_HTML; - static char* Head2_HTML; - static char* Italic_Start_HTML; - static char* Italic_End_HTML; - static char* Bold_Start_HTML; - static char* Bold_End_HTML; - static char* Aref_Start_HTML; - static char* Aref_End_HTML; - static char* ArefTag_End_HTML; - static char* nbsp; - static char* Accepted_Gif_HTML; - static char* Declined_Gif_HTML; - static char* Delegated_Gif_HTML; - static char* NeedsAction_Gif_HTML; - static char* Question_Gif_HTML; - static char* Line_3_HTML; - static char* Cell_Start_HTML; - static char* Cell_End_HTML; - static char* Font_Fixed_Start_HTML; - static char* Font_Fixed_End_HTML; - static char* Line_Break_HTML; - - static char* Start_Font; - static char* Start_BIG_Font; - static char* End_Font; - - static char* Buttons_Single_Start_HTML; - static char* Buttons_Single_Mid_HTML; - static char* Buttons_Single_End_HTML; - static char* Buttons_Text_End_HTML; - - JulianString Buttons_Details_Label; - JulianString Buttons_Add_Label; - JulianString Buttons_Close_Label; - JulianString Buttons_Accept_Label; - JulianString Buttons_AcceptAll_Label; - JulianString Buttons_Update_Label; - JulianString Buttons_Decline_Label; - JulianString Buttons_Tentative_Label; - JulianString Buttons_SendFB_Label; - JulianString Buttons_SendRefresh_Label; - JulianString Buttons_DelTo_Label; - - static char* Buttons_SaveDel_HTML; - - static char* Buttons_GroupStart_HTML; - static char* Buttons_GroupEnd_HTML; - static char* Buttons_GroupSingleStart_HTML; - static char* Buttons_GroupSingleEnd_HTML; - - static char* Text_Label_Start_HTML; - static JulianString Text_Label; - static char* Text_Label_End_HTML; - static char* Text_Field_HTML; - - static JulianString ICalPreProcess; - static JulianString ICalPostProcess; - - JulianString EventInSchedule; - JulianString EventNotInSchedule; - JulianString EventConflict; - JulianString EventNote; - JulianString EventError; - JulianString EventTest; - JulianString Text_To; - JulianString Text_AllDay; - JulianString Text_StartOn; - JulianString Text_Was; - JulianString MuiltEvent; - JulianString WhenStr; - JulianString WhatStr; - - JulianString MuiltEvent_Header_HTML; - JulianString MuiltFB_Header_HTML; - - char* String_What; - char* String_When; - char* String_Location; - char* String_Organizer; - char* String_Status; - char* String_Priority; - char* String_Categories; - char* String_Resources; - char* String_Attachments ; - char* String_Alarms; - char* String_Created ; - char* String_Last_Modified; - char* String_Sent; - char* String_UID ; - - /* - ** Free/Busy Table - */ - static char* FBT_Start_HTML; - static char* FBT_End_HTML; - static char* FBT_NewRow_HTML; - static char* FBT_EndRow_HTML; - static char* FBT_TimeHead_HTML; - static char* FBT_TimeHeadEnd_HTML; - static char* FBT_TimeHour_HTML; - static char* FBT_TimeHourEnd_HTML; - static char* FBT_TD_HourColor_HTML; - static char* FBT_TD_HourColorEnd_HTML; - static char* FBT_TD_MinuteColor_HTML; - static char* FBT_TD_MinuteColorEnd_HTML; - static char* FBT_TDOffsetCell_HTML; - static char* FBT_TickLong_HTML; - static char* FBT_TickShort_HTML; - static char* FBT_TimeMin_HTML; - static char* FBT_TimeMinEnd_HTML; - static char* FBT_HourStart; - static char* FBT_HourEnd; - - static char* FBT_DayStart_HTML; - static char* FBT_DayEnd_HTML; - static char* FBT_DayEmptyCell_HTML; - static char* FBT_DayFreeCell_HTML; - static char* FBT_DayBusyCell_HTML; - static char* FBT_DayXParamCell_HTML; - static char* FBT_EmptyRow_HTML; - static char* FBT_DayXColFreeCell_HTML; - static char* FBT_DayXColBusyCell_HTML; - static char* FBT_DayXColEmptyCell_HTML; - static char* FBT_DayXXParamCell_HTML; - - static char* FBT_MonthFormat; - static char* FBT_TickDaySetting; - - static char* FBT_Legend_Start_HTML; - static char* FBT_Legend_Text1_HTML; - static char* FBT_Legend_Text2_HTML; - static char* FBT_Legend_Text3_HTML; - static char* FBT_Legend_Text4_HTML; - static char* FBT_Legend_Text5_HTML; - static char* FBT_Legend_TextEnd_HTML; - static char* FBT_Legend_End_HTML; - - JulianString FBT_Legend_Title; - JulianString FBT_Legend_Free; - JulianString FBT_Legend_Busy; - JulianString FBT_Legend_Unknown; - JulianString FBT_Legend_xparam; - - JulianString FBT_AM; - JulianString FBT_PM; - static char* FBT_TickMark1; - static char* FBT_TickMark2; - static char* FBT_TickMark3; - static char* FBT_TickMark4; - static char* FBT_TickSetting; - static char* FBT_TickOffset; - static char* FBT_DayFormat; - - /* - ** Error - */ - char* error_Header_HTML; - static int32 error_Fields_Labels_Length; - static JulianString error_Fields_Labels[]; - static int32 error_Fields_Data_HTML_Length; - static JulianString error_Fields_Data_HTML[]; - static char* error_End_HTML ; - - /* - ** Publish - */ - char* publish_Header_HTML; - static int32 publish_Fields_Labels_Length; - static JulianString publish_Fields_Labels[]; - static int32 publish_Fields_Data_HTML_Length; - static JulianString publish_Fields_Data_HTML[]; - static char* publish_End_HTML; - - /* - ** Publish Detail - */ - static int32 publish_D_Fields_Labels_Length; - static JulianString publish_D_Fields_Labels[]; - static int32 publish_D_Fields_Data_HTML_Length; - static JulianString publish_D_Fields_Data_HTML[]; - - /* - ** Publish VFreeBusy - */ - char* publishFB_Header_HTML; - char* replyFB_Header_HTML; - static int32 publishFB_Fields_Labels_Length; - static JulianString publishFB_Fields_Labels[]; - static int32 publishFB_Fields_Data_HTML_Length; - static JulianString publishFB_Fields_Data_HTML[]; - static char* publishFB_End_HTML; - - /* - ** Publish VFreeBusy Detail - */ - static int32 publishFB_D_Fields_Labels_Length; - static JulianString publishFB_D_Fields_Labels[]; - static int32 publishFB_D_Fields_Data_HTML_Length; - static JulianString publishFB_D_Fields_Data_HTML[]; - - /* - ** Request - */ - char* request_Header_HTML; - static int32 request_Fields_Labels_Length; - static JulianString request_Fields_Labels[]; - static int32 request_Fields_Data_HTML_Length; - static JulianString request_Fields_Data_HTML[]; - static char* request_End_HTML; - - /* - ** Request Detail - */ - static int32 request_D_Fields_Labels_Length; - static JulianString request_D_Fields_Labels[]; - static int32 request_D_Fields_Data_HTML_Length; - static JulianString request_D_Fields_Data_HTML[]; - - /* - ** Request VFreeBusy - */ - char* request_FB_Header_HTML; - static int32 request_FB_Fields_Labels_Length; - static JulianString request_FB_Fields_Labels[]; - static int32 request_FB_Fields_Data_HTML_Length; - static JulianString request_FB_Fields_Data_HTML[]; - static char* request_FB_End_HTML; - - /* - ** Request VFreeBusy Detail - */ - char* request_D_FB_Header_HTML; - static int32 request_D_FB_Fields_Labels_Length; - static JulianString request_D_FB_Fields_Labels[]; - static int32 request_D_FB_Fields_Data_HTML_Length; - static JulianString request_D_FB_Fields_Data_HTML[]; - static char* request_D_FB_End_HTML; - - /* - ** Event Reply - */ - char* eventreply_Header_HTML; - static int32 eventreply_Fields_Labels_Length; - static JulianString eventreply_Fields_Labels[]; - static int32 eventreply_Fields_Data_HTML_Length; - static JulianString eventreply_Fields_Data_HTML[]; - static char* eventreply_End_HTML; - - /* - ** Event Reply Detail - */ - static int32 eventreply_D_Fields_Labels_Length; - static JulianString eventreply_D_Fields_Labels[]; - static int32 eventreply_D_Fields_Data_HTML_Length; - static JulianString eventreply_D_Fields_Data_HTML[]; - - /* - ** Event Cancel - */ - char* eventcancel_Header_HTML; - static int32 eventcancel_Fields_Labels_Length; - static JulianString eventcancel_Fields_Labels[]; - static int32 eventcancel_Fields_Data_HTML_Length; - static JulianString eventcancel_Fields_Data_HTML[]; - static char* eventcancel_End_HTML; - - /* - ** Event Cancel Detail - */ - static int32 eventcancel_D_Fields_Labels_Length; - static JulianString eventcancel_D_Fields_Labels[]; - static int32 eventcancel_D_Fields_Data_HTML_Length; - static JulianString eventcancel_D_Fields_Data_HTML[]; - - /* - ** Event Refresh Request - */ - char* eventrefreshreg_Header_HTML; - static int32 eventrefreshreg_Fields_Labels_Length; - static JulianString eventrefreshreg_Fields_Labels[]; - static int32 eventrefreshreg_Fields_Data_HTML_Length; - static JulianString eventrefreshreg_Fields_Data_HTML[]; - static char* eventrefreshreg_End_HTML; - - /* - ** Event Refresh Request Detail - */ - static int32 eventrefreshreg_D_Fields_Labels_Length; - static JulianString eventrefreshreg_D_Fields_Labels[]; - static int32 eventrefreshreg_D_Fields_Data_HTML_Length; - static JulianString eventrefreshreg_D_Fields_Data_HTML[]; - - /* - ** Event Counter Proposal - */ - char* eventcounterprop_Header_HTML; - - /* - ** Event Deline Counter - */ - char* eventdelinecounter_Header_HTML; - static int32 eventdelinecounter_Fields_Labels_Length; - static JulianString eventdelinecounter_Fields_Labels[]; - static int32 eventdelinecounter_Fields_Data_HTML_Length; - static JulianString eventdelinecounter_Fields_Data_HTML[]; -}; -#if defined(XP_PC) -#pragma warning ( default : 4251 ) -#endif - -#endif diff --git a/mozilla/calendar/modules/core/htmlform/inc/julianform.h b/mozilla/calendar/modules/core/htmlform/inc/julianform.h deleted file mode 100644 index a31725d3941..00000000000 --- a/mozilla/calendar/modules/core/htmlform/inc/julianform.h +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef _JULIANFORM_H -#define _JULIANFORM_H - -#include "jdefines.h" -#include "netcburl.h" -#include "fe_proto.h" - -XP_BEGIN_PROTOS - -typedef struct Julian_Form_Callback_Struct -{ - /* - ** callbackurl should be set to NET_CallbackURLCreate(), it's - ** in netcburl.h. Can also be set to nil. - */ - char* (*callbackurl)(NET_CallbackURLFunc func, void* closure); - - /* - ** callbackurlfree should be set to NET_CallbackURLFree(), it's - ** in netcburl.h. Can also be set to nil. - */ - int (*callbackurlfree)(NET_CallbackURLFunc func, void* closure); - - /* - ** Should Link to NET_ParseURL() - */ - char* (*ParseURL)(const char *url, int wanted); - - /* - ** Should Link to FE_MakeNewWindow() - */ - MWContext* (*MakeNewWindow)(MWContext *old_context, URL_Struct *url, char *window_name, Chrome *chrome); - - /* - ** Should Link to NET_CreateURLStruct (); - */ - URL_Struct* (*CreateURLStruct) (const char *url, NET_ReloadMethod force_reload); - - /* - ** Should Link to PA_BeginParseMDL() - */ - NET_StreamClass* (*BeginParseMDL) (FO_Present_Types format_out, void *init_data, URL_Struct *anchor, MWContext *window_id); - - /* - ** Should Link to NET_SACopy() - */ - char* (*SACopy) (char **dest, const char *src); - - /* - ** Should Link to NET_SendMessageUnattended(). Added by John Sun 4-22-98. - */ - int (*SendMessageUnattended) (MWContext* context, char* to, char* subject, char* otherheaders, char* body); - - /* - ** Should Link to FE_DestroyWindow. Added by John Sun 4-22-98. - */ - void (*DestroyWindow) (MWContext* context); - - /* - ** Should Link to FE_RaiseWindow. - */ - void (*RaiseWindow) (MWContext* context); - - /* - ** Should Link to Current MWContext. - */ - MWContext* my_context; - - /* - ** Should Link to XP_GetString. - */ - char* (*GetString) (int i); - - /* - ** Should Link to XP_FindSomeContext() - */ - MWContext* (*FindSomeContext)(); - - /* - ** Should Link to XP_FindNamedContextInList() - */ - MWContext* (*FindNamedContextInList)(MWContext* context, char *name); - - /* - ** Should Link to PREF_CopyCharPref() - */ - int (*CopyCharPref)(const char *pref, char ** return_buf); - - /* - ** Should Link to NET_UnEscape() - */ - char* (*UnEscape)(char *str); - - /* - ** Should Link to NET_PlusToSpace() - */ - void (*PlusToSpace)(char *str); - - /* - ** Should Link to PREF_SetCharPref() - */ - int (*SetCharPref)(const char *pref, const char* buf); - - /* - ** Should Link to FE_PromptUsernameAndPassword() - */ - Bool (*PromptUsernameAndPassword)(MWContext* window_id, char* message, char** username, char** password); - - /* - ** Should Link to LO_ProcessTag(). - */ - intn (*ProcessTag)(void *data_object, PA_Tag *tag, intn status); - -#if defined(XP_WIN)||defined(XP_UNIX) - /* - ** Should link to FEU_GetJulianPath. Get the path to the Julian directory. Added by John Sun 5-14-98. - */ - void (*GetJulianPath) (char ** julianPath, void * emptyArg); -#endif - - /* - ** Should Link to PREF_GetBoolPref() - */ - int (*BoolPref)(const char *pref, XP_Bool * return_val); - - /* - ** Should Link to PREF_GetIntPref() - */ - int (*IntPref)(const char *pref, int32 * return_int); - -} Julian_Form_Callback_Struct, *pJulian_Form_Callback_Struct; - -/* -** Caller disposes of callbacks. -*/ -XP_Bool JULIAN_PUBLIC jf_Initialize(pJulian_Form_Callback_Struct callbacks); - -void JULIAN_PUBLIC *jf_New(char *calendar_mime_data, XP_Bool bFoundNLSDataDirectory); -void JULIAN_PUBLIC jf_Destroy(void *instdata); -void JULIAN_PUBLIC jf_Shutdown(void); -char JULIAN_PUBLIC *jf_getForm(void *instdata); -void JULIAN_PUBLIC jf_setDetail(int detail_form); -void JULIAN_PUBLIC jf_callback(void *instdata, char* url, URL_Struct *URL_s); -void JULIAN_PUBLIC jf_detail_callback(void *instdata, char *url, URL_Struct *URL_s); - -XP_END_PROTOS - -#endif diff --git a/mozilla/calendar/modules/core/htmlform/inc/manifest.mn b/mozilla/calendar/modules/core/htmlform/inc/manifest.mn deleted file mode 100644 index 7d36db3dae4..00000000000 --- a/mozilla/calendar/modules/core/htmlform/inc/manifest.mn +++ /dev/null @@ -1,23 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - form.h \ - formFactory.h \ - julianform.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/core/htmlform/manifest.mn b/mozilla/calendar/modules/core/htmlform/manifest.mn deleted file mode 100644 index 364aaa1bd7f..00000000000 --- a/mozilla/calendar/modules/core/htmlform/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/core/htmlform/src/Makefile b/mozilla/calendar/modules/core/htmlform/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/core/htmlform/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/core/htmlform/src/config.mk b/mozilla/calendar/modules/core/htmlform/src/config.mk deleted file mode 100644 index 6d379d80d38..00000000000 --- a/mozilla/calendar/modules/core/htmlform/src/config.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include -I$(GDEPTH)/htmlparser/src - -LIBRARY_NAME = cal_core_htmlform -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) diff --git a/mozilla/calendar/modules/core/htmlform/src/form.cpp b/mozilla/calendar/modules/core/htmlform/src/form.cpp deleted file mode 100644 index 32e9bd5b032..00000000000 --- a/mozilla/calendar/modules/core/htmlform/src/form.cpp +++ /dev/null @@ -1,924 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "jdefines.h" -#include "julnstr.h" - -#include -#include -#include -#include -#include -#include "smpdtfmt.h" -#include -#include "datetime.h" -#include "jutility.h" -#include "duration.h" - -#include "attendee.h" -#include "vevent.h" -#include "icalsrdr.h" -#include "icalfrdr.h" -#include "prprty.h" -#include "icalprm.h" -#include "freebusy.h" -#include "vfrbsy.h" -#include "nscal.h" -#include "keyword.h" - -#include "txnobjfy.h" -#include "user.h" -#include "txnobj.h" - -#include "jlog.h" -#include "uri.h" - -#include "xp.h" -#include "prmon.h" - -#include "form.h" - -static void julian_handle_close(JulianForm *jf); -#ifdef OSF1 - void julian_handle_accept(JulianForm *jf, int newStatus); -#else - void julian_handle_accept(JulianForm *jf, Attendee::STATUS newStatus); -#endif -static void julian_handle_moredetail(JulianForm *jf); -static void julian_send_response(JulianString& subject, JulianPtrArray& recipients, JulianString& LoginName, JulianForm& jf, NSCalendar& calendar); -static void julian_send_response_with_events(JulianString& subject, JulianPtrArray& recipients, JulianString& LoginName, JulianForm& jf, NSCalendar& calendar, JulianPtrArray * events); -static void julian_add_new_event_to_send(JulianPtrArray * vvEventsToSend, TimeBasedEvent * eventToSend); -static XP_Bool julian_events_comments_and_attendees_match(TimeBasedEvent * a, TimeBasedEvent * b); -static void julian_fill_in_delegatedToVector(char * deltonames, JulianPtrArray * vDelegatedToFillIn); - -static void Julian_ClearLoginInfo(); -static int Julian_GetLoginInfo(JulianForm& jf, MWContext* context, char** url, char** password); - -#define julian_pref_name "calendar.login_url" - -XP_Bool JulianForm::ms_bFoundNLSDataDirectory = FALSE; - -JulianForm *jform_CreateNewForm(char *calendar_mime_data, pJulian_Form_Callback_Struct callbacks, - XP_Bool bFoundNLSDataDirectory) -{ - JulianForm *jf = new JulianForm(); - - if (jf) - { - jf->refcount = 1; - jf->setMimeData(calendar_mime_data); - jf->setCallbacks(callbacks); - JulianForm::setFoundNLSDataDirectory(bFoundNLSDataDirectory); - } - return jf; -} - -void jform_DeleteForm(JulianForm *jf) -{ - if (jf) - { - jf->refcount--; - if (jf->refcount == 0) - { - delete jf; - } - } -} - -char* jform_GetForm(JulianForm *jf) -{ - jf->StartHTML(); - return jf->getHTMLForm(FALSE); -} - -void jform_CallBack(JulianForm *jf, char *type) -{ - char* button_type; - char* button_type2; - char* button_data; - form_data_combo fdc; - int32 x; - - PR_EnterMonitor(jf->my_monitor); - /* - ** type contains the html form string for this. - ** The gernal format is ? type = label or name = data - ** The last thing in this list is the button that started - ** this. - */ - button_type = XP_STRCHR(type, '?'); - button_type++; // Skip ?. Now points to type - - while (TRUE) - { - button_type2 = XP_STRCHR(button_type, '='); - if (button_type2) - { - *button_type2++ = '\0'; - button_data = button_type2; // Points to data part - button_type2 = XP_STRCHR(button_type2, '&'); - } else { - button_data = nil; - button_type2 = nil; - } - if (button_type2) - { - *button_type2++ = '\0'; - } - fdc.type = button_type; - fdc.data = button_data; - jf->formData[jf->formDataCount] = fdc; - jf->formDataCount++; - if (!button_type2 || (jf->formDataCount > formDataIndex)) - break; - else - button_type = button_type2; - - } - - for (x=0; x < jf->formDataCount; x++) - { - button_type = jf->formData[x].type; - jf->setLabel( button_data = jf->formData[x].data ); - - if (!JulianFormFactory::Buttons_Details_Type.CompareTo(button_type)) - { - julian_handle_moredetail(jf); - } else - if (!JulianFormFactory::Buttons_Accept_Type.CompareTo(button_type)) - { - julian_handle_accept(jf, Attendee::STATUS_ACCEPTED); - } else - if (!JulianFormFactory::Buttons_Add_Type.CompareTo(button_type)) - { - julian_handle_accept(jf, Attendee::STATUS_ACCEPTED); - } else - if (!JulianFormFactory::Buttons_Close_Type.CompareTo(button_type)) - { - julian_handle_close(jf); - } else - if (!JulianFormFactory::Buttons_Decline_Type.CompareTo(button_type)) - { - julian_handle_accept(jf, Attendee::STATUS_DECLINED); - } else - if (!JulianFormFactory::Buttons_Tentative_Type.CompareTo(button_type)) - { - julian_handle_accept(jf, Attendee::STATUS_TENTATIVE); - } else - if (!JulianFormFactory::Buttons_SendFB_Type.CompareTo(button_type)) - { - } else - if (!JulianFormFactory::Buttons_SendRefresh_Type.CompareTo(button_type)) - { - } else - if (!JulianFormFactory::Buttons_DelTo_Type.CompareTo(button_type)) - { - julian_handle_accept(jf, Attendee::STATUS_DELEGATED); - } - } - - PR_ExitMonitor(jf->my_monitor); -} - -/** -*** JulianForm Class -*** -*** This is the c++ interface to JulianFormFactory -*** -**/ - -JulianForm::JulianForm() -{ - mimedata = nil; - imipCal = nil; - jff = nil; - contextName = "Julian:More Details"; - formDataCount = 0; - my_monitor = PR_NewMonitor(); -} - -JulianForm::~JulianForm() -{ - if (FALSE && imipCal) - { - if (imipCal->getLog()) - delete imipCal->getLog(); - delete imipCal; - imipCal = nil; - } - - if (jff) - { - delete jff; - } - - if (my_monitor) PR_DestroyMonitor(my_monitor); -} - -XP_Bool -JulianForm::StartHTML() -{ - JulianString u; - UnicodeString ust; - if (imipCal == NULL) - { - ICalReader *tfr = (ICalReader *) new ICalStringReader(mimedata); - mimedata = nil; - if (tfr) - { - JLog * log = new JLog(); - if (!ms_bFoundNLSDataDirectory) - { - if (log != 0) - { - // TODO: finish - //log->log("ERROR: Can't find REQUIRED NLS Data Directory\n"); - } - } - imipCal = new NSCalendar(log); - ust = u.GetBuffer(); - if (imipCal) imipCal->parse(tfr, ust); - delete tfr; - } - - return TRUE; - } - - return FALSE; -} - -char* -JulianForm::getHTMLForm(XP_Bool Want_Detail, NET_StreamClass *this_stream) -{ - if (imipCal != nil) - { - if ((jff = new JulianFormFactory(*imipCal, *this, getCallbacks())) != nil) - { - htmlForm = ""; // Empty it - - jff->init(); - jff->getHTML(&htmlForm, this_stream, Want_Detail); - } - } - - char* t2 = (char*) XP_ALLOC(htmlForm.GetStrlen() + 1); - if (t2) strcpy(t2, htmlForm.GetBuffer()); - return t2; -} - -void -JulianForm::setMimeData(char *NewMimeData) -{ - if (NewMimeData) - { - mimedata = NewMimeData; - } -} - -char* -JulianForm::getComment() -{ - for (int32 x=0; x < formDataCount; x++) - { - if (!JulianFormFactory::CommentsFieldName.CompareTo(formData[x].type)) - { - (*getCallbacks()->PlusToSpace)(formData[x].data); - (*getCallbacks()->UnEscape) (formData[x].data); - return formData[x].data; - } - } - - return nil; -} - -char* -JulianForm::getDelTo() -{ - for (int32 x=0; x < formDataCount; x++) - { - char* temp; - - temp = PR_smprintf( "%s", formData[x].type); // Where is a pr_strcpy?? - if (temp) - { - (*getCallbacks()->PlusToSpace)(temp); - if (!XP_STRCMP(jff->Buttons_DelTo_Label.GetBuffer(), temp)) - { - (*getCallbacks()->PlusToSpace)(formData[x].data); - (*getCallbacks()->UnEscape) (formData[x].data); - return formData[x].data; - } - PR_DELETE(temp); - } - } - - return nil; -} - -void -julian_handle_close(JulianForm *jf) -{ - MWContext* cx = nil; - - if ((cx = jf->getContext()) != nil) - { - (*jf->getCallbacks()->DestroyWindow)(cx); - } -} - -void -julian_handle_moredetail(JulianForm *jf) -{ - MWContext* cx = nil; - char* newhtml = NULL; - NET_StreamClass* stream = nil; - URL_Struct* url = nil; - - if (jf->getCallbacks() == nil || - jf->getCallbacks()->CreateURLStruct == nil) - return; - - url = (*jf->getCallbacks()->CreateURLStruct)("internal_url://", NET_RESIZE_RELOAD); - if (url) - { - url->internal_url = TRUE; - (*jf->getCallbacks()->SACopy)(&(url->content_type), TEXT_HTML); - - // Look to see if we already made a window for this - if ((cx = jf->getContext()) != nil) - { - (*jf->getCallbacks()->RaiseWindow)(cx); - } - - // - // If the more details window isn't there, - // make one - // - if (!cx) - { - Chrome* customChrome = XP_NEW_ZAP(Chrome); - - /* make the window */ - if (customChrome) - { - customChrome->show_scrollbar = TRUE; /* TRUE to show scrollbars on window */ - customChrome->allow_resize = TRUE; /* TRUE to allow resize of windows */ - customChrome->allow_close = TRUE; /* TRUE to allow window to be closed */ - customChrome->disable_commands = TRUE; /* TRUE if user has set hot-keys / menus off */ - customChrome->restricted_target = TRUE; /* TRUE if window is off-limits for opening links into */ - } - - cx = (*jf->getCallbacks()->MakeNewWindow)((*jf->getCallbacks()->FindSomeContext)(), nil, jf->contextName, customChrome); - } - - if (cx) - { - static PA_InitData data; - - /* make a netlib stream to display in the window */ - data.output_func = jf->getCallbacks()->ProcessTag; - stream = (*jf->getCallbacks()->BeginParseMDL)(FO_CACHE_AND_VIEW_SOURCE | FO_CACHE_AND_PRESENT_INLINE, &data, url, cx); - if (stream) - { - jf->StartHTML(); - jf->getHTMLForm(TRUE, stream); - (*stream->complete) (stream->data_object); - XP_FREE(stream); - } - } - } -} - -void -julian_send_response_with_events(JulianString& subject, JulianPtrArray& recipients, JulianString& LoginName, JulianForm& jf, NSCalendar& calendar, JulianPtrArray * events) -{ - TransactionObject::ETxnErrorCode txnStatus; - TransactionObject* txnObj; - JulianPtrArray* capiModifiers = 0; - - if (jf.getCallbacks() == nil || - jf.getCallbacks()->FindSomeContext == nil) - return; - - MWContext* this_context = (*jf.getCallbacks()->FindSomeContext)(); - - capiModifiers = new JulianPtrArray(); - - if (capiModifiers) - { - UnicodeString usMeUri = LoginName.GetBuffer(); - URI meUri(usMeUri); - User* uFrom = new User(usMeUri, meUri.getName()); - char *capurl = NULL, *passwd = NULL; - UnicodeString uSubject; - UnicodeString uLoginName; - XP_Bool do_capi_login = FALSE; /* Default is not to ask for capi login info */ - - if (jf.getCallbacks()->BoolPref) - (*jf.getCallbacks()->BoolPref)("calendar.capi.enabled", &do_capi_login); - - if (do_capi_login && - Julian_GetLoginInfo(jf, this_context, &capurl, &passwd) > 0) - { - char* calUser = ""; - char* calHost = ""; - char* calNode = "10000"; - char* temp; - - // Skip pass "capi://", if it is there - if (XP_STRSTR(capurl, "://")) - { - capurl = XP_STRSTR(capurl, "://"); - capurl += 3; - } - - // Break apart the user and host:node parts - temp = XP_STRSTR(capurl, "/"); - if (temp) - { - calUser = temp; - *(calUser) = '\0'; - calUser++; - calHost = capurl; - } - - // Break apart the host and node parts - temp = XP_STRSTR(calHost, ":"); - if (temp) - { - calNode = temp; - *(calNode++) = '\0'; - } - - // Currently the URL login form is as follows: - // capi://host:node/login - // i.e. - // capi://calendar-1.mcom.com:10000/John Sun - // TODO: this may change. - - uFrom->setRealName(calUser); - uFrom->setCAPIInfo(calUser, passwd, calHost, calNode); - if (0) - { - if (passwd) XP_FREE(passwd); - if (capurl) XP_FREE(capurl); - } - } - - uSubject = subject.GetBuffer(); - uLoginName = LoginName.GetBuffer(); - - txnObj = TransactionObjectFactory::Make(calendar, *(events), - *uFrom, recipients, uSubject, *capiModifiers, - &jf, this_context, uLoginName); - if (txnObj != 0) - { - txnObj->execute(0, txnStatus); - delete txnObj; txnObj = 0; - } - - if (uFrom) delete uFrom; - - delete capiModifiers; - } - - // If more details windows, then close it - // Only if there were no problems - if (txnStatus == TransactionObject::TR_OK) - { - if (jf.getContext()) - { - julian_handle_close(&jf); - } - } -} - -void -julian_send_response(JulianString& subject, JulianPtrArray& recipients, JulianString& LoginName, JulianForm& jf, NSCalendar& calendar) -{ - julian_send_response_with_events(subject, recipients, LoginName, jf, calendar, calendar.getEvents()); -} - -void -julian_fill_in_delegatedToVector(char * deltonames, - JulianPtrArray * vDelegatedToFillIn) -{ - if (0 != vDelegatedToFillIn) - { - UnicodeString mailto = "MAILTO:"; - UnicodeString del_name; - char * nextname; - while (*deltonames) - { - del_name = mailto; - nextname = deltonames; - - while (nextname && *nextname && *nextname != ' ') - { - nextname++; - } - - if (*nextname) - { - *nextname = '\0'; - nextname++; - } - - del_name += deltonames; - vDelegatedToFillIn->Add(new UnicodeString(del_name)); - - if (!(*nextname)) - { - // Last one - break; - } - else - { - deltonames = nextname; - } - } - } -} - -XP_Bool -julian_events_comments_and_attendees_match(TimeBasedEvent * a, TimeBasedEvent * b) -{ - if (a != 0 && b != 0) - { - // comments must match and attendees must match - if (a->getComment() != 0 && b->getComment() == 0) - return FALSE; - if (a->getComment() == 0 && b->getComment() != 0) - return FALSE; - if (a->getComment() != 0 && b->getComment() != 0) - { - if (a->getComment()->GetSize() != b->getComment()->GetSize()) - return FALSE; - // only compare 1st comment in vector - if (a->getComment()->GetSize() > 0 && b->getComment()->GetSize() > 0) - { - ICalProperty * iua = 0; - ICalProperty * iub = 0; - UnicodeString ua, ub; - iua = (ICalProperty *) a->getComment()->GetAt(0); - iub = (ICalProperty *) b->getComment()->GetAt(0); - ua = *((UnicodeString *) iua->getValue()); - ub = *((UnicodeString *) iub->getValue()); - if (ua != ub) - return FALSE; - } - } - - if (a->getAttendees() != 0 && b->getAttendees() == 0) - return FALSE; - if (a->getAttendees() == 0 && b->getAttendees() != 0) - return FALSE; - if (a->getAttendees() != 0 && b->getAttendees() != 0) - { - if (a->getAttendees()->GetSize() != b->getAttendees()->GetSize()) - return FALSE; - t_int32 i; - Attendee * attA = 0; - Attendee * attB = 0; - for (i = 0; i < a->getAttendees()->GetSize(); i++) - { - attA = (Attendee *) a->getAttendees()->GetAt(i); - attB = (Attendee *) b->getAttendees()->GetAt(i); - if (attA->getName() != attB->getName()) - return FALSE; - if (attA->getStatus() != attB->getStatus()) - return FALSE; - } - } - return TRUE; - } - return FALSE; -} - -void -julian_add_new_event_to_send(JulianPtrArray * vvEventsToSend, TimeBasedEvent * eventToSend) -{ - - if (vvEventsToSend != 0) - { - XP_Bool bFound = FALSE; - int32 i; - JulianPtrArray * vEventsToSend = 0; - TimeBasedEvent * event; - for (i = 0; i < vvEventsToSend->GetSize(); i++) - { - vEventsToSend = (JulianPtrArray *) vvEventsToSend->GetAt(i); - if (vEventsToSend != 0 && vEventsToSend->GetSize() > 0) - { - event = (TimeBasedEvent *) vEventsToSend->GetAt(0); - if (julian_events_comments_and_attendees_match(event, eventToSend)) - { - vEventsToSend->Add(eventToSend); - bFound = TRUE; - break; - } - } - } - if (!bFound) - { - JulianPtrArray * evtVctrToAdd = new JulianPtrArray(); - if (evtVctrToAdd != 0) - { - evtVctrToAdd->Add(eventToSend); - vvEventsToSend->Add(evtVctrToAdd); - } - } - } -} - -void -#ifdef OSF1 -julian_handle_accept(JulianForm *jf, int newStatus) -#else -julian_handle_accept(JulianForm *jf, Attendee::STATUS newStatus) -#endif -{ - NSCalendar* imipCal = jf->getCalendar(); - ICalComponent* component; - JulianString orgName; - char* name = nil; - JulianString nameU; - JulianString subject = JulianString(jf->getLabel()); - UnicodeString uTemp; - int32 i; - int32 j; - int32 k; - - // this should be set to the logged in user - // TODO: make it efficient - // TRY to minimize number of calls to julian_send_response_with_events. - - if (jf->getCallbacks()->CopyCharPref) - (*jf->getCallbacks()->CopyCharPref)("mail.identity.useremail", &name); - if (name) - { - nameU = "MAILTO:"; - nameU += name; - } - - if (imipCal->getEvents() != 0) - { - XP_Bool firstTime = TRUE; - // process events to send - UnicodeString uName = nameU.GetBuffer(); - JulianPtrArray * vDelegatedTo = 0; - char * deltonames = 0; - char * cOrgName = 0; - char * cSummary = 0; - - XP_Bool bDontSend = FALSE; - JulianPtrArray * recipients = 0; - TimeBasedEvent * tbe; - // The overall strategy - // Create a vector of vector of events (vvEventsToReply). - // This vector is used to minimize the number of send_response calls (which sends email). - // Events with the same comments and attendees(status and name) are placed in the same bucket. - // Events in the same bucket are send in the same email message. - // Thus I minimize the number of sends response calls. - // - // Foreach event in calendar, - // setAttendeeStatus for this user to newStatus - // setComment from comment text-field - // setDTSTAMP - // if (first event in calendar) set subject to its summary. - // add event to vvEventsToReply - // Foreach vector in vvEventsToReply - // send REPLY message to ORGANIZER - // if (delegated status) - // send DELEGATE-REQUEST message to DELEGATEEs - // - JulianPtrArray * vvEventsToReply = new JulianPtrArray(); - - for (i = 0; i < imipCal->getEvents()->GetSize(); i++) - { - component = (ICalComponent *) imipCal->getEvents()->GetAt(i); - - if (component->GetType() == ICalComponent::ICAL_COMPONENT_VEVENT) - { - tbe = (TimeBasedEvent *) component; - // Set org - if (orgName.GetStrlen() == 0) - { - if (tbe->getOrganizer().size() > 0) - { - cOrgName = (tbe->getOrganizer()).toCString(""); - if (0 != cOrgName) - orgName = cOrgName; - } - } - if (newStatus == Attendee::STATUS_DELEGATED) - { - deltonames = jf->getDelTo(); - if ((0 != deltonames) && (XP_STRLEN(deltonames) > 0)) - { - vDelegatedTo = new JulianPtrArray(); - if (0 != vDelegatedTo) - julian_fill_in_delegatedToVector(deltonames, vDelegatedTo); - } - } - tbe->setAttendeeStatusInt(uName, newStatus, vDelegatedTo); - - if (jf->hasComment()) - { - tbe->setNewComments(jf->getComment()); - } - tbe->stamp(); - - if (i == 0) - { - // only print subject once and use first summary. - subject += JulianFormFactory::SubjectSep; - cSummary = (tbe->getSummary()).toCString(""); - subject += cSummary; - } - - julian_add_new_event_to_send(vvEventsToReply, tbe); - - if (vDelegatedTo != 0) - { - ICalComponent::deleteUnicodeStringVector(vDelegatedTo); - delete vDelegatedTo; vDelegatedTo = 0; - } - } - } - JulianPtrArray * vEventsToReply = 0; - JulianPtrArray * replyRecipients = new JulianPtrArray(); - t_int32 method = imipCal->getMethod(); - - // setup reply recipients to contain only organizer - if (replyRecipients != 0) - { - if (method != NSCalendar::METHOD_PUBLISH) - { - UnicodeString usOrgName = orgName.GetBuffer(); - URI orgUri(usOrgName); - User* uToOrg = new User(usOrgName, orgUri.getName()); - replyRecipients->Add(uToOrg); - } - } - for (i = 0; i < vvEventsToReply->GetSize(); i++) - { - vEventsToReply = (JulianPtrArray *) vvEventsToReply->GetAt(i); - - // send reply - recipients = replyRecipients; - imipCal->setMethod(NSCalendar::METHOD_REPLY); - julian_send_response_with_events(subject, *recipients, nameU, *jf, *imipCal, vEventsToReply); - recipients = 0; - - // send delegate request message if necessary - if (newStatus == Attendee::STATUS_DELEGATED && - method == NSCalendar::METHOD_REQUEST) - { - deltonames = jf->getDelTo(); - if ((0 != deltonames) && (XP_STRLEN(deltonames) > 0)) - { - vDelegatedTo = new JulianPtrArray(); - if (0 != vDelegatedTo) - julian_fill_in_delegatedToVector(deltonames, vDelegatedTo); - else - bDontSend = TRUE; - } - else - { - bDontSend = TRUE; - } - if (!bDontSend) - { - recipients = new JulianPtrArray(); - if (recipients != 0) - { - PR_ASSERT(vDelegatedTo != 0 && vDelegatedTo->GetSize() > 0); - User * userDelegate = 0; - for (j = 0; j < vDelegatedTo->GetSize(); j++) - { - uTemp = *((UnicodeString *) vDelegatedTo->GetAt(j)); - URI delUri(uTemp); - userDelegate = new User(uTemp, delUri.getName()); - for (k = 0; k < vEventsToReply->GetSize(); k++) - { - component = (ICalComponent *) vEventsToReply->GetAt(k); -#ifdef OSF1 - ((TimeBasedEvent *)component)->setAttendeeStatusInt(uTemp, 0); -#else - ((TimeBasedEvent *)component)->setAttendeeStatusInt(uTemp, Attendee::STATUS_NEEDSACTION); -#endif - } - recipients->Add(userDelegate); - } - imipCal->setMethod(NSCalendar::METHOD_REQUEST); - - julian_send_response_with_events(subject, *recipients, nameU, *jf, *imipCal, vEventsToReply); - - User::deleteUserVector(recipients); - delete recipients; recipients = 0; - } - } - if (vDelegatedTo != 0) - { - ICalComponent::deleteUnicodeStringVector(vDelegatedTo); - delete vDelegatedTo; vDelegatedTo = 0; - } - } - } - // delete allocated objects. - if (cOrgName != 0) - { - delete [] cOrgName; cOrgName = 0; - } - if (cSummary != 0) - { - delete [] cSummary; cSummary = 0; - } - if (0 != replyRecipients) - { - User::deleteUserVector(replyRecipients); - delete replyRecipients; replyRecipients = 0; - } - for (i = vvEventsToReply->GetSize() -1; i >= 0; i--) - { - vEventsToReply = (JulianPtrArray *) vvEventsToReply->GetAt(i); - ICalComponent::deleteICalComponentVector(vEventsToReply); - delete vEventsToReply; vEventsToReply = 0; - } - delete vvEventsToReply; vvEventsToReply = 0; - } - if (name) XP_FREE(name); -} - -void -Julian_ClearLoginInfo() -{ -} - -int -Julian_GetLoginInfo(JulianForm& jf, MWContext* context, char** url, char** password) { - static char* lastCalPwd = NULL; - char* defaultUrl; - int status = -2; - - if (jf.getCallbacks() && - jf.getCallbacks()->CopyCharPref) - status = (*jf.getCallbacks()->CopyCharPref)(julian_pref_name, &defaultUrl); - // -1 is pref isn't there, which will be a normal case for us - // Any other neg number is some other bad error so bail. - if (status < -1) return status; - - *url = defaultUrl; - *password = NULL; - - if (lastCalPwd != NULL) - { - *password = XP_STRDUP(lastCalPwd); - if (*password == NULL) return 0 /*MK_OUT_OF_MEMORY*/; - - return 1; - } - - if (!(*context->funcs->PromptUsernameAndPassword) - (context, -// XP_GetString(JULIAN_LOGIN_PROMPT), - "Enter capi url and password", - url, - password)) - { - *url = NULL; - *password = NULL; - status = -1; - } else { - if (jf.getCallbacks() && - jf.getCallbacks()->SetCharPref) - { - (*jf.getCallbacks()->SetCharPref)(julian_pref_name, *url); - } - lastCalPwd = XP_STRDUP(*password); - status = 1; - } - XP_FREE(defaultUrl); - return status; -} - diff --git a/mozilla/calendar/modules/core/htmlform/src/formFactory.cpp b/mozilla/calendar/modules/core/htmlform/src/formFactory.cpp deleted file mode 100644 index 6c26035c51c..00000000000 --- a/mozilla/calendar/modules/core/htmlform/src/formFactory.cpp +++ /dev/null @@ -1,2680 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "jdefines.h" -#include "julnstr.h" -#include "nscal.h" -#include "keyword.h" - -#include "form.h" -#include "formFactory.h" - -#include "gregocal.h" -#include "time.h" -#include "smpdtfmt.h" -#include "simpletz.h" -#include "datetime.h" -#include "jutility.h" - -#ifndef MOZ_TREX -#include "allxpstr.h" -#endif - -JulianFormFactory::JulianFormFactory() -{ - firstCalendar = nil; - thisICalComp = nil; - serverICalComp = nil; - SetDetail(FALSE); - s = nil; - jf = nil; - ServerProxy = nil; - maxical = 0; - cb = nil; - - SlotsPerHour = 0; - displayTimeZone = FALSE; - scaleType = 0; - slotsacross = 0; - hoursToDisplay = 0; - state = Free_State; - new_state = Free_State; - count = 0; - TimeHour_HTML = nil; - default_tz = TimeZone::createDefault(); - p = nil; - fb = nil; - fbIndex = 0; - pIndex = 0; - pv = nil; - fbv = nil; - aref_count = 0; - aref2_count = 0; - outStream = nil; - - isEvent = FALSE; - isFreeBusy = FALSE; -} - -JulianFormFactory::JulianFormFactory(NSCalendar& imipCal, JulianServerProxy* jsp) -{ - firstCalendar = nil; - thisICalComp = nil; - serverICalComp = nil; - SetDetail(FALSE); - s = nil; - jf = nil; - ServerProxy = nil; - maxical = 0; - cb = nil; - - SlotsPerHour = 0; - displayTimeZone = FALSE; - scaleType = 0; - slotsacross = 0; - hoursToDisplay = 0; - state = Free_State; - new_state = Free_State; - count = 0; - TimeHour_HTML = nil; - default_tz = TimeZone::createDefault(); - p = nil; - fb = nil; - fbIndex = 0; - pIndex = 0; - pv = nil; - fbv = nil; - aref_count = 0; - aref2_count = 0; - outStream = nil; - - isEvent = FALSE; - isFreeBusy = FALSE; - - firstCalendar = &imipCal; - ServerProxy = jsp; -} - -JulianFormFactory::JulianFormFactory(NSCalendar& imipCal, JulianForm& hostForm, pJulian_Form_Callback_Struct callbacks) -{ - firstCalendar = nil; - thisICalComp = nil; - serverICalComp = nil; - SetDetail(FALSE); - s = nil; - jf = nil; - ServerProxy = nil; - maxical = 0; - cb = nil; - - SlotsPerHour = 0; - displayTimeZone = FALSE; - scaleType = 0; - slotsacross = 0; - hoursToDisplay = 0; - state = Free_State; - new_state = Free_State; - count = 0; - TimeHour_HTML = nil; - default_tz = TimeZone::createDefault(); - p = nil; - fb = nil; - fbIndex = 0; - pIndex = 0; - pv = nil; - fbv = nil; - aref_count = 0; - aref2_count = 0; - outStream = nil; - - isEvent = FALSE; - isFreeBusy = FALSE; - - firstCalendar = &imipCal; - jf = &hostForm; - cb = callbacks; -} - -JulianFormFactory::~JulianFormFactory() -{ - // if (default_tz) delete default_tz; - PR_FREEIF(TimeHour_HTML); - -#ifdef LIBJULIAN_USE_XPSTRS - if (cb && cb->GetString) - { - PR_FREEIF(error_Header_HTML); - PR_FREEIF(publish_Header_HTML); - PR_FREEIF(publishFB_Header_HTML); - PR_FREEIF(replyFB_Header_HTML); - PR_FREEIF(request_Header_HTML); - PR_FREEIF(request_FB_Header_HTML); - PR_FREEIF(request_D_FB_Header_HTML); - PR_FREEIF(eventreply_Header_HTML); - PR_FREEIF(eventcancel_Header_HTML); - PR_FREEIF(eventrefreshreg_Header_HTML); - PR_FREEIF(eventcounterprop_Header_HTML); - PR_FREEIF(eventdelinecounter_Header_HTML); - - PR_FREEIF(String_What); - PR_FREEIF(String_When); - PR_FREEIF(String_Location); - PR_FREEIF(String_Organizer); - PR_FREEIF(String_Status); - PR_FREEIF(String_Priority); - PR_FREEIF(String_Categories); - PR_FREEIF(String_Resources); - PR_FREEIF(String_Attachments); - PR_FREEIF(String_Alarms); - PR_FREEIF(String_Created); - PR_FREEIF(String_Last_Modified); - PR_FREEIF(String_Sent); - PR_FREEIF(String_UID); - } -#endif -} - - -XP_Bool -JulianFormFactory::getHTML(JulianString* OutString, NET_StreamClass *this_stream, XP_Bool want_detail) -{ - outStream = this_stream; - return getHTML(OutString, want_detail); -} - -/* -** getHTML -** -** Call after setting firstCalendar. It will produce an Unicode -** string with html that should be inserted into a real html file. -** On any errors an empty string is returened. -** -*/ -XP_Bool -JulianFormFactory::getHTML(JulianString* htmlstorage, XP_Bool want_detail) -{ -JulianString ny("Not Yet"); -JulianString im("Invalid method"); -int32 icalIndex = 0; // Index into venent or vfreebusy array -int32 icalMaxIndex; -char* temp = nil; -char* urlcallback = nil; - - // Set up the storage for the html - s = htmlstorage; - - // Return an empty string on any error. - // This case: firstCalendar isn't set. It's needed to - // find what vevents, freebusy etc to parse. - if (firstCalendar == nil) return TRUE; - - if(!jf->isFoundNLSDataDirectory()) - { - if (0 != firstCalendar->getLog()) - { - // TODO: need to move errorID and comment to XP-Resources - t_int32 errorID; - UnicodeString comment; - errorID = 123456789; - comment = "ERROR: Cannot find NLS Data Directory"; - firstCalendar->getLog()->logError(errorID, comment); - } - } - - JulianPtrArray * e = firstCalendar->getEvents(); - JulianPtrArray * f = firstCalendar->getVFreebusy(); - - // Look for only for one type of ICalComponent. - // Start with vEvents and work down from there. - // There is a bool for each ICalComponent class - // that is handled. - // If there isn't anything good here, set thisICalComp - // to nil. - if (e) - { - if ((maxical = icalMaxIndex = e->GetSize() - 1) >= 0) - isEvent = TRUE; - } else - if (f) - { - if ((maxical = icalMaxIndex = f->GetSize() - 1) >= 0) - isFreeBusy = TRUE; - } else - { - icalMaxIndex = 0; - thisICalComp = nil; - } - - SetDetail(want_detail); - - /* - ** To get callback to work - */ - if (cb && cb->callbackurl) - { - urlcallback = (*cb->callbackurl)((NET_CallbackURLFunc) (want_detail ? jf_detail_callback : jf_callback), (void *)jf); - jf->refcount++; - temp = PR_smprintf(Start_HTML, urlcallback); - } else - temp = Start_HTML; - doAddHTML(temp); - if (cb && cb->callbackurl && temp) - { - // delete temp; - PR_DELETE(temp); - } - - // In the case that the ical was so bad that there isn't any thing left - if (!isEvent && !isFreeBusy) - { - HandleError(); - doAddHTML( End_HTML ); - return TRUE; - } - - if (icalMaxIndex > 0) - { - doHeaderMuiltStart(); - } - - int32 loopcount = icalMaxIndex > 0 && detail ? 2 : 1; - for (int32 loopx = 0; loopx < loopcount; loopx++) - { - int32 ICAL_LoopCount = MIN(icalMaxIndex, jff_clip_events); - icalIndex = 0; - - while (icalIndex <= ICAL_LoopCount) - { - // thisICalComp needs to be set to something. It's a problem if it's nil. - if (isEvent) - { - thisICalComp = (VEvent *)e->GetAt(icalIndex++); - } else - if (isFreeBusy) - { - thisICalComp = (VFreebusy *)f->GetAt(icalIndex++); - } else - icalIndex++; - - // If in detail mode, check to see if there is a server version of this icalcomponent. - // Otherwise set it to nil to show that this is the first time this has been seen. - if (detail && ServerProxy) - { - serverICalComp = ServerProxy->getByUid(nil); - } else { - serverICalComp = nil; - } - - if (icalMaxIndex > 0 && loopx == 0) - { - doHeaderMuilt(); - } - - // Find the right html form based on the method - if ((icalMaxIndex > 0 && loopx == 1) || icalMaxIndex == 0) - switch (firstCalendar->getMethod()) - { - case NSCalendar::METHOD_PUBLISH: - if (isEvent) - { - HandlePublishVEvent(); - } - - if (isFreeBusy) - { - HandlePublishVFreeBusy(TRUE); - } - break; - - case NSCalendar::METHOD_REQUEST: - case NSCalendar::METHOD_ADD: - - if (isEvent) - { - HandleRequestVEvent(); - } - - if (isFreeBusy) - { - HandleRequestVFreeBusy(); - } - break; - - case NSCalendar::METHOD_REPLY: - - if (isEvent) - { - HandleEventReplyVEvent(); - } - - if (isFreeBusy) - { - HandlePublishVFreeBusy(FALSE); - } - - break; - - case NSCalendar::METHOD_CANCEL: - - if (isEvent) - { - HandleEventCancelVEvent(); - } - - break; - - case NSCalendar::METHOD_REFRESH: - - if (isEvent) - { - HandleEventRefreshRequestVEvent(); - } - - if (isFreeBusy) - { - doAddHTML ( ny ); - } - break; - - case NSCalendar::METHOD_COUNTER: - - if (isEvent) - { - HandleEventCounterPropVEvent(); - } - break; - - case NSCalendar::METHOD_DECLINECOUNTER: - - if (isEvent) - { - HandleDeclineCounterVEvent(); - } - break; - - case NSCalendar::METHOD_INVALID: - default: - doAddHTML ( im ); - break; - } - } - - if (icalMaxIndex > 1) - { - doHeaderMuiltEnd(); - doAddGroupButton(doCreateButton(Buttons_Accept_Type, Buttons_Accept_Label)); - if (!detail) - { - doAddGroupButton(doCreateButton(Buttons_Details_Type, Buttons_Details_Label)); - } - } - } - - doAddHTML( End_HTML ); - flush_stream(); - - return TRUE; -} - -int32 -JulianFormFactory::flush_stream() -{ - int32 ret = 0; - - if (outStream && (s->GetStrlen() > 0)) - { - ret = (*(outStream)->put_block)(outStream->data_object, s->GetBuffer(), s->GetStrlen()); - *s = ""; // empty it. - } - - return ret; -} - -void -JulianFormFactory::doHeaderMuiltStart() -{ - char* m1 = nil; - - if (MuiltEvent.GetStrlen() > 0) - { - JulianString tempstring; - - doHeader(MuiltEvent_Header_HTML); - - doAddHTML( nbsp ); - - // Get This messages contains 2 events - m1 = PR_smprintf(MuiltEvent.GetBuffer(), maxical + 1); - - doAddHTML( m1 ); - PR_FREEIF( m1 ); - - if (maxical + 1 > jff_clip_events) - { - m1 = PR_smprintf(TooManyEvents.GetBuffer(), jff_clip_events); - if (m1) - { - doAddHTML( Line_Break_HTML ); - doAddHTML( nbsp ); - doAddHTML( m1 ); - PR_DELETE( m1 ); - } - } - - doAddHTML( Line_3_HTML ); - - doAddHTML( Props_Head_HTML ); - - doAddHTML( FBT_NewRow_HTML ); - doAddHTML( Cell_Start_HTML ); - doAddHTML(*doFont(*doItalic(*doBold(WhenStr , &tempstring ) , &tempstring ) , &tempstring) ); - doAddHTML( Cell_End_HTML ); - - doAddHTML( Cell_Start_HTML ); - doFont(*doItalic(*doBold(WhatStr , &tempstring ) , &tempstring ) , &tempstring ); - doAddHTML( nbsp ); - doAddHTML(tempstring); - doAddHTML( Cell_End_HTML ); - doAddHTML( FBT_EndRow_HTML ); - - } -} - -void -JulianFormFactory::doHeaderMuiltEnd() -{ - doAddHTML( FBT_End_HTML ); -} - - -/* -** Muilable icalcomponents. -*/ -void -JulianFormFactory::doHeaderMuilt() -{ - JulianString tempstring; - char* dtstart_string = "%B"; - char* summary_string = "%S"; - char a_temp[256] = ""; - char a_end_temp[256] = ""; - char* temp; - UnicodeString u; - - doAddHTML( FBT_NewRow_HTML ); - - doAddHTML( Cell_Start_HTML ); - - doAddHTML( Font_Fixed_Start_HTML ); - doPreProcessing(dtstart_string); - doAddHTML( Font_Fixed_End_HTML ); - - doAddHTML( Cell_End_HTML ); - - doAddHTML( Cell_Start_HTML ); - doAddHTML( Start_BIG_Font ); - - if (detail) - { - temp = PR_smprintf(a_temp, aref2_count++); - doAddHTML(temp); - PR_FREEIF(temp); - } - u = summary_string; - uTemp = temp = thisICalComp->toStringFmt(u).toCString(""); - PR_FREEIF(temp); - doAddHTML(uTemp); - if (detail) - { - doAddHTML(a_end_temp); - } - - doAddHTML( End_Font ); - - doAddHTML( Cell_End_HTML ); - - doAddHTML( FBT_EndRow_HTML ); -} - -/* -** Cool "When:" formating. -*/ -void -JulianFormFactory::doPreProcessing(char* icalpropstr) -{ -t_int32 ICalPropChar = (t_int32)(icalpropstr[(TextOffset)1]); - - if (ICalPropChar == ms_cDTStart) - { - DateTime start, end; - XP_Bool allday = isEvent ? (XP_Bool)((TimeBasedEvent *)thisICalComp)->isAllDayEvent() : FALSE; - JulianString temp_js; - - if (isEvent) - { - start = ((VEvent *)thisICalComp)->getDTStart(); - end = ((VEvent *)thisICalComp)->getDTEnd(); - } else - if (isFreeBusy) - { - start = ((VFreebusy *)thisICalComp)->getDTStart(); - end = ((VFreebusy *)thisICalComp)->getDTEnd(); - } - - temp_js = JulianString(icalpropstr); - doPreProcessingDateTime(temp_js, allday, start, end, *thisICalComp); - } else - if (ICalPropChar == ms_cAttendees) - { - doPreProcessingAttend(*thisICalComp); - } else - if ( ICalPropChar == ms_cOrganizer) - { - doPreProcessingOrganizer(*thisICalComp); - } -} - -void -JulianFormFactory::doPreProcessingAttend(ICalComponent& ic) -{ -XP_Bool lastOne = FALSE; -char* temp; -char* uni_comma = ","; -char* uni_AttendName = "%(^N)v"; -char* attendStatusStr = "%(^S)v"; -UnicodeString usAttendStatusStr = attendStatusStr; -UnicodeString usUni_AttendName = uni_AttendName; -char* attendStatus = (ic.toStringFmt(usAttendStatusStr)).toCString(""); -char* attendNames = (ic.toStringFmt(usUni_AttendName)).toCString(""); -UnicodeString usAttendStatus = attendStatus; -UnicodeString usAttendNames = attendNames; - -UnicodeString tempString; -JulianString tempString2; -JulianString tempString3; -JulianString tempStringA; -JulianString tempStringB; -UnicodeString tempString4; -TextOffset status_start = 0, - status_end = 0, - name_start = 0, - name_end = 0; - - // Check that there is something in the attendNames string. - - if (XP_STRLEN(attendNames) == 0) - { - // Should not get here, but just in case don't loop - lastOne = TRUE; - } - - while (!lastOne) - { - status_end = JulianString(attendStatus).IndexOf(uni_comma, (int32)status_start); - name_end = JulianString(attendNames).IndexOf(uni_comma, (int32)name_start); - - // Hit the last name yet? - if (status_end == -1) - { - lastOne = TRUE; - status_end = XP_STRLEN(attendStatus); - name_end = XP_STRLEN(attendNames); - } - - // Add a comma after each name execpt for the last name. - if (status_start > 0) - { - doAddHTML( uni_comma ); - doAddHTML( nbsp ); - } - - usAttendStatus.extractBetween(status_start, status_end, tempString); - if (tempString == nsCalKeyword::Instance()->ms_sACCEPTED ) - { - doAddHTML( Accepted_Gif_HTML ); - } else - if (tempString == nsCalKeyword::Instance()->ms_sDECLINED ) - { - doAddHTML( Declined_Gif_HTML ); - } else - if (tempString == nsCalKeyword::Instance()->ms_sDELEGATED ) - { - doAddHTML( Delegated_Gif_HTML ); - } else - if (tempString == nsCalKeyword::Instance()->ms_sVCALNEEDSACTION ) - { - doAddHTML( NeedsAction_Gif_HTML ); - } else - doAddHTML( Question_Gif_HTML ); - - // Get the email address mailto:xxx@yyy.com - // Convert to xxx@yyy.com  - usAttendNames.extractBetween(name_start, name_end, tempString); - tempString.extractBetween(7, tempString.size(), tempString4); - tempStringA = JulianString(temp = tempString4.toCString("")); - if (temp) delete temp; - tempStringB = JulianString(temp = tempString.toCString("")); - if (temp) delete temp; - doAddHTML( - doARef( - *doFont( tempStringA, &tempString2 ), - tempStringB, - &tempString3 ) - ); - - status_start = status_end + 1; - name_start = name_end + 1; - - // Set it to an empty string - tempString2 = ""; - tempString3 = ""; - } - - if (attendNames) delete attendStatus; - if (attendNames) delete attendNames; -} - -void -JulianFormFactory::doPreProcessingOrganizer(ICalComponent& ic) -{ -char* uni_OrgName = "%(^N)J"; -UnicodeString usUni_OrgName = uni_OrgName; -char* temp = ic.toStringFmt(usUni_OrgName).toCString(""); -JulianString attendNames = temp; -JulianString tempString; -JulianString tempString2; -JulianString tempString3; -JulianString tempString4; -TextOffset name_start = 0, - name_end = 0; - - PR_FREEIF(temp); - name_end = attendNames.GetStrlen(); - - // Get the email address mailto:xxx@yyy.com - // Convert to xxx@yyy.com  - tempString = attendNames(name_start, name_end); - tempString4 = tempString(7, tempString.GetStrlen()); - doAddHTML( - doARef( - *doFont( tempString4, &tempString2 ), - tempString, - &tempString3 ) - ); -} - -JulianString* -JulianFormFactory::doARef(JulianString& refText, JulianString& refTarget, JulianString* outputString) -{ - JulianString *Saved_S = s; - s = outputString; - - doAddHTML( Aref_Start_HTML ); - doAddHTML( refTarget ); - doAddHTML( Aref_End_HTML ); - doAddHTML( refText ); - doAddHTML( ArefTag_End_HTML ); - - s = Saved_S; - - return outputString; -} - - -#if 0 -JulianString* -JulianFormFactory::doFontFixed(JulianString& fontText, JulianString* outputString) -{ - JulianString *Saved_S = s; - JulianString out1; - s = &out1; - - doAddHTML( Font_Fixed_Start_HTML ); - doAddHTML( fontText ); - doAddHTML( Font_Fixed_End_HTML ); - - s = Saved_S; - *outputString = out1; - - return outputString; -} -#endif - -JulianString* -JulianFormFactory::doFont(JulianString& fontText, JulianString* outputString) -{ - JulianString *Saved_S = s; - JulianString out1; - s = &out1; - - doAddHTML( Start_Font ); - doAddHTML( fontText ); - doAddHTML( End_Font ); - - s = Saved_S; - *outputString = out1; - - return outputString; -} - -JulianString* -JulianFormFactory::doItalic(JulianString& ItalicText, JulianString* outputString) -{ - JulianString *Saved_S = s; - JulianString out1; - s = &out1; - - doAddHTML( Italic_Start_HTML ); - doAddHTML( ItalicText ); - doAddHTML( Italic_End_HTML ); - - s = Saved_S; - *outputString = out1; - - return outputString; -} - -JulianString* -JulianFormFactory::doBold(JulianString& BoldText, JulianString* outputString) -{ - JulianString *Saved_S = s; - JulianString out1; - s = &out1; - - doAddHTML( Bold_Start_HTML ); - doAddHTML( BoldText ); - doAddHTML( Bold_End_HTML ); - - s = Saved_S; - *outputString = out1; - - return outputString; -} - -JulianString* -JulianFormFactory::doBold(char* BoldText, JulianString* outputString) -{ - JulianString *Saved_S = s; - JulianString out1; - s = &out1; - - doAddHTML( Bold_Start_HTML ); - doAddHTML( BoldText ); - doAddHTML( Bold_End_HTML ); - - s = Saved_S; - *outputString = out1; - - return outputString; -} - -void -JulianFormFactory::doPreProcessingDateTime(JulianString& icalpropstr, XP_Bool allday, DateTime &start, DateTime &end, ICalComponent &ic) -{ - JulianString dtstartI = "%B"; - UnicodeString dtstart = "%(EEE MMM dd, yyyy hh:mm a)B"; - UnicodeString dtend = "%(EEE MMM dd, yyyy hh:mm a z)e"; - - UnicodeString dtstartSD = "%(EEE MMM dd, yyyy hh:mm a)B - "; - UnicodeString dtstartAD = "%(EEE MMM dd, yyyy)B - "; - UnicodeString dtstartMD = "%(EEE MMM dd, yyyy hh:mm a z)B"; - UnicodeString dtendSD = "%(hh:mm a z)e"; - UnicodeString dtdurSD = " ( %D )"; - UnicodeString endstr = ic.toStringFmt(dtend); - UnicodeString uTemp; - - // All Day event. May spane more then the one day - // Display as May 01, 1997 ( Day Event ) - // Note: fix this up for a single day event and for more then one day event - if (allday) - { - uTemp = ic.toStringFmt(dtstartAD); - doAddHTML(uTemp); - - doAddHTML( Text_AllDay ); - } else - // Moment in time date, ie dtstart == dtend? - // Display as Begins on May 01, 1997 12:00 pm - if (start == end) - { - doAddHTML( Text_StartOn ); - - uTemp = ic.toStringFmt(dtstartMD); - doAddHTML(uTemp); - doAddHTML(nbsp); - - } else - // Both dates on the same day? - // Display as May 01, 1997 12:00 pm - 3:00 pm ( 3 Hours ) - if (start.sameDMY(&end, default_tz)) - { - uTemp = ic.toStringFmt(dtstartSD); - doAddHTML(uTemp); - - uTemp = ic.toStringFmt(dtendSD); - doAddHTML(uTemp); - - uTemp = ic.toStringFmt(dtdurSD); - doAddHTML(uTemp); - } - - // Default Case. - // Display both dates in full. ie May 01, 1997 12:00 pm - May 02, 1997 2:00 pm - else - if (icalpropstr.IndexOf(dtstartI.GetBuffer(), (int32)0) >= 0) - { - - uTemp = ic.toStringFmt(dtstart); - doAddHTML(uTemp); - - if (endstr.size() > 6) - { - doAddHTML( Text_To ); - doAddHTML( endstr ); - } - } -} - -/* -** -** Assumed that serverICalComp is good. -*/ -void -JulianFormFactory::doDifferenceProcessingAttendees() -{ -XP_Bool lastOne = FALSE, - need_comma = FALSE; -JulianString uni_comma = ","; -char* uni_x = "%(^N)v"; -UnicodeString usUni_x = uni_x; -char* temp; -char* temp1; -JulianString NewAttendNames = temp = thisICalComp->toStringFmt(usUni_x).toCString(""); -JulianString OldAttendNames = temp1 = serverICalComp->toStringFmt(usUni_x).toCString(""); -JulianString tempString; -JulianString tempString2; -JulianString tempString3; -JulianString tempString4; -TextOffset new_name_start = 0, - new_name_end = 0, - old_name_start = 0, - old_name_end = 0; - -// Work and the "Added" section. These are email address that are in thisICalComp and -// not in serverICalComp. The general idea here is to march down the attends in NewAttendNames -// and see if they are in OldAttendNames - - doAddHTML( Props_HTML_Before_Label ); - doAddHTML( Start_Font ); - doAddHTML( Italic_Start_HTML ); - doAddHTML( " Added: " ); - doAddHTML( Italic_End_HTML ); - doAddHTML( End_Font ); - doAddHTML( Props_HTML_After_Label ); - - while (!lastOne) - { - new_name_end = NewAttendNames.IndexOf(uni_comma.GetBuffer(), (int32)new_name_start); - - // Hit the last name yet? - if (new_name_end == -1) - { - lastOne = TRUE; - new_name_end = NewAttendNames.GetStrlen(); - } - - // Add a comma after each name execpt for the last name. - if (need_comma) - { - doAddHTML( uni_comma ); - doAddHTML( nbsp ); - need_comma = FALSE; - } - - // Get the email address mailto:xxx@yyy.com - // Convert to xxx@yyy.com  - tempString = NewAttendNames(new_name_start, new_name_end); // Get "mailto:xxx@yyy.com" - tempString4 = tempString(7, tempString.GetStrlen()); // Remove "mailto:" - - // tempString4 now holds "xxx@yyy.com". See if it is in OldAttendNames - if (OldAttendNames.IndexOf(tempString4.GetBuffer(), (int32)0) == -1) - { - // Not there so this must be a new one. Format it for output - doAddHTML( doARef( *doFont( tempString4, &tempString2 ), tempString, &tempString3 ) ); - need_comma = TRUE; - } - - new_name_start = new_name_end + 1; - - // Set it to an empty string - tempString2 = ""; - tempString3 = ""; - tempString4 = ""; - } - doAddHTML( Props_HTML_After_Data ); - -// Work and the "Removed" section. These are email address that are in thisICalComp and -// not in serverICalComp. The general idea here is to march down the attends in NewAttendNames -// and see if they are in OldAttendNames - - doAddHTML( Props_HTML_Before_Label ); - doAddHTML( Start_Font ); - doAddHTML( Italic_Start_HTML ); - doAddHTML( " Removed: " ); - doAddHTML( Italic_End_HTML ); - doAddHTML( End_Font ); - doAddHTML( Props_HTML_After_Label ); - - need_comma = lastOne = FALSE; - new_name_start = 0; - while (!lastOne) - { - new_name_end = OldAttendNames.IndexOf(uni_comma.GetBuffer(), (int32)new_name_start); - - // Hit the last name yet? - if (new_name_end == -1) - { - lastOne = TRUE; - new_name_end = OldAttendNames.GetStrlen(); - } - - // Add a comma after each name execpt for the last name. - if (need_comma) - { - doAddHTML( uni_comma ); - doAddHTML( nbsp ); - need_comma = FALSE; - } - - // Get the email address mailto:xxx@yyy.com - // Convert to xxx@yyy.com  - tempString = OldAttendNames(new_name_start, new_name_end); // Get "mailto:xxx@yyy.com" - tempString4 = tempString(7, tempString.GetStrlen()); // Remove "mailto:" - - // tempString4 now holds "xxx@yyy.com". See if it is in OldAttendNames - if (NewAttendNames.IndexOf(tempString4.GetBuffer(), (int32)0) == -1) - { - // Not there so this must be a removed one. Format it for output - doAddHTML( doARef( *doFont( tempString4, &tempString2 ), tempString, &tempString3 ) ); - } - - new_name_start = new_name_end + 1; - - // Set it to an empty string - tempString2 = ""; - tempString3 = ""; - tempString4 = ""; - } - doAddHTML( Props_HTML_After_Data ); - - PR_FREEIF(temp); - PR_FREEIF(temp1); -} - -/* -** Cool diff formating. -*/ -void -JulianFormFactory::doDifferenceProcessing(JulianString icalpropstr) -{ - // First look to see if there is a server version of this. - // Also diff is only useful for events. - if (isEvent && serverICalComp) - { - JulianString itipstr; - JulianString serverstr; - - if (isPreProcessed(icalpropstr)) - { - t_int32 ICalPropChar = (t_int32)((icalpropstr.GetBuffer())[(TextOffset)1]); - - // Attendees are different. Look at each one and see who has been add or deleted. - // Right now do not show anything if just their role has changed. - if (ICalPropChar == ms_cAttendees) - { - doDifferenceProcessingAttendees(); - } else - // Normal case is just diff the string that would be printed. - { - JulianString* Saved_S = s; - ICalComponent* IC_Saved = thisICalComp; - - s = &itipstr; - // Set itipstr to the formated version - doPreProcessing(icalpropstr.GetBuffer()); - - s = &serverstr; - thisICalComp = serverICalComp; - // Set serverstr to the formated version - doPreProcessing(icalpropstr.GetBuffer()); - thisICalComp = IC_Saved; - - s = Saved_S; - } - } else { - char* temp; - UnicodeString usIcalPropStr = icalpropstr.GetBuffer(); - itipstr = JulianString(temp = (thisICalComp->toStringFmt(usIcalPropStr)).toCString("")); - PR_FREEIF(temp); - serverstr = JulianString(temp = (serverICalComp->toStringFmt(usIcalPropStr)).toCString("")); - PR_FREEIF(temp); - } - - if (itipstr != serverstr) - { - doAddHTML( Props_HTML_Before_Label ); - doAddHTML( Start_Font ); - doAddHTML( Italic_Start_HTML ); - doAddHTML( Text_Was ); - doAddHTML( Italic_End_HTML ); - doAddHTML( End_Font ); - - doAddHTML( Props_HTML_After_Label ); - - doAddHTML( Start_Font ); - doAddHTML( Italic_Start_HTML ); - doAddHTML( serverstr ); - doAddHTML( Italic_End_HTML ); - doAddHTML( End_Font ); - doAddHTML( Props_HTML_After_Data ); - } - } -} - -void -JulianFormFactory::doProps(int32 labelCount, JulianString labels[], int32 dataCount, JulianString data[]) -{ - int32 x; - UnicodeString uDataX; - JulianString temp_js; - char* temp; - - doAddHTML( Props_Head_HTML ); - - for (x = 0; x < dataCount; x ++) - { - uDataX = data[x].GetBuffer(); - uTemp = JulianString(temp = (thisICalComp->toStringFmt(uDataX)).toCString("")); - PR_FREEIF(temp); - if (uTemp.GetStrlen() > 0 || isPreProcessed(data[x])) - { - doAddHTML( Props_HTML_Before_Label ); - doAddHTML( Start_Font ); - if (x < labelCount) - doAddHTML( labels[x] ); - else - doAddHTML( Props_HTML_Empty_Label ); - doAddHTML( End_Font ); - doAddHTML( Props_HTML_After_Label ); - doAddHTML( Start_Font ); - temp_js = JulianString(data[x]); - isPreProcessed(temp_js) ? doPreProcessing(data[x].GetBuffer()) : doAddHTML(uTemp); - doAddHTML( End_Font ); - doAddHTML( Props_HTML_After_Data ); - doDifferenceProcessing(data[x]); - } - } -} - -void -JulianFormFactory::doHeader(JulianString HeaderText) -{ - doAddHTML( General_Header_Start_HTML ); - doAddHTML( Start_Font ); - doAddHTML( HeaderText ); - doAddHTML( End_Font ); - - if (detail) - { - char* temp; - char a_temp[256] = ""; - char a_end_temp[256] = ""; - - temp = PR_smprintf(a_temp, aref_count++); - doAddHTML(temp); - doAddHTML(a_end_temp); - doAddHTML( General_Header_Status_HTML ); - doAddHTML( Start_Font ); - // Only can handle new or not new - doAddHTML( serverICalComp ? "(Update)" : "(New)" ); - doAddHTML( End_Font ); - PR_FREEIF(temp); - } - - doAddHTML( General_Header_End_HTML ); -} - -void -JulianFormFactory::doClose() -{ - if (isDetail()) - { - doAddHTML( Head2_HTML ); - doAddButton(doCreateButton(Buttons_Close_Type, Buttons_Close_Label)); - } -} - -char* -JulianFormFactory::getJulianErrorString(int32 ErrorNum) -{ - JulianString* errortext = nil; - - if ((t_int32)ErrorNum == nsCalLogErrorMessage::Instance()->ms_iDTEndBeforeDTStart) errortext = &error1; else - if ((t_int32)ErrorNum == nsCalLogErrorMessage::Instance()->ms_iInvalidPromptValue) errortext = &error2; else - if ((t_int32)ErrorNum == nsCalLogErrorMessage::Instance()->ms_iInvalidTimeStringError) errortext = &error3; else - if ((t_int32)ErrorNum == nsCalLogErrorMessage::Instance()->ms_iInvalidRecurrenceError) errortext = &error4; else - if ((t_int32)ErrorNum == nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyValue) errortext = &error5; else - if ((t_int32)ErrorNum == nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyName) errortext = &error6; else - if ((t_int32)ErrorNum == nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName) errortext = &error7; else - errortext = &error0; - - return errortext->GetBuffer(); -} - -void -JulianFormFactory::doStatus() -{ - XP_Bool startSpacer = TRUE; - int32 x = 0; - JulianPtrArray * errors = 0; - char * cjst = 0; - JulianString jst3; - JulianString jst4; - //JulianPtrArray *errorLog = firstCalendar->getLog()->GetErrorVector(); - - // Start with status items that only can happen in detail mode. - // Only suport vevents. - if (isDetail() && isEvent) - { - JulianString temp_js = JulianString(EventNote); - JulianString temp_js1 = JulianString(EventInSchedule); - JulianString temp_js2 = JulianString(EventNotInSchedule); - - // Add event allready on Calendar Server or not. - doSingleTableLine(temp_js, serverICalComp ? temp_js1 : temp_js2, startSpacer); - - // See if it's not on the server, see if it overlaps any other event - // doSingleTableLine(&EventConflict, &EventTest, FALSE); - startSpacer = FALSE; - } - - if (!jf->isFoundNLSDataDirectory()) - { - // XXX: bad hack - t_int32 errorID; - JulianString u; - jst3 = EventError; - errorID = 123456789; - u = "ERROR: Cannot find NLS Data Directory"; - doSingleTableLine(jst3, u, TRUE); - } - errors = thisICalComp ? firstCalendar->getLogVector(thisICalComp) : firstCalendar->getLogVector(); - if (errors != nil) - { - nsCalLogError * element; - int32 error_max = MIN(5, errors->GetSize()); - int32 lost_errors = errors->GetSize() - error_max; - JulianString u; - - for (x=0; x < error_max; x++) - { - char* errorprefix; - - element = (nsCalLogError *)errors->GetAt(x); - u = ""; - - cjst = element->getShortReturnStatusCode().toCString(""); - if (cjst != 0) - { - u += cjst; - delete [] cjst; cjst = 0; - } - u += " "; - if ((errorprefix = getJulianErrorString(element->getErrorID())) != nil) - { - u += errorprefix; - u += ": "; - } - u += "("; - cjst = element->getOffendingData().toCString(""); - if (cjst != 0) - { - u += cjst; - delete [] cjst; cjst = 0; - } - u += ")"; - jst3 = EventError; - doSingleTableLine(jst3, u, startSpacer); - startSpacer = FALSE; - } - - if (lost_errors > 0) - { - char* temp = PR_smprintf(MoreErrors.GetBuffer(), lost_errors); - - if (temp) - { - jst3 = EventError; - jst4 = temp; - doSingleTableLine(jst3, jst4, startSpacer); - PR_DELETE(temp); - } - } - } - -} - -void -JulianFormFactory::doSingleTableLine(JulianString& labelString, JulianString& dataString, XP_Bool addSpacer) -{ - if (addSpacer) doAddHTML( Head2_HTML ); - doAddHTML( Props_HTML_Before_Label ); - if (labelString.GetStrlen() == 0) // Is empty? - { - doAddHTML( Props_HTML_Empty_Label ); - } else { - doAddHTML( Start_Font ); - doAddHTML( labelString ); - doAddHTML( End_Font ); - } - doAddHTML( Props_HTML_After_Label ); - doAddHTML( Start_Font ); - doAddHTML( dataString ); - doAddHTML( End_Font ); - doAddHTML( Props_HTML_After_Data ); -} - -void -JulianFormFactory::doCommentText() -{ - // Comments Field - doAddHTML( Head2_HTML ); - doAddHTML( Text_Label_Start_HTML ); - doAddHTML( Start_Font ); - doAddHTML( Text_Label ); - doAddHTML( End_Font ); - doAddHTML( Text_Label_End_HTML ); - doAddHTML( Text_Field_HTML ); -} - -// -// To add a group button on it's own line -void -JulianFormFactory::doAddGroupButton(JulianString GroupButton_HTML) -{ - doAddHTML( Start_Font ); - doAddHTML( GroupButton_HTML ); - doAddHTML( End_Font ); -} - -// -// To add a single button on it's own line -void -JulianFormFactory::doAddButton(JulianString SingleButton_HTML) -{ - doAddHTML( Buttons_GroupSingleStart_HTML ); - doAddGroupButton(SingleButton_HTML); - doAddHTML( Buttons_GroupSingleEnd_HTML ); -} - -// -// To add a single button on it's own line -JulianString -JulianFormFactory::doCreateButton(JulianString InputType, JulianString ButtonName, XP_Bool addTextField) -{ - JulianString t = ""; -// char* url_string = cb ? cb->callbackurl( (void *)nil, InputType->toCString("")) : ""; - char* url_string = ""; - char* temp = nil; - char* temp2 = nil; - - if (addTextField && ButtonName.GetStrlen()) - { - char* temp3 = ButtonName.GetBuffer(); - - if (temp3) - { - temp2 = PR_smprintf(Buttons_Text_End_HTML, temp3); - } - } - - temp = PR_smprintf(Buttons_Single_Start_HTML, url_string); - t += Start_Font; - if (temp) t += temp; - t += InputType; - t += Buttons_Single_Mid_HTML; - t += ButtonName; - t += addTextField ? temp2 : Buttons_Single_End_HTML; - t += End_Font; - PR_FREEIF(temp); - PR_FREEIF(temp2); - - return t; -} - -void -JulianFormFactory::addLegend() -{ - doAddHTML(FBT_Legend_Start_HTML); - - doAddHTML(FBT_Legend_Text1_HTML); - doAddHTML(Start_Font); - doAddHTML(FBT_Legend_Title); - doAddHTML(End_Font); - doAddHTML(FBT_Legend_TextEnd_HTML); - - doAddHTML(FBT_Legend_Text2_HTML); - doAddHTML(Start_Font); - doAddHTML(FBT_Legend_Free); - doAddHTML(End_Font); - doAddHTML(FBT_Legend_TextEnd_HTML); - - doAddHTML(FBT_Legend_Text3_HTML); - doAddHTML(Start_Font); - doAddHTML(FBT_Legend_Busy); - doAddHTML(End_Font); - doAddHTML(FBT_Legend_TextEnd_HTML); - - doAddHTML(FBT_Legend_Text4_HTML); - doAddHTML(Start_Font); - doAddHTML(FBT_Legend_Unknown); - doAddHTML(End_Font); - doAddHTML(FBT_Legend_TextEnd_HTML); - - doAddHTML(FBT_Legend_Text5_HTML); - doAddHTML(Start_Font); - doAddHTML(FBT_Legend_xparam); - doAddHTML(End_Font); - doAddHTML(FBT_Legend_TextEnd_HTML); - - doAddHTML(FBT_Legend_End_HTML); -} - -void -JulianFormFactory::addTimeZone() -{ - if (displayTimeZone) - { - doAddHTML( Start_Font ); - doAddHTML(FBT_TimeHead_HTML); - doAddHTML(tz); - doAddHTML(FBT_TimeHeadEnd_HTML); - doAddHTML( End_Font ); - doAddHTML( nbsp ); - } else - doAddHTML( nbsp ); -} - -void -JulianFormFactory::addMajorScale() -{ - int32 x; - char ss[10]; - UnicodeString usTemp; - switch (scaleType) - { - case 1: // Days 1 to 31 - doAddHTML(FBT_TDOffsetCell_HTML); - for (x = 1; x < 32; x++) - { - - sprintf(ss, "%d", x); - doAddHTML(TimeHour_HTML); - doAddHTML(Start_Font); - doAddHTML(FBT_TD_HourColor_HTML); - if (x < 10) doAddHTML(nbsp); - doAddHTML(ss); - doAddHTML(FBT_TD_HourColorEnd_HTML); - doAddHTML(End_Font); - doAddHTML(FBT_TimeHourEnd_HTML); - } - break; - - case 2: - for (x = start_hour; x < end_hour; x++) - { - int32 y = (x == 0) ? 12 : (x > 12) ? (x - 12) : (x); // Translate midnight to 12, convert 24h to 12h - - sprintf(ss, "%d", y); - doAddHTML(TimeHour_HTML); - doAddHTML(Start_Font); - doAddHTML(FBT_TD_HourColor_HTML); - doAddHTML(ss); - switch (x) - { - case 0: doAddHTML(FBT_AM); break; - case 12: doAddHTML(FBT_PM); break; - default: - if ( x == start_hour) - { - char* temps = " a"; - char* temp; - usTemp = temps; - uTemp = JulianString(temp = (start.strftime(usTemp)).toCString("")); - PR_FREEIF(temp); - doAddHTML(uTemp); - }; - } - doAddHTML(FBT_TD_HourColorEnd_HTML); - doAddHTML(End_Font); - doAddHTML(FBT_TimeHourEnd_HTML); - } - break; - } - -// doAddHTML(FBT_TDOffsetCell_HTML); - doAddHTML(FBT_EndRow_HTML); -} - -void -JulianFormFactory::addMinorScale() -{ - int32 x; - - if (scaleType == 2) - { - // Minutes 00 or 30 - doAddHTML(FBT_NewRow_HTML); - - JulianString tickarray[] = {FBT_TickMark1, FBT_TickMark2, FBT_TickMark3, FBT_TickMark4}; - int32 yoffset = (SlotsPerHour == 4) ? 1 : 2; - for (x = start_hour; x < end_hour; x ++) - { - for (int32 y = 0; y < SlotsPerHour; y ++) - { - doAddHTML(FBT_TimeMin_HTML); - doAddHTML(Start_Font); - doAddHTML(FBT_TD_MinuteColor_HTML); - doAddHTML(tickarray[y * yoffset]); - doAddHTML(FBT_TD_MinuteColorEnd_HTML); - doAddHTML(End_Font); - doAddHTML(FBT_TimeMinEnd_HTML); - } - } -// doAddHTML(FBT_TDOffsetCell_HTML); - doAddHTML(FBT_EndRow_HTML); - } else - { - doAddHTML(FBT_NewRow_HTML); - doAddHTML(FBT_EndRow_HTML); - } -} - -void -JulianFormFactory::addTicksScale() -{ -#if 0 - int32 x; - - if (detail && scaleType == 2) - { - doAddHTML(FBT_NewRow_HTML); - doAddHTML(FBT_TDOffsetCell_HTML); - for (x = start_hour; x < end_hour; x ++) - { - for (int32 y = 0; y < SlotsPerHour; y ++) - { - doAddHTML(FBT_TimeMin_HTML); - doAddHTML(Start_Font); - doAddHTML(y & 1 ? FBT_TickShort_HTML : FBT_TickLong_HTML); - doAddHTML(End_Font); - doAddHTML(FBT_TimeMinEnd_HTML); - } - } -// doAddHTML(FBT_TDOffsetCell_HTML); - doAddHTML(FBT_EndRow_HTML); - } -#endif -} - -#if 0 -void -JulianFormFactory::emptyRow() -{ - char* temp; - char* temp2 = FBT_DayXColEmptyCell_HTML.toCString(""); - - doAddHTML(FBT_NewRow_HTML); - doAddHTML(FBT_DayEmptyCell_HTML); // No Title - doAddHTML(FBT_DayEmptyCell_HTML); // offset to first timeslot - - // All of the time slots - temp = PR_smprintf(temp2, slotsacross); - doAddHTML(temp); - doAddHTML(FBT_EndRow_HTML); - PR_FREEIF( temp2 ); - PR_FREEIF( temp ); -} -#endif - -void -JulianFormFactory::LineInc(DateTime* dtTime) -{ - switch (scaleType) - { - case 2: DaysLineInc(dtTime); break; - case 1: MonthLineInc(dtTime); break; - } -} - -void -JulianFormFactory::DaysLineInc(DateTime* dtTime) -{ - dtTime->nextDay(); -} - -void -JulianFormFactory::MonthLineInc(DateTime* dtTime) -{ - dtTime->nextMonth(); - dtTime->setDayOfMonth(1); -} - -// Return TRUE if this line is still within it's time range -int32 -JulianFormFactory::LineCheck(DateTime& baseTime, DateTime& checkTime, DateTime& checkTimeEnd) -{ - - if (checkTime > ((VFreebusy *)thisICalComp)->getDTEnd()) - { - new_state = Empty_State; - return FALSE; - } - - if (checkTimeEnd < start) - { - new_state = Empty_State; - return FALSE; - } - - switch (scaleType) - { - case 1: - if ((baseTime.getMonth(default_tz) != checkTime.getMonth(default_tz))) - new_state = Empty_State; - return (baseTime.getMonth(default_tz) == checkTime.getMonth(default_tz)); - break; - default: - return TRUE; - break; - } - - return TRUE; -} - -void -JulianFormFactory::enterState(FB_State newState, XP_Bool forse = FALSE) -{ - if (!forse && - newState == state) - count++; - else - { - char* temp = nil; - char* temp2; - - switch (state) - { - case Free_State: temp2 = FBT_DayXColFreeCell_HTML; break; - case Busy_State: temp2 = FBT_DayXColBusyCell_HTML; break; - case Empty_State: temp2 = FBT_DayXColEmptyCell_HTML; break; - case XParam_State: temp2 = FBT_DayXXParamCell_HTML; break; - default: temp2 = ""; - } - - state = newState; - - if (count > 0) - { - temp = PR_smprintf(temp2, count); - doAddHTML(temp); - } - - count = forse ? 0 : 1; - - PR_FREEIF(temp); - } -} - -/* -** Set p to the next period. -** -** Returns a Period or nil when there are no more periods -*/ -Period* -JulianFormFactory::getNextPeriod() -{ - if (pIndex >= pv->GetSize()) // Have more periods in this freebusy? - { - // No more periods in this freebusy, try the next freebusy - if (fbIndex >= fbv->GetSize()) - { - p = (Period *)nil; // Ran out of periods and freebusys all togeather - pv = (JulianPtrArray *)nil; - } else - { - fb = (Freebusy *)fbv->GetAt(fbIndex++); - pv = fb->getPeriod(); pIndex = 0; - } - } else { - assert(FALSE); - } - if (pv) p = (Period *)pv->GetAt(pIndex++); - -#ifdef DEBUG_eyork - if (p) - { - char sbuf[1024]; - sprintf(sbuf,"%s", p->toString().toCString("")); - } -#endif - - return p; -} - - -/* -** Return the FB_State of the current Freebusy, fb. -*/ -int32 -JulianFormFactory::getFBType() -{ -int32 x = (int32)Empty_State; - - if (fb) - { - if (fb->getType() == Freebusy::FB_TYPE_BUSY || - fb->getType() == Freebusy::FB_TYPE_BUSY_UNAVAILABLE || - fb->getType() == Freebusy::FB_TYPE_BUSY_TENTATIVE) - x = (int32)Busy_State; - else - if (fb->getType() == Freebusy::FB_TYPE_XPARAMVAL) - x = (int32)XParam_State; - else - x = (int32)Free_State; - } - - return x; -} - -/* -** Look at the current period to see if it's time to go -** onto the next one. -** -** There are three cases here: -** -** 1. The current period didn't expire in the last time slot -** -** 2. The current period did expire in the last time slot -** -** 3. The current period is the last one. -** -** When moving on to the next period, check to see if more then -** one period over laps the next time slot. If so, set status to -** busy if any of them are busy. Set p to the last period. -*/ -void -JulianFormFactory::checkPeriodBounds(DateTime& startofslot, DateTime& endofslot) -{ - if (p) - { - DateTime PeriodEnd; - XP_Bool a = TRUE; - - new_state = (FB_State)getFBType(); // Reset new_state to the state from the last period - - // Check to see if this is the last Period that - // over laps this time slot. The current - // period, p, will be set to the last period - // that over laps. - while (a & (p != nil)) - { - // First case test. See if this time slot has made it - // to this period. May not be the case on the very - // first period. - if (p->getStart() > endofslot) // there yet? - { - new_state = Free_State; - break; - } - - p->getEndingTime(PeriodEnd); - // Is this new slot passed the current period? - if (!endofslot.beforeDateTime(PeriodEnd)) - { - DateTime PeriodStart; - - getNextPeriod(); // need a new period. Changes p and fb. - - if (p) - { - FB_State next_state = (FB_State)getFBType(); - - PeriodStart = p->getStart(); - if ((new_state < next_state) || // Once new_state goes busy in this time slot, it stays that way. - (startofslot.equalsDateTime(PeriodStart))) // But change states if the new period starts right on this startofslot - { - new_state = next_state; - } - } - } else - a = FALSE; - } - } else - new_state = Free_State; // No periods but in time slot range assume free -} - -void -JulianFormFactory::makeHourFBTable() -{ - UnicodeString usFBT_TickSetting = FBT_TickSetting; - MinutesPerSlot = nsCalDuration(usFBT_TickSetting); - SlotsPerHour = (60 / MinutesPerSlot.getMinute()); - displayTimeZone = TRUE; - scaleType = 2; - hoursToDisplay = 24; - slotsacross = SlotsPerHour * hoursToDisplay; - lineFormat = FBT_DayFormat; -} - -void -JulianFormFactory::makeDaysFBTable() -{ - UnicodeString usFBT_TickDaySetting = FBT_TickDaySetting; - MinutesPerSlot = nsCalDuration(usFBT_TickDaySetting); - SlotsPerHour = 1; - displayTimeZone = FALSE; - scaleType = 1; - hoursToDisplay = 0; - slotsacross = 31; - lineFormat = FBT_MonthFormat; -} - -// -// Make a FreeBusy Table -// -void -JulianFormFactory::doMakeFreeBusyTable() -{ - if (isFreeBusy) - { - JulianString timezoneformat = "z"; - nsCalDuration tempdur; - int32 x; - char* temp2 = nil; - char* temp; - UnicodeString usFBT_HourStart; - UnicodeString usFBT_HourEnd; - UnicodeString usTimeZoneFormat; - UnicodeString usFBT_TickOffset; - UnicodeString usLineFormat; - UnicodeString tempuni; - - new_state = Empty_State; - // set start and end (to remove warnings John Sun 5-1-98) - start = ((VFreebusy *)thisICalComp)->getDTStart(); - end = ((VFreebusy *)thisICalComp)->getDTEnd(); - - // normalize end. must stop on an even day/time. - end.setDMY(end.getDate() + 1, end.getMonth(), end.getYear()); - end.set(Calendar::HOUR_OF_DAY, 0); - end.set(Calendar::MINUTE, 0); - end.set(Calendar::SECOND, 0); - - DateTime::getDuration(start, end, tempdur); - - tempdur.getMonth() >= 2 ? makeDaysFBTable() : makeHourFBTable(); - PR_FREEIF(TimeHour_HTML); - TimeHour_HTML = PR_smprintf(temp2 = FBT_TimeHour_HTML, SlotsPerHour); - - // This is the Hour row ie 6am to 7 pm etc - usFBT_HourStart = FBT_HourStart; - usFBT_HourEnd = FBT_HourEnd; - - start_hour = DateTime(usFBT_HourStart).getHour(default_tz); - end_hour = DateTime(usFBT_HourEnd).getHour(default_tz); - usTimeZoneFormat = timezoneformat.GetBuffer(); - - if (DateTime(usFBT_HourEnd).getMinute(default_tz) != 0) end_hour++; // Only show full hours. This is to get 11pm to work - tz = JulianString(temp = (start.strftime(usTimeZoneFormat, default_tz)).toCString("")); - PR_FREEIF(temp); - - // Legend - addLegend(); - - doAddHTML(FBT_Start_HTML); - doAddHTML(FBT_NewRow_HTML); - - // This is the TimeZone Heading - addTimeZone(); - - // Scale - addMajorScale(); - addMinorScale(); - addTicksScale(); - - fbv = isFreeBusy ? ((VFreebusy *)thisICalComp)->getFreebusy() : nil; - pv = nil; - fb = nil; - p = nil; - fbIndex = 0; - pIndex = 0; - - if (fbv) fb = (Freebusy *)fbv->GetAt(fbIndex++); - if (fb) pv = fb->getPeriod(); pIndex = 0; - if (pv) p = (Period *)pv->GetAt(pIndex++); - - usFBT_TickOffset = FBT_TickOffset; - // Each day or month now. So this this each line in the table - for (DateTime currentday = start; currentday < end; LineInc(¤tday)) - { - char* temp; - - nsCalDuration d_offset = nsCalDuration(usFBT_TickOffset); - // int32 slot_count; - DateTime StartOfSlot, EndOfSlot; - - StartOfSlot = DateTime( currentday.getYear(default_tz), - currentday.getMonth(default_tz), - MinutesPerSlot.getDay() > 0 ? 1 : currentday.getDate(default_tz), - MinutesPerSlot.getDay() > 0 ? 0 : start_hour, - 0); - EndOfSlot = DateTime(StartOfSlot); - EndOfSlot.add(MinutesPerSlot); - - doAddHTML(FBT_NewRow_HTML); - doAddHTML(FBT_DayStart_HTML); - - usLineFormat = lineFormat.GetBuffer(); - tempuni = currentday.strftime(usLineFormat); - uTemp = JulianString(temp = tempuni.toCString("")); - PR_FREEIF(temp); - doAddHTML(Start_Font); - doAddHTML(uTemp); - doAddHTML(End_Font); - doAddHTML(FBT_DayEnd_HTML); - - // Loop for the number of timeslots, each slot is 30 minutes or 1 day. - // slot_count = MinutesPerSlot.getDay() > 0 ? 31 : (end_hour - start_hour) * SlotsPerHour; - - // In Free State = 0, Busy State = 1, Empty State = 2 - // This is each column in the table - for (x = 0, state = Free_State, count = 0; x < slotsacross; x++, StartOfSlot.add(MinutesPerSlot), EndOfSlot.add(MinutesPerSlot)) - { -#ifdef DEBUG_eyork - char sbuf[1024]; - sprintf(sbuf,"%s", StartOfSlot.toString().toCString("")); - sprintf(sbuf,"%s", EndOfSlot.toString().toCString("")); -#endif - - // Do either free, busy, or not in this time slot - // First make sure that this slot hasn't left the range for this line. ie Feb 28 should not go to Mar 1 on one line - - // Did the month end on this line? or Still have to finish this line, did go pass dtend? - // Sets new_state if needed - if (LineCheck(currentday, StartOfSlot, EndOfSlot)) - checkPeriodBounds(StartOfSlot, EndOfSlot); - - enterState(new_state); - } - - enterState(state, TRUE); // End of line, force output. - - // Padding at the end of each line, etc - doAddHTML(FBT_DayEnd_HTML); - doAddHTML(FBT_TimeMin_HTML); - // doAddHTML(FBT_DayEmptyCell_HTML); - doAddHTML(FBT_TimeMinEnd_HTML); - doAddHTML(FBT_EndRow_HTML); - - } - - doAddHTML(FBT_End_HTML); - } -} - -void -JulianFormFactory::HandlePublishVEvent() -{ - int32 data_length = isDetail() ? publish_D_Fields_Data_HTML_Length : publish_Fields_Data_HTML_Length; - int32 label_length = isDetail() ? publish_D_Fields_Labels_Length : publish_Fields_Labels_Length; - - doHeader(publish_Header_HTML); - doProps(label_length, isDetail() ? publish_D_Fields_Labels : publish_Fields_Labels, data_length, isDetail() ? publish_D_Fields_Data_HTML : publish_Fields_Data_HTML); - doStatus(); - - if (isDetail()) - { - if (do_capi_login) doAddButton(doCreateButton(Buttons_Add_Type, Buttons_Add_Label)); - doClose(); - } else { - doAddButton(doCreateButton(Buttons_Details_Type, Buttons_Details_Label)); - if (do_capi_login) - { - doAddHTML( Head2_HTML ); - doAddButton(doCreateButton(Buttons_Add_Type, Buttons_Add_Label)); - } - } - doAddHTML( Props_End_HTML ); - doAddHTML( publish_End_HTML ); -} - -void -JulianFormFactory::HandleError() -{ - int32 data_length = error_Fields_Data_HTML_Length; - int32 label_length = error_Fields_Labels_Length; - - doHeader(error_Header_HTML); - doAddHTML(Props_Head_HTML); - doStatus(); - - doAddHTML( Props_End_HTML ); - doAddHTML( error_End_HTML ); -} - -void -JulianFormFactory::HandlePublishVFreeBusy(XP_Bool isPublish) -{ - int32 data_length = isDetail() ? publishFB_D_Fields_Data_HTML_Length : publishFB_Fields_Data_HTML_Length; - int32 label_length = isDetail() ? publishFB_D_Fields_Labels_Length : publishFB_Fields_Labels_Length; - - doHeader(isPublish ? publishFB_Header_HTML : replyFB_Header_HTML); - doProps(label_length, isDetail() ? publishFB_D_Fields_Labels : publishFB_Fields_Labels, data_length, isDetail() ? publishFB_D_Fields_Data_HTML : publishFB_Fields_Data_HTML); - doStatus(); - - if (isDetail()) - { - doClose(); - } else { - doAddButton(doCreateButton(Buttons_Details_Type, Buttons_Details_Label)); - doAddHTML( Head2_HTML ); - } - doAddHTML( Props_End_HTML ); - - doMakeFreeBusyTable(); - - doAddHTML( publishFB_End_HTML ); -} - -void -JulianFormFactory::HandleRequestVEvent() -{ - int32 data_length = isDetail() ? request_D_Fields_Data_HTML_Length : request_Fields_Data_HTML_Length; - int32 label_length = isDetail() ? request_D_Fields_Labels_Length : request_Fields_Labels_Length; - - doHeader(request_Header_HTML); - doProps(label_length, isDetail() ? request_D_Fields_Labels : request_Fields_Labels, data_length, isDetail() ? request_D_Fields_Data_HTML : request_Fields_Data_HTML); - if (!isDetail()) doAddButton(doCreateButton(Buttons_Details_Type, Buttons_Details_Label)); - doStatus(); - doCommentText(); - if (isDetail()) doAddButton(Buttons_SaveDel_HTML); - - doAddHTML( Buttons_GroupStart_HTML ); - doAddGroupButton(doCreateButton(Buttons_Accept_Type, Buttons_Accept_Label)); - doAddGroupButton(doCreateButton(Buttons_Decline_Type, Buttons_Decline_Label)); - if (isDetail()) - { - // Add Save copy here - doAddGroupButton(doCreateButton(Buttons_Tentative_Type, Buttons_Tentative_Label)); - doAddGroupButton(doCreateButton(Buttons_DelTo_Type, Buttons_DelTo_Label, TRUE)); - } else { - doAddGroupButton(doCreateButton(Buttons_DelTo_Type, Buttons_DelTo_Label, TRUE)); - } - doAddHTML( Buttons_GroupEnd_HTML ); - - doClose(); - doAddHTML( Props_End_HTML ); - doAddHTML( request_End_HTML ); -} - -void -JulianFormFactory::HandleRequestVFreeBusy( ) -{ - int32 data_length = isDetail() ? request_D_FB_Fields_Data_HTML_Length : request_FB_Fields_Data_HTML_Length; - int32 label_length = isDetail() ? request_D_FB_Fields_Labels_Length : request_FB_Fields_Labels_Length; - - doHeader(request_FB_Header_HTML); - doProps(label_length, isDetail() ? request_D_FB_Fields_Labels : request_FB_Fields_Labels, data_length, isDetail() ? request_D_FB_Fields_Data_HTML : request_FB_Fields_Data_HTML); - if (!isDetail()) doAddButton(doCreateButton(Buttons_Details_Type, Buttons_Details_Label)); - doStatus(); - - doAddHTML( Head2_HTML ); - if (isDetail()) { doAddHTML( Props_End_HTML ); doMakeFreeBusyTable(); doAddHTML( Props_Head_HTML ); doAddHTML( Head2_HTML ); } - - if (do_capi_login) doAddButton(doCreateButton(Buttons_SendFB_Type, Buttons_SendFB_Label)); - doClose(); - doAddHTML( Props_End_HTML ); - - doAddHTML( request_End_HTML ); -} - -void -JulianFormFactory::HandleEventReplyVEvent() -{ - int32 data_length = isDetail() ? eventreply_D_Fields_Data_HTML_Length : eventreply_Fields_Data_HTML_Length; - int32 label_length = isDetail() ? eventreply_D_Fields_Labels_Length : eventreply_Fields_Labels_Length; - - doHeader(eventreply_Header_HTML); - doProps(label_length, isDetail() ? eventreply_D_Fields_Labels : eventreply_Fields_Labels, data_length, isDetail() ? eventreply_D_Fields_Data_HTML : eventreply_Fields_Data_HTML); - doStatus(); - - if (isDetail()) - { - if (do_capi_login) doAddButton(doCreateButton(Buttons_Add_Type, Buttons_Update_Label)); - doClose(); - } else { - doAddButton(doCreateButton(Buttons_Details_Type, Buttons_Details_Label)); - if (do_capi_login) - { - doAddHTML( Head2_HTML ); - doAddButton(doCreateButton(Buttons_Add_Type, Buttons_Update_Label)); - } - } - doAddHTML( Props_End_HTML ); - doAddHTML( eventreply_End_HTML ); -} - -void -JulianFormFactory::HandleEventCancelVEvent() -{ - int32 data_length = isDetail() ? eventcancel_D_Fields_Data_HTML_Length : eventcancel_Fields_Data_HTML_Length; - int32 label_length = isDetail() ? eventcancel_D_Fields_Labels_Length : eventcancel_Fields_Labels_Length; - - doHeader(eventcancel_Header_HTML); - doProps(label_length, isDetail() ? eventcancel_D_Fields_Labels : eventcancel_Fields_Labels, data_length, isDetail() ? eventcancel_D_Fields_Data_HTML : eventcancel_Fields_Data_HTML); - doStatus(); - - if (isDetail()) - { - if (do_capi_login) doAddButton(doCreateButton(Buttons_Add_Type, Buttons_Add_Label)); - doClose(); - } else { - doAddButton(doCreateButton(Buttons_Details_Type, Buttons_Details_Label)); - if (do_capi_login) - { - doAddHTML( Head2_HTML ); - doAddButton(doCreateButton(Buttons_Add_Type, Buttons_Update_Label)); - } - } - doAddHTML( Props_End_HTML ); - doAddHTML( eventcancel_End_HTML ); -} - -void -JulianFormFactory::HandleEventRefreshRequestVEvent() -{ - int32 data_length = isDetail() ? eventrefreshreg_D_Fields_Data_HTML_Length : eventrefreshreg_Fields_Data_HTML_Length; - int32 label_length = isDetail() ? eventrefreshreg_D_Fields_Labels_Length : eventrefreshreg_Fields_Labels_Length; - - doHeader(eventrefreshreg_Header_HTML); - doProps(label_length, isDetail() ? eventrefreshreg_D_Fields_Labels : eventrefreshreg_Fields_Labels, data_length, isDetail() ? eventrefreshreg_D_Fields_Data_HTML : eventrefreshreg_Fields_Data_HTML); - doStatus(); - doCommentText(); - - if (isDetail()) - { - if (do_capi_login) doAddButton(doCreateButton(Buttons_Add_Type, Buttons_Add_Label)); - if (do_capi_login) doAddButton(doCreateButton(Buttons_SendRefresh_Type, Buttons_SendRefresh_Label)); - doClose(); - } else { - doAddButton(doCreateButton(Buttons_Details_Type, Buttons_Details_Label)); - if (do_capi_login) - { - doAddHTML( Head2_HTML ); - doAddButton(doCreateButton(Buttons_SendRefresh_Type, Buttons_SendRefresh_Label)); - } - } - doAddHTML( Props_End_HTML ); - doAddHTML( eventrefreshreg_End_HTML ); -} - -void -JulianFormFactory::HandleEventCounterPropVEvent() -{ - int32 data_length = isDetail() ? request_D_Fields_Data_HTML_Length : request_Fields_Data_HTML_Length; - int32 label_length = isDetail() ? request_D_Fields_Labels_Length : request_Fields_Labels_Length; - - doHeader(eventcounterprop_Header_HTML); - doProps(label_length, isDetail() ? request_D_Fields_Labels : request_Fields_Labels, data_length, isDetail() ? request_D_Fields_Data_HTML : request_Fields_Data_HTML); - if (!isDetail()) doAddButton(doCreateButton(Buttons_Details_Type, Buttons_Details_Label)); - doStatus(); - doCommentText(); - if (isDetail()) doAddButton(Buttons_SaveDel_HTML); - - doAddHTML( Buttons_GroupStart_HTML ); - doAddGroupButton(doCreateButton(Buttons_Accept_Type, Buttons_Accept_Label)); - doAddGroupButton(doCreateButton(Buttons_Decline_Type, Buttons_Decline_Label)); - doAddHTML( Buttons_GroupEnd_HTML ); - - doClose(); - doAddHTML( Props_End_HTML ); - doAddHTML( request_End_HTML ); -} - -void -JulianFormFactory::HandleDeclineCounterVEvent() -{ - int32 data_length = eventdelinecounter_Fields_Data_HTML_Length; - int32 label_length = eventdelinecounter_Fields_Labels_Length; - - doHeader(eventdelinecounter_Header_HTML); - doProps(label_length, eventdelinecounter_Fields_Labels, data_length, eventdelinecounter_Fields_Data_HTML); - doStatus(); - doAddHTML( Props_End_HTML ); - doAddHTML( request_End_HTML ); -} - -/* -** General HTML -*/ -char* JulianFormFactory::Start_HTML = "

\n"; -char* JulianFormFactory::Props_Head_HTML = "\n"; -char* JulianFormFactory::Props_HTML_Before_Label = "\n"; -char* JulianFormFactory::Props_HTML_Empty_Label = ""; -char* JulianFormFactory::Props_End_HTML = "

"; -char* JulianFormFactory::Props_HTML_After_Label = "  

"; -char* JulianFormFactory::Props_HTML_After_Data = " 
  
 
"; -char* JulianFormFactory::End_HTML = "

"; -char* JulianFormFactory::General_Header_Start_HTML = "
 "; -char* JulianFormFactory::General_Header_Status_HTML = "

"; -char* JulianFormFactory::General_Header_End_HTML = "

\n"; -char* JulianFormFactory::Head2_HTML = "
\n"; -char* JulianFormFactory::Italic_Start_HTML = ""; -char* JulianFormFactory::Italic_End_HTML = ""; -char* JulianFormFactory::Bold_Start_HTML = ""; -char* JulianFormFactory::Bold_End_HTML = ""; -char* JulianFormFactory::Aref_Start_HTML = ""; -char* JulianFormFactory::ArefTag_End_HTML = ""; -char* JulianFormFactory::nbsp = " "; -char* JulianFormFactory::Accepted_Gif_HTML = "+ "; -char* JulianFormFactory::Declined_Gif_HTML = "- "; -char* JulianFormFactory::Delegated_Gif_HTML = "> "; -char* JulianFormFactory::NeedsAction_Gif_HTML = "* "; -char* JulianFormFactory::Question_Gif_HTML = "? "; -char* JulianFormFactory::Line_3_HTML = "
"; -char* JulianFormFactory::Cell_Start_HTML = ""; -char* JulianFormFactory::Cell_End_HTML = ""; -char* JulianFormFactory::Font_Fixed_Start_HTML = ""; -char* JulianFormFactory::Font_Fixed_End_HTML = ""; -char* JulianFormFactory::Line_Break_HTML = "
"; - -/* -** Free/Busy Table -*/ -char* JulianFormFactory::FBT_Start_HTML = "\n"; -char* JulianFormFactory::FBT_End_HTML = "
"; -char* JulianFormFactory::FBT_NewRow_HTML = "\n"; -char* JulianFormFactory::FBT_EndRow_HTML = "\n"; -char* JulianFormFactory::FBT_TimeHead_HTML = "\n"; -char* JulianFormFactory::FBT_TimeHeadEnd_HTML = ""; -char* JulianFormFactory::FBT_TimeHour_HTML = ""; -char* JulianFormFactory::FBT_TimeHourEnd_HTML = "\n"; -char* JulianFormFactory::FBT_TimeMin_HTML = ""; -char* JulianFormFactory::FBT_TimeMinEnd_HTML = "\n"; -char* JulianFormFactory::FBT_TD_HourColor_HTML = ""; -char* JulianFormFactory::FBT_TD_HourColorEnd_HTML = ""; -char* JulianFormFactory::FBT_TD_MinuteColor_HTML = ""; -char* JulianFormFactory::FBT_TD_MinuteColorEnd_HTML = ""; -char* JulianFormFactory::FBT_TDOffsetCell_HTML = " "; -char* JulianFormFactory::FBT_TickLong_HTML = ""; -char* JulianFormFactory::FBT_TickShort_HTML = ""; -char* JulianFormFactory::FBT_HourStart = "19971101T000000"; -char* JulianFormFactory::FBT_HourEnd = "19971101T235959"; - -char* JulianFormFactory::FBT_DayStart_HTML = ""; -char* JulianFormFactory::FBT_DayEnd_HTML = ""; -char* JulianFormFactory::FBT_DayEmptyCell_HTML = "
 
"; -char* JulianFormFactory::FBT_DayFreeCell_HTML = "
 
"; -char* JulianFormFactory::FBT_DayBusyCell_HTML = "
 
"; -char* JulianFormFactory::FBT_DayXParamCell_HTML = "
 
"; -char* JulianFormFactory::FBT_DayXColFreeCell_HTML = "
 
"; -char* JulianFormFactory::FBT_DayXColBusyCell_HTML = "
 
"; -char* JulianFormFactory::FBT_DayXColEmptyCell_HTML = "
 
"; -char* JulianFormFactory::FBT_DayXXParamCell_HTML = "
 
"; -char* JulianFormFactory::FBT_EmptyRow_HTML = " "; - -// Legend -char* JulianFormFactory::FBT_Legend_Start_HTML = ""; -char* JulianFormFactory::FBT_Legend_End_HTML = "
"; -char* JulianFormFactory::FBT_Legend_Text1_HTML = "
"; -char* JulianFormFactory::FBT_Legend_Text2_HTML = "
"; -char* JulianFormFactory::FBT_Legend_Text3_HTML = "
"; -char* JulianFormFactory::FBT_Legend_Text4_HTML = "
"; -char* JulianFormFactory::FBT_Legend_Text5_HTML = "
"; -char* JulianFormFactory::FBT_Legend_TextEnd_HTML = " 
"; - -char* JulianFormFactory::FBT_TickMark1 = "00"; -char* JulianFormFactory::FBT_TickMark2 = "15"; -char* JulianFormFactory::FBT_TickMark3 = "30"; -char* JulianFormFactory::FBT_TickMark4 = "45"; -char* JulianFormFactory::FBT_TickSetting = "PT00H30M"; -char* JulianFormFactory::FBT_TickDaySetting = "P1D"; -char* JulianFormFactory::FBT_TickOffset = "PT00H01M"; -char* JulianFormFactory::FBT_DayFormat = "EEE, MMM dd"; -char* JulianFormFactory::FBT_MonthFormat = "MMM yyyy"; - -/* -** Fonts -*/ -char* JulianFormFactory::Start_Font = ""; -char* JulianFormFactory::End_Font = ""; -char* JulianFormFactory::Start_BIG_Font = ""; - -/* -** Buttons -*/ -char* JulianFormFactory::Buttons_Single_Start_HTML = ""; -char* JulianFormFactory::Buttons_Text_End_HTML = "\"> "; - -JulianString JulianFormFactory::Buttons_Details_Type = "btnNotifySubmitMD"; -JulianString JulianFormFactory::Buttons_Add_Type = "btnNotifySubmitATS"; -JulianString JulianFormFactory::Buttons_Close_Type = "btnNotifySubmitC"; -JulianString JulianFormFactory::Buttons_Accept_Type = "btnNotifySubmitAccept"; -JulianString JulianFormFactory::Buttons_Decline_Type = "btnNotifySubmitDecline"; -JulianString JulianFormFactory::Buttons_Tentative_Type = "btnNotifySubmitTent"; -JulianString JulianFormFactory::Buttons_SendFB_Type = "btnNotifySubmitFB"; -JulianString JulianFormFactory::Buttons_SendRefresh_Type = "btnNotifySubmitERR"; -JulianString JulianFormFactory::Buttons_DelTo_Type = "btnNotifySubmitDelTo"; - -char* JulianFormFactory::Buttons_SaveDel_HTML = " Save copy of delegated event"; - -char* JulianFormFactory::Buttons_GroupStart_HTML = ""; -char* JulianFormFactory::Buttons_GroupEnd_HTML = ""; -char* JulianFormFactory::Buttons_GroupSingleStart_HTML= " \n"; -char* JulianFormFactory::Buttons_GroupSingleEnd_HTML= ""; - -/* -** Text Fields -*/ -char* JulianFormFactory::Text_Label_Start_HTML = ""; -JulianString JulianFormFactory::Text_Label = "Comments (optional): "; -char* JulianFormFactory::Text_Label_End_HTML = ""; -JulianString JulianFormFactory::CommentsFieldName = "txtNotifyComments"; -JulianString JulianFormFactory::DelToFieldName = "btnNotifySubmitDelTo"; -char* JulianFormFactory::Text_Field_HTML = ""; - -/* -** ICalPropDefs -*/ -JulianString JulianFormFactory::ICalPreProcess = "%B%v%J"; -JulianString JulianFormFactory::ICalPostProcess = ""; - -/* -** Error -*/ -int32 JulianFormFactory::error_Fields_Labels_Length = 2; -JulianString JulianFormFactory::error_Fields_Labels[] = { "What:", "When:"}; -int32 JulianFormFactory::error_Fields_Data_HTML_Length = 3; -JulianString JulianFormFactory::error_Fields_Data_HTML[] = { "%S", "%B", "%i" }; -char* JulianFormFactory::error_End_HTML = ""; - -/* -** Publish -*/ -int32 JulianFormFactory::publish_Fields_Labels_Length = 3; -JulianString JulianFormFactory::publish_Fields_Labels[] = { "What:", "When:", "Location:"}; -int32 JulianFormFactory::publish_Fields_Data_HTML_Length = 4; -JulianString JulianFormFactory::publish_Fields_Data_HTML[] = { "%S", "%B", "%L", "%i" }; -char* JulianFormFactory::publish_End_HTML = ""; - -/* -** Publish Detail -*/ -int32 JulianFormFactory::publish_D_Fields_Labels_Length = 14; -JulianString JulianFormFactory::publish_D_Fields_Labels[] = { "What:", "When:", "Location:", "Organizer:", "Status:", "Priority:", "Categories:", "Resources:", "Attachments:", "Alarms:", "Created:", "Last Modified:", "Sent:", "UID:" }; -int32 JulianFormFactory::publish_D_Fields_Data_HTML_Length = 15; -JulianString JulianFormFactory::publish_D_Fields_Data_HTML[] = { "%S", "%B", "%L", "%J", "%g", "%p", "%k", "%r", "%a", "%w", "%t", "%M", "%C", "%U", "%i" }; - -/* -** Publish VFreeBusy -*/ -int32 JulianFormFactory::publishFB_Fields_Labels_Length = 2; -JulianString JulianFormFactory::publishFB_Fields_Labels[] = { "What:", "When:"}; -int32 JulianFormFactory::publishFB_Fields_Data_HTML_Length = 2; -JulianString JulianFormFactory::publishFB_Fields_Data_HTML[] = { "%S", "%B" }; -char* JulianFormFactory::publishFB_End_HTML = ""; - -/* -** Publish VFreeBusy Detail -*/ -int32 JulianFormFactory::publishFB_D_Fields_Labels_Length = 4; -JulianString JulianFormFactory::publishFB_D_Fields_Labels[] = { "What:", "When:", "Created:", "Sent:"}; -int32 JulianFormFactory::publishFB_D_Fields_Data_HTML_Length = 4; -JulianString JulianFormFactory::publishFB_D_Fields_Data_HTML[] = { "%S", "%B", "%t", "%C" }; - -/* -** Reply VFreeBusy -*/ - -/* -** Request VEvent -*/ -int32 JulianFormFactory::request_Fields_Labels_Length = 5; -JulianString JulianFormFactory::request_Fields_Labels[] = { "What:", "When:", "Location:", "Organizer:", "Who:"}; -int32 JulianFormFactory::request_Fields_Data_HTML_Length = 6; -JulianString JulianFormFactory::request_Fields_Data_HTML[] = { "%S", "%B", "%L", "%J", "%v", "%i" }; -char* JulianFormFactory::request_End_HTML = ""; - -/* -** Request Detail VEvent -*/ -int32 JulianFormFactory::request_D_Fields_Labels_Length = 15; -JulianString JulianFormFactory::request_D_Fields_Labels[] = { "What:", "When:", "Location:", "Organizer:", "Who:", "Status:", "Priority:", "Categories:", "Resources:", "Attachments:", "Alarms:", "Created:", "Last Modified:", "Sent:", "UID:"}; -int32 JulianFormFactory::request_D_Fields_Data_HTML_Length = 16; -JulianString JulianFormFactory::request_D_Fields_Data_HTML[]= { "%S", "%B", "%L", "%J", "%v", "%g", "%p", "%k", "%r", "%a", "%w", "%t", "%M", "%C", "%U", "%i" }; - -/* -** Request VFreeBusy -*/ -int32 JulianFormFactory::request_FB_Fields_Labels_Length = 1; -JulianString JulianFormFactory::request_FB_Fields_Labels[] = { "When:"}; -int32 JulianFormFactory::request_FB_Fields_Data_HTML_Length = 1; -JulianString JulianFormFactory::request_FB_Fields_Data_HTML[] = { "%B" }; -char* JulianFormFactory::request_FB_End_HTML = ""; - -/* -** Request VFreeBusy Detail -*/ -int32 JulianFormFactory::request_D_FB_Fields_Labels_Length = 1; -JulianString JulianFormFactory::request_D_FB_Fields_Labels[] = { "When:"}; -int32 JulianFormFactory::request_D_FB_Fields_Data_HTML_Length = 1; -JulianString JulianFormFactory::request_D_FB_Fields_Data_HTML[] = { "%B" }; -char* JulianFormFactory::request_D_FB_End_HTML = ""; - -/* -** Event Reply -*/ -int32 JulianFormFactory::eventreply_Fields_Labels_Length = 2; -JulianString JulianFormFactory::eventreply_Fields_Labels[] = { "Who:", "Status:"}; -int32 JulianFormFactory::eventreply_Fields_Data_HTML_Length = 4; -JulianString JulianFormFactory::eventreply_Fields_Data_HTML[] = { "%v", "%g", "%K", "%i" }; -char* JulianFormFactory::eventreply_End_HTML = ""; - -/* -** Event Reply Detail -*/ -int32 JulianFormFactory::eventreply_D_Fields_Labels_Length= 5; -JulianString JulianFormFactory::eventreply_D_Fields_Labels[] = { "What:", "When:", "Location:", "Who:", "Status:" }; -int32 JulianFormFactory::eventreply_D_Fields_Data_HTML_Length = 6; -JulianString JulianFormFactory::eventreply_D_Fields_Data_HTML[] = { "%S", "%B", "%L", "%v", "%g", "%K", "%i" }; - -/* -** Event Cancel -*/ -int32 JulianFormFactory::eventcancel_Fields_Labels_Length = 2; -JulianString JulianFormFactory::eventcancel_Fields_Labels[] = { "Status:", "UID:"}; -int32 JulianFormFactory::eventcancel_Fields_Data_HTML_Length = 3; -JulianString JulianFormFactory::eventcancel_Fields_Data_HTML[] = { "%g", "%U", "%K" }; -char* JulianFormFactory::eventcancel_End_HTML = ""; - -/* -** Event Cancel Detail -*/ -int32 JulianFormFactory::eventcancel_D_Fields_Labels_Length= 14; -JulianString JulianFormFactory::eventcancel_D_Fields_Labels[] = { "What:", "When:", "Location:", "Organizer:", "Status:", "Priority:", "Categories:", "Resources:", "Attachments:", "Alarms:", "Created:", "Last Modified:", "Sent:", "UID:" }; -int32 JulianFormFactory::eventcancel_D_Fields_Data_HTML_Length = 16; -JulianString JulianFormFactory::eventcancel_D_Fields_Data_HTML[] = { "%S", "%B", "%L", "%J", "%g", "%p", "%k", "%r", "%a", "%w", "%t", "%M", "%C", "%U", "%K", "%i" }; - -/* -** Event Refresh Request -*/ -int32 JulianFormFactory::eventrefreshreg_Fields_Labels_Length = 2; -JulianString JulianFormFactory::eventrefreshreg_Fields_Labels[] = { "Who:", "UID:"}; -int32 JulianFormFactory::eventrefreshreg_Fields_Data_HTML_Length = 2; -JulianString JulianFormFactory::eventrefreshreg_Fields_Data_HTML[] = { "%v", "%U" }; -char* JulianFormFactory::eventrefreshreg_End_HTML = ""; - -/* -** Event Refresh Request Detail -*/ -int32 JulianFormFactory::eventrefreshreg_D_Fields_Labels_Length= 14; -JulianString JulianFormFactory::eventrefreshreg_D_Fields_Labels[] = { "What:", "When:", "Location:", "Organizer:", "Status:", "Priority:", "Categories:", "Resources:", "Attachments:", "Alarms:", "Created:", "Last Modified:", "Sent:", "UID:" }; -int32 JulianFormFactory::eventrefreshreg_D_Fields_Data_HTML_Length = 15; -JulianString JulianFormFactory::eventrefreshreg_D_Fields_Data_HTML[]= { "%S", "%B", "%L", "%J", "%g", "%p", "%k", "%r", "%a", "%w", "%t", "%M", "%C", "%U", "%i" }; - -/* -** Event Counter Proposal -*/ - -/* -** Event Deline Counter -*/ -int32 JulianFormFactory::eventdelinecounter_Fields_Labels_Length= 1; -JulianString JulianFormFactory::eventdelinecounter_Fields_Labels[] = { "What:" }; -int32 JulianFormFactory::eventdelinecounter_Fields_Data_HTML_Length = 3; -JulianString JulianFormFactory::eventdelinecounter_Fields_Data_HTML[]= { "%S", "%K", "%i" }; - -/* -*** -*** String to translate -*** -*/ -JulianString JulianFormFactory::SubjectSep; - -#ifndef LIBJULIAN_USE_XPSTRS -void -JulianFormFactory::init() -{ - do_capi_login = FALSE; /* Default is not to ask for capi login info */ - - if (jf->getCallbacks()->BoolPref) - (*jf->getCallbacks()->BoolPref)("calendar.capi.enabled", &do_capi_login); - - error_Header_HTML = "Error"; - publish_Header_HTML = "Published Event"; - publishFB_Header_HTML = "Published Free/Busy"; - replyFB_Header_HTML = "Reply Free/Busy"; - request_Header_HTML = "Event Request"; - request_FB_Header_HTML = "Free/Busy Time Request"; - request_D_FB_Header_HTML = "Free/Busy Time Request"; - eventreply_Header_HTML = "Event Reply"; - eventcancel_Header_HTML = "Event Cancellation"; - eventrefreshreg_Header_HTML = "Event Refresh Request"; - eventcounterprop_Header_HTML = "Event Counter Proposal"; - eventdelinecounter_Header_HTML = "Decline Counter Proposal"; - - String_What = "What:"; - String_When = "When:"; - String_Location = "Location:"; - String_Organizer = "Organizer:"; - String_Status = "Status:"; - String_Priority = "Priority:"; - String_Categories = "Categories:"; - String_Resources = "Resources:"; - String_Attachments = "Attachments:"; - String_Alarms = "Alarms:"; - String_Created = "Created:"; - String_Last_Modified = "Last Modified:"; - String_Sent = "Sent:"; - String_UID = "UID:"; - - FBT_Legend_Title = "Legend:"; - FBT_Legend_Free = "free"; - FBT_Legend_Busy = "busy"; - FBT_Legend_Unknown = "unknown"; - FBT_Legend_xparam = "undefined"; - - FBT_AM = " AM"; - FBT_PM = " PM"; - - Buttons_Details_Label = "More Details..."; - Buttons_Add_Label = "Add To Schedule"; - Buttons_Close_Label = "Close"; - Buttons_Accept_Label = "Accept"; - Buttons_AcceptAll_Label = "Accept All"; - Buttons_Update_Label = "Update Schedule"; - Buttons_Decline_Label = "Decline"; - Buttons_Tentative_Label = "Tentative"; - Buttons_SendFB_Label = "Send Free/Busy Time Infomation"; - Buttons_SendRefresh_Label = "Send Refresh"; - Buttons_DelTo_Label = "Delegate to"; - -/* -** Status Messages -*/ - EventInSchedule = "This event is already in your schedule\r\n"; - EventNotInSchedule = "This event is not yet in your schedule\r\n"; - EventConflict = "Conflicts:"; - EventNote = "Note:"; - EventError = "Error:"; - EventTest = "Staff meeting 3:30 - 4:30 PM :-("; - Text_To = " to "; - Text_AllDay = " ( Day Event) "; - Text_StartOn = " Begins on "; - Text_Was = "Was"; - -/* -** Muilt Stuff -*/ - MuiltEvent_Header_HTML = "Published Calendar Events"; - MuiltFB_Header_HTML = "Published Calendar Free/Busy"; - MuiltEvent = "This messages contains %d events."; - WhenStr = "When"; - WhatStr = "What"; - SubjectSep = ": "; - -/* -** Error Strings -*/ - MoreErrors = "There are also %d other errors"; - TooManyEvents = "Display limited to the first %d events."; - error0 = "Unknown"; - error1 = "DTEnd before DTStart. Setting DTEnd equal to DTStart"; - error2 = "Prompt value must be ON or OFF"; - error3 = "Cannot parse time/date string"; - error4 = "Recurrence rules are too complicated. Only the first instance was scheduled"; - error5 = "Invalid property value"; - error6 = "Invalid property name"; - error7 = "Invalid parameter name"; - -/* Don't forget What, When etc */ -} -#else -void -JulianFormFactory::init() -{ - do_capi_login = FALSE; /* Default is not to ask for capi login info */ - - if (jf->getCallbacks()->BoolPref) - (*jf->getCallbacks()->BoolPref)("calendar.capi.enabled", &do_capi_login); - - /* - ** char*'s - */ - if (cb && cb->GetString) - { - error_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_ERROR_HEADER)); - publish_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_PUBLISH_HEADER)); - publishFB_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_PUBLISHFB_HEADER)); - replyFB_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_REPLYFB_HEADER)); - request_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_REQUEST_HEADER)); - request_FB_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_REQUESTFB_HEADER)); - request_D_FB_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_REQUESTFB_HEADER)); - eventreply_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_EVENTREPLY_HEADER)); - eventcancel_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_EVENTCANCEL_HEADER)); - eventrefreshreg_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_EVENTREFRESHREG_HEADER)); - eventcounterprop_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_EVENTCOUNTERPROP_HEADER)); - eventdelinecounter_Header_HTML = XP_STRDUP((*cb->GetString)(JULIAN_STRING_EVENTDELINECOUNTER_HEADER)); - - String_What = XP_STRDUP((*cb->GetString)(JULIAN_STRING_WHAT)); - String_When = XP_STRDUP((*cb->GetString)(JULIAN_STRING_WHEN)); - String_Location = XP_STRDUP((*cb->GetString)(JULIAN_STRING_LOCATION)); - String_Organizer = XP_STRDUP((*cb->GetString)(JULIAN_STRING_ORGANIZER)); - String_Status = XP_STRDUP((*cb->GetString)(JULIAN_STRING_STATUS)); - String_Priority = XP_STRDUP((*cb->GetString)(JULIAN_STRING_PRIORITY)); - String_Categories = XP_STRDUP((*cb->GetString)(JULIAN_STRING_CATEGORIES)); - String_Resources = XP_STRDUP((*cb->GetString)(JULIAN_STRING_RESOURCES)); - String_Attachments = XP_STRDUP((*cb->GetString)(JULIAN_STRING_ATTACHMENTS)); - String_Alarms = XP_STRDUP((*cb->GetString)(JULIAN_STRING_ALARMS)); - String_Created = XP_STRDUP((*cb->GetString)(JULIAN_STRING_CREATED)); - String_Last_Modified = XP_STRDUP((*cb->GetString)(JULIAN_STRING_LAST_MODIFIED)); - String_Sent = XP_STRDUP((*cb->GetString)(JULIAN_STRING_SENT)); - String_UID = XP_STRDUP((*cb->GetString)(JULIAN_STRING_UID)); - } - - /* - ** JulianStrings - */ - FBT_Legend_Title.LoadString(JULIAN_FBT_LEGEND_TITLE); - FBT_Legend_Free.LoadString(JULIAN_FBT_LEGEND_FREE); - FBT_Legend_Busy.LoadString(JULIAN_FBT_LEGEND_BUSY); - FBT_Legend_Unknown.LoadString(JULIAN_FBT_LEGEND_UNKNOWN); - FBT_Legend_xparam.LoadString(JULIAN_FBT_LEGEND_XPARAM); - - FBT_AM.LoadString(JULIAN_FBT_AM); - FBT_PM.LoadString(JULIAN_FBT_PM); - - Buttons_Details_Label.LoadString(JULIAN_BUTTONS_DETAILS_LABEL); - Buttons_Add_Label.LoadString(JULIAN_BUTTONS_ADD_LABEL); - Buttons_Close_Label.LoadString(JULIAN_BUTTONS_CLOSE_LABEL); - Buttons_Accept_Label.LoadString(JULIAN_BUTTONS_ACCEPT_LABEL); - Buttons_AcceptAll_Label.LoadString(JULIAN_BUTTONS_ACCEPTALL_LABEL); - Buttons_Update_Label.LoadString(JULIAN_BUTTONS_UPDATE_LABEL); - Buttons_Decline_Label.LoadString(JULIAN_BUTTONS_DECLINE_LABEL); - Buttons_Tentative_Label.LoadString(JULIAN_BUTTONS_TENTATIVE_LABEL); - Buttons_SendFB_Label.LoadString(JULIAN_BUTTONS_SENDFB_LABEL); - Buttons_SendRefresh_Label.LoadString(JULIAN_BUTTONS_SEND_REFRESH_LABEL); - Buttons_DelTo_Label.LoadString(JULIAN_BUTTONS_DELTO_LABEL); - - /* - ** Status Messages - */ - EventInSchedule.LoadString(JULIAN_EVENT_IN_SCHEDULE); - EventNotInSchedule.LoadString(JULIAN_EVENT_NOT_IN_SCHEDULE); - EventConflict.LoadString(JULIAN_EVENT_CONFLICT); - EventNote.LoadString(JULIAN_NOTE); - EventError.LoadString(JULIAN_EVENT_ERROR); - EventTest.LoadString(JULIAN_EVENT_ERROR); - Text_To.LoadString(JULIAN_TEXT_TO); - Text_AllDay.LoadString(JULIAN_TEXT_ALL_DAY); - Text_StartOn.LoadString(JULIAN_TEXT_START_ON); - Text_Was.LoadString(JULIAN_TEXT_WAS); - - /* - ** Muilt Stuff - */ - MuiltEvent_Header_HTML.LoadString(JULIAN_MUILTEVENT_HEADER); - MuiltFB_Header_HTML.LoadString(JULIAN_MUILTFB_HEADER); - MuiltEvent.LoadString(JULIAN_MUILTEVENT); - WhenStr.LoadString(JULIAN_WHENSTR); - WhatStr.LoadString(JULIAN_WHATSTR); - SubjectSep.LoadString(JULIAN_SUBJECTSEP); - - /* - ** Error Strings - */ - MoreErrors.LoadString(JULIAN_MORE_ERRORS); - TooManyEvents.LoadString(JULIAN_TOO_MANY_EVENTS); - error0.LoadString(JULIAN_ERROR_O); - error1.LoadString(JULIAN_ERROR_1); - error2.LoadString(JULIAN_ERROR_2); - error3.LoadString(JULIAN_ERROR_3); - error4.LoadString(JULIAN_ERROR_4); - error5.LoadString(JULIAN_ERROR_5); - error6.LoadString(JULIAN_ERROR_6); - error7.LoadString(JULIAN_ERROR_7); -} -#endif diff --git a/mozilla/calendar/modules/core/htmlform/src/julianform.c b/mozilla/calendar/modules/core/htmlform/src/julianform.c deleted file mode 100644 index 53d14bfb9d8..00000000000 --- a/mozilla/calendar/modules/core/htmlform/src/julianform.c +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include -#include "jdefines.h" -#include "julianform.h" -#include "nlsloc.h" - -#ifdef XP_WIN32 -/*#include "stdafx.h"*/ -/*#include "feutil.h"*/ -#endif - -extern void* jform_CreateNewForm(char *, pJulian_Form_Callback_Struct, XP_Bool); -extern void jform_DeleteForm(void *); -extern char* jform_GetForm(void *); -extern void jform_CallBack(void *, void *); - -pJulian_Form_Callback_Struct JulianForm_CallBacks; -XP_Bool bCallbacksSet = PR_FALSE ; - -XP_Bool jf_Initialize(pJulian_Form_Callback_Struct callbacks) -{ - /* for some reason I have to do this little trick to get things to work */ - char * julian = NULL; - char buf[1024]; - julian = &(buf[0]); - - JulianForm_CallBacks = XP_NEW_ZAP(Julian_Form_Callback_Struct); - if (JulianForm_CallBacks && callbacks) - { - *JulianForm_CallBacks = *callbacks; - } - -#if defined(XP_WIN)||defined(XP_UNIX) - if (JulianForm_CallBacks && callbacks && callbacks->GetJulianPath) - { - bCallbacksSet = PR_TRUE ; - - /* set the NLS locale30 path to the location of the locale30 from the registry */ - JulianForm_CallBacks->GetJulianPath(&julian, (void *)sizeof(buf)); - - /* use path if it exist, otherwise you NS_NLS_DATADIRECTORY env var if it exists */ - /* if neither exists return FALSE */ - if (JXP_ACCESS(julian, 0) != -1) - { - NLS_Initialize(NULL, julian); - return TRUE; - } - else - { - char * nlsDDir = getenv("NS_NLS_DATADIRECTORY"); - if (nlsDDir == 0) - return FALSE; - else - { - if (JXP_ACCESS(nlsDDir, 0) == -1) - return FALSE; - else - return TRUE; - } - } - } -#endif - - return FALSE; -} - -void *jf_New(char *calendar_mime_data, XP_Bool bFoundNLSDataDirectory) -{ - return jform_CreateNewForm(calendar_mime_data, JulianForm_CallBacks, bFoundNLSDataDirectory); -} - -void jf_Destroy(void *instdata) -{ - jform_DeleteForm(instdata); -} - -void jf_Shutdown() -{ - XP_FREEIF(JulianForm_CallBacks); -} - -char *jf_getForm(void *instdata) -{ - return jform_GetForm(instdata); -} - -void jf_setDetail(int detail_form) -{ -} - -/* rhp - needed to add third parameter for other mime related calls */ -void jf_callback(void *instdata, char *url, URL_Struct *URL_s) -{ - if (instdata && url) - { - jform_CallBack(instdata, url); - } -} - -/* rhp - needed to add third parameter for other mime related calls */ -/* For some unknown reason there can only be one call back funtion/ -** instdate per button -*/ -void jf_detail_callback(void *instdata, char *url, URL_Struct *URL_s) -{ - if (instdata && url) - { - jform_CallBack(instdata, url); - } -} diff --git a/mozilla/calendar/modules/core/htmlform/src/manifest.mn b/mozilla/calendar/modules/core/htmlform/src/manifest.mn deleted file mode 100644 index b473fda27e9..00000000000 --- a/mozilla/calendar/modules/core/htmlform/src/manifest.mn +++ /dev/null @@ -1,30 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CSRCS = \ - julianform.c \ - $(NULL) - -CPPSRCS = \ - form.cpp \ - formFactory.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls netlib shell xpfc - diff --git a/mozilla/calendar/modules/core/ical/Makefile b/mozilla/calendar/modules/core/ical/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/ical/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/ical/inc/Makefile b/mozilla/calendar/modules/core/ical/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/ical/inc/abprprty.h b/mozilla/calendar/modules/core/ical/inc/abprprty.h deleted file mode 100644 index b76e49aa1e6..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/abprprty.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; tabs-indent-mode: nil -*- */ -/* - * abprprty.h - * John Sun - * 2/18/98 10:29:50 AM - */ - -#include -#include "ptrarray.h" -#include "xp_mcom.h" - -#ifndef __ABSTRACTPROPERTY_H_ -#define __ABSTRACTPROPERTY_H_ - -/* pure interface */ -class AbstractProperty -{ - virtual void * getValue() const { PR_ASSERT(FALSE); return 0;} - virtual void setValue(void * value) { if (value != 0) {} PR_ASSERT(FALSE); } - - virtual ICalProperty * clone() { PR_ASSERT(FALSE); return 0; } - virtual t_bool isValid() { PR_ASSERT(FALSE); return FALSE; } - - /* return human readable string */ - virtual UnicodeString & toString(UnicodeString & out) { PR_ASSERT(FALSE); return out; } - virtual UnicodeString & toString(UnicodeString & dateFmt, - UnicodeString & out) { PR_ASSERT(FALSE); if (dateFmt.size() > 0) {} return out; } - /* ical format of value */ - virtual UnicodeString & toExportString(UnicodeString & out) { PR_ASSERT(FALSE); return out; } -}; - -#endif /* __ABSTRACTPROPERTY_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/attendee.h b/mozilla/calendar/modules/core/ical/inc/attendee.h deleted file mode 100644 index 915a6705e9a..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/attendee.h +++ /dev/null @@ -1,761 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * attendee.h - * John Sun - * 2/6/98 4:33:43 PM - */ - -#ifndef __ATTENDEE_H_ -#define __ATTENDEE_H_ - -#include "ptrarray.h" -#include "icalcomp.h" -#include "prprty.h" -#include "jlog.h" -#include "datetime.h" -#include "nscalcoreicalexp.h" - -/** - * The Attendee class encapsulates the data in the iCalendar - * ATTENDEE property. This class must implement the interface defined - * by the ICalProperty abstract class. The keyword parameters in Attendee - * are stored as t_int32. Other parameters are stored as UnicodeStrings - * or as JulianPtrArray's of UnicodeStrings. - */ -class NS_CAL_CORE_ICAL Attendee : public ICalProperty -{ -private: - - /** - * For now, hide default constructor. - * Currently must pass in a Log object to create an Attendee. - */ - Attendee(); - - -public: - - /* enums of attendee keywords */ - /** Enumeration of ROLE parameter*/ - enum ROLE { - /*ROLE_ATTENDEE = 0, ROLE_ORGANIZER = 1, ROLE_OWNER = 2, - ROLE_DELEGATE = 3, ROLE_LENGTH = 4, - - ROLE_CHAIR = 0, ROLE_PARTICIPANT = 1, ROLE_NON_PARTICIPANT = 2, - ROLE_LENGTH = 3, ROLE_INVALID = -1*/ - - ROLE_REQ_PARTICIPANT = 0, ROLE_CHAIR = 1, ROLE_OPT_PARTICIPANT = 2, - ROLE_NON_PARTICIPANT = 3, - ROLE_XPARAMVAL = 4, ROLE_LENGTH = 5, ROLE_INVALID = -1 - }; - - /** Enumeration of CUTYPE parameter*/ - enum TYPE { - TYPE_INDIVIDUAL = 0, TYPE_GROUP = 1, - TYPE_RESOURCE = 2, TYPE_ROOM = 3, TYPE_UNKNOWN = 4, - TYPE_XPARAMVAL = 5, - TYPE_LENGTH = 6, TYPE_INVALID = -1 - }; - - /** Enumeration of PARTSTAT parameter*/ - enum STATUS { - /* For VEVENT, VTODO, VJOURNAL */ - STATUS_NEEDSACTION = 0, STATUS_XPARAMVAL = 1, - STATUS_ACCEPTED = 2, STATUS_DECLINED = 3, - - /* For VEVENT and VTODO only */ - STATUS_TENTATIVE = 4, - STATUS_DELEGATED = 5, - - /* For VTODO only */ - STATUS_COMPLETED = 6, STATUS_INPROCESS = 7, - - - STATUS_LENGTH = 8, STATUS_INVALID = -1 - }; - - /** - * Is the status variable valid for this component type. For example, - * if compType is VEVENT and status is INPROCESS, return FALSE. - * But if compType is VTODO and status is INPROCESS, return TRUE. - * @param compType component type - * @param status status - * - * @return TRUE if valid status for compType, FALSE otherwise - */ - static t_bool isValidStatus(ICalComponent::ICAL_COMPONENT compType, Attendee::STATUS status); - - /** Enumeration of RSVP parameter */ - enum RSVP { - RSVP_FALSE = 0, RSVP_TRUE = 1, - RSVP_LENGTH = 2, RSVP_INVALID = -1 - }; - - /** Enumeration of EXPECT parameter */ - enum EXPECT { - EXPECT_FYI = 0, EXPECT_REQUIRE = 1, EXPECT_REQUEST = 2, - /*EXPECT_IMMEDIATE = 3, EXPECT_LENGTH = 4, */ - EXPECT_LENGTH = 3, EXPECT_INVALID = -1 - }; - - - /** Enumeration of all keyword properties in an Attendee */ - enum PROPS { - PROPS_ROLE = 0, PROPS_TYPE = 1, - PROPS_STATUS = 2, PROPS_RSVP = 3, - PROPS_EXPECT = 4 - }; - - /** - * Converts ROLE string to a ROLE enumeration - * @param sRole role string - * - * @return ROLE that represents that string - */ - static Attendee::ROLE stringToRole(UnicodeString & sRole); - - /** - * Converts CUTYPE string to a TYPE enumeration - * @param sType type string - * - * @return TYPE that represents that string - */ - static Attendee::TYPE stringToType(UnicodeString & sType); - - /** - * Converts PARTSTAT string to a AT_PARSTAT enumeration - * @param sStatus status string - * - * @return STATUS that represents that string - */ - static Attendee::STATUS stringToStatus(UnicodeString & sStatus); - - /** - * Converts RSVP string to a RSVP enumeration - * @param sRSVP rsvp string - * - * @return RSVP that represents that string - */ - static Attendee::RSVP stringToRSVP(UnicodeString & sRSVP); - - /** - * Converts EXPECT string to a EXPECT enumeration - * @param sExpect expect string - * - * @return EXPECT that represents that string - */ - static Attendee::EXPECT stringToExpect(UnicodeString & sExpect); - - /** - * Converts ROLE to string. If bad role, return default (REQ_PARTICIPANT). - * @param role ROLE enumeration - * @param out output role string - * - * @return output role string (out) - */ - static UnicodeString & roleToString(Attendee::ROLE role, UnicodeString & out); - - /** - * Converts TYPE to string. If bad type, return default (INDIVIDUAL). - * @param type TYPE enumeration - * @param out output type string - * - * @return output type string (out) - */ - static UnicodeString & typeToString(Attendee::TYPE type, UnicodeString & out); - - /** - * Converts STATUS to string. If bad status, return default (NEEDS-ACTION). - * @param status STATUS enumeration - * @param out output partstat string - * - * @return output partstat string (out) - */ - static UnicodeString & statusToString(Attendee::STATUS status, UnicodeString & out); - - - /** - * Converts RSVP to string. If bad rsvp, return default (FALSE). - * @param rsvp RSVP enumeration - * @param out output rsvp string - * - * @return output rsvp string (out) - */ - static UnicodeString & rsvpToString(Attendee::RSVP rsvp, UnicodeString & out); - - /** - * Converts EXPECT to string. If bad expect, return default (FYI). - * @param expect EXPECT enumeration - * @param out output expect string - * - * @return output expect string (out) - */ - static UnicodeString & expectToString(Attendee::EXPECT expect, UnicodeString & out); - - /** - * Constructor. Also sets log file to write errors to. - * @param ICalComponent::ICAL_COMPONENT componentType - * @param initLog log file to write errors to - */ - Attendee(ICalComponent::ICAL_COMPONENT componentType, JLog * initLog = 0); - - /** - * Destructor - */ - ~Attendee(); - - /** - * Factory method that returns a new default Attendee - * - * @return static Attendee * - */ - static Attendee * getDefault(ICalComponent::ICAL_COMPONENT compType, - JLog * initLog = 0); - - /** - * Given attendee name and parameters, populates Attendee - * data members. - * @param propVal attendee name - * @param parameters attendee parameters - * - */ - void parse(UnicodeString & propVal, JulianPtrArray * parameters = 0); - - /** - * Sets parameter with name paramName with value paramVal. - * For MEMBER, DELEGATED-TO, DELEGATED-FROM, DIR, SENT-BY, the - * double quotes are stripped. THE MAILTO: is not stripped. - * - * @param paramName parameter name to set - * @param paramVal new value of parameter - */ - void setParam(UnicodeString & paramName, UnicodeString & paramVal); - - /** - * convert a character to the content of a parameter in - * human-readable string format - * - * @param c a character represents a parameter - * @return parameter in a human-readable string - */ - UnicodeString toStringChar(t_int32 c); - - - /** - * Return the first attendee in vAttendees with the name matching sAttendee. - * @param vAttendees vector of attendees - * @param sAttendee attendee name to look for - * - * @return first Attendee with name sAttendee, 0 if not found. - */ - static Attendee * getAttendee(JulianPtrArray * vAttendees, UnicodeString sAttendee); - - /*---------- To satisfy ICalProperty interface ----------*/ - /** - * Sets parameters. - * @param parameters vector of parameters to set - * - */ - virtual void setParameters(JulianPtrArray * parameters); - - /** - * Return value of property. Never use. Use getName(). - * - * @return value of property - */ - virtual void * getValue() const { PR_ASSERT(FALSE); return (void*) (&m_sName); } - - /** - * Sets value of property. Never use. Use setName(). - * @param value new value of property - * - */ - virtual void setValue(void * value) { PR_ASSERT(FALSE); if (value) {}} ; - - /** - * Returns a clone of this property. - * @param initLog the log file for clone to write to - * - * @return clone of this ICalProperty object - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Checks whether this property is valid or not. Must have MAILTO: in - * front of attendee name to be valid. - * - * @return TRUE if property is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return property to human-readable string. - * @param dateFmt formatting string - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & strFmt, UnicodeString & out); - - /** - * Return property to human-readable string. - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return property to iCal property string. - * @param out output iCal string - * - * @return output iCal string (out) - */ - virtual UnicodeString & toICALString(UnicodeString & out); - - /** - * Return property to iCal property string. Inserts sProp to - * front of output string. sProp should be the property name of this - * property. - * @param sProp property name to append to insert at front of out - * @param out output iCal string with sProp in front - * - * @return output iCal string with sProp in front (out) - */ - virtual UnicodeString & toICALString(UnicodeString & sProp, UnicodeString & out); - /*----------End of ICalProperty interface----------*/ - - /* ---- GETTERS AND SETTERS ---- */ - - /** - * Sets Attendee name. - * @param sName new Attendee name - * - */ - void setName(UnicodeString sName); - - /** - * Returns Attendee name. - * - * @return Attendee name - */ - UnicodeString getName() const { return m_sName; } - - /** - * Sets ROLE. - * @param i new ROLE value - * - */ - void setRole(Attendee::ROLE i) { m_iRole = i; } - - /** - * Sets TYPE. - * @param i new TYPE value - * - */ - void setType(Attendee::TYPE i) { m_iType = i; } - - /** - * Sets STATUS. - * @param i new STATUS value - * - */ - void setStatus(Attendee::STATUS i) { m_iStatus = i; } - - /** - * Sets RSVP. - * @param i new RSVP value - * - */ - void setRSVP(Attendee::RSVP i) { m_iRSVP = i; } - - /** - * Sets EXPECT. - * @param i new EXPECT value - * - */ - void setExpect(Attendee::EXPECT i) { m_iExpect = i; } - - /** - * Returns ROLE value. - * - * @return ROLE value - */ - Attendee::ROLE getRole() const { return (Attendee::ROLE) m_iRole; } - - /** - * Returns TYPE value. - * - * @return TYPE value - */ - Attendee::TYPE getType() const { return (Attendee::TYPE) m_iType; } - - /** - * Returns STATUS value. - * - * @return STATUS value - */ - Attendee::STATUS getStatus() const { return (Attendee::STATUS) m_iStatus; } - - /** - * Returns RSVP value. - * - * @return RSVP value - */ - Attendee::RSVP getRSVP() const { return (Attendee::RSVP) m_iRSVP; } - - /** - * Returns EXPECT value. - * - * @return EXPECT value - */ - Attendee::EXPECT getExpect() const { return (Attendee::EXPECT) m_iExpect; } - - /** - * Add a name to the Delegated-To vector. - * @param sDelegatedTo name to add to delegated-to vector - */ - void addDelegatedTo(UnicodeString sDelegatedTo); - - /** - * Add a name to the Delegated-From vector. - * @param sDelegatedFrom name to add to delegated-from vector - */ - void addDelegatedFrom(UnicodeString sDelegatedFrom); - - /** - * Add a name to the Member vector. - * @param sMember name to add to member vector - */ - void addMember(UnicodeString sMember); - - /** - * Return ptr to Delegated-To vector - * - * @return Delegated-To vector - */ - JulianPtrArray * getDelegatedTo() const { return m_vsDelegatedTo; } - - /** - * Return ptr to Delegated-From vector - * - * @return Delegated-From vector - */ - JulianPtrArray * getDelegatedFrom() const { return m_vsDelegatedFrom; } - - /** - * Return ptr to Member vector - * - * @return Member vector - */ - JulianPtrArray * getMember() const { return m_vsMember; } - - /** - * Return CN (common-name) value - * - * @return CN value - */ - UnicodeString getCN() const { return m_CN; } - - /** - * Return Language value - * - * @return Language value - */ - UnicodeString getLanguage() const { return m_Language; } - - /** - * Return DIR (location of directory info) value - * - * @return DIR value - */ - UnicodeString getDir() const { return m_Dir; } - - /** - * Return SENT-BY (calendar user acting on behalf of the attendee) value - * - * @return SENT-BY value - */ - UnicodeString getSentBy() const { return m_SentBy; } - - /** - * Set CN (common-name) value - * @param new CN value - */ - void setCN(UnicodeString u) { m_CN = u; } - - /** - * Set Language value - * @param new Language value - */ - void setLanguage(UnicodeString u) { m_Language = u; } - - /** - * Set DIR (location of directory info) value - * @param new DIR value - */ - void setDir(UnicodeString u) { m_Dir = u; } - - /** - * Set SENT-BY (calendar user acting on behalf of the attendee) value - * @param new SENT-BY value - */ - void setSentBy(UnicodeString u) { m_SentBy = u; } - - void setDTStamp(DateTime d) { m_DTStamp = d; } - void setSequence(t_int32 i) { m_Sequence = i; } - - /* list the default values for properties - (always to 0th element of enumeration) */ - - /** the default ROLE value */ - static const t_int32 ms_iDEFAULT_ROLE; - - /** the default TYPE value */ - static const t_int32 ms_iDEFAULT_TYPE; - - /** the default STATUS value */ - static const t_int32 ms_iDEFAULT_STATUS; - - /** the default RSVP value */ - static const t_int32 ms_iDEFAULT_RSVP; - - /** the default EXPECT value*/ - static const t_int32 ms_iDEFAULT_EXPECT; - - /* ---- END OF PUBLIC STATIC DATA ---- */ -private: - - /** - * Copy constructor - * @param Attendee & that - */ - Attendee(Attendee & that); - - /** - * Fixes data-members are so that they are valid. If properties - * are invalid, then it will set it to defaults. - */ - void selfCheck(); - - /** - * Fixes keyword property so that it is valid. If property is - * invalid (param is out of range), then set property to default value. - * @param prop keyword property to check - * @param t_int32 param current value of keyword property - */ - void selfCheckHelper(Attendee::PROPS prop, t_int32 param); - - /** - * helper in parsing delegated-to, delegated-from, member - */ - void addParamValList(UnicodeString & paramValList, - t_int32 hashCode); - - /** - * format string to print Attendee with PARTSTAT NOT - * set to NEEDS-ACTION. - * @return output formatted iCal Attendee string - */ - UnicodeString formatDoneAction(); - -#if 0 - /** - * format string to print Attendee with PARTSTAT NOT - * set to NEEDS-ACTION and Delegated-To of attendee. - * @return output formatted iCal Attendee string - */ - UnicodeString formatDoneDelegateToOnly(); - - /** - * format string to print Attendee with PARTSTAT NOT - * set to NEEDS-ACTION and Delegated-From of attendee. - * @return output formatted iCal Attendee string - */ - UnicodeString formatDoneDelegateFromOnly(); -#endif - - /* BELOW METHODS ALL ARE NEEDS ACTION */ - /* no need for %S, assumed to be NEEDS-ACTION */ - - /** - * format string to print Attendee with PARTSTAT - * set to NEEDS-ACTION. - * @return output formatted iCal Attendee string - */ - UnicodeString formatNeedsAction(); - -#if 0 - /** - * format string to print Attendee with PARTSTAT - * set to NEEDS-ACTION and Delegated-To of attendee. - * @return output formatted iCal Attendee string - */ - UnicodeString formatDelegateToOnly(); - - /** - * format string to print Attendee with PARTSTAT - * set to NEEDS-ACTION and Delegated-From of attendee. - * @return output formatted iCal Attendee string - */ - UnicodeString formatDelegateFromOnly(); -#endif - - /** - * Method that takes a format string and returns - * the correctly formatted iCal Attendee string - * @param strFmt format string - * - * @return output formatted iCal Attendee string - */ - UnicodeString format(UnicodeString strFmt); - - /** - * Method that takes a character and returns parameter - * in iCal output format. - * @param c character representing parameter to print - * - * @return parameter in iCal output format - */ - UnicodeString formatChar(t_int32 c); - - /** - * Strip double quotest from the beginning and end of string - * if it has double-quotes at beginning and end. - * @param u string to strip double-quotes from - */ - /*static void stripDoubleQuotes(UnicodeString & u);*/ - - /** - * Inserts double quotes at start and end of string if - * string != "". - * @param us string to add double-quotes to - * - * @return string with double-quotes at start, end (us) - */ - /*static UnicodeString & addDoubleQuotes(UnicodeString & us);*/ - - /** - * Prints each element in a vector of MAILTO:'s - * (i.e. member,delegated-to,delegated-from). - * @param propName name of property (i.e. MEMBER) - * @param mailto vector of MAILTO: to print - * @param out output string - * - * @return output string (out) - */ - UnicodeString & printMailToVector(UnicodeString & propName, - JulianPtrArray * mailto, UnicodeString & out); - - /* ---- PRIVATE STATIC DATA ---- */ - - /* characters for printing Attendee parameters */ - static const t_int32 ms_cAttendeeName;/* = 'N';*/ - static const t_int32 ms_cAttendeeRole;/* = 'R';*/ - static const t_int32 ms_cAttendeeStatus;/* = 'S';*/ - static const t_int32 ms_cAttendeeRSVP;/* = 'V';*/ - static const t_int32 ms_cAttendeeType;/* = 'T';*/ - static const t_int32 ms_cAttendeeExpect;/* = 'E';*/ - static const t_int32 ms_cAttendeeDelegatedTo;/* = 'D';*/ - static const t_int32 ms_cAttendeeDelegatedFrom;/* = 'd';*/ - static const t_int32 ms_cAttendeeMember;/* = 'M';*/ - static const t_int32 ms_cAttendeeDir; /* = 'l'; 'el'*/ - static const t_int32 ms_cAttendeeSentBy;/* = 's';*/ - static const t_int32 ms_cAttendeeCN;/* = 'C';*/ - static const t_int32 ms_cAttendeeLanguage;/* = 'm';*/ - static const t_int32 ms_cAttendeeDisplayName;/* = 'z';*/ - - /* ---- END OF PRIVATE STATIC DATA ---- */ - - /* ---- PRIVATE DATA MEMBERS ---- */ - - /** - * the name of the Attendee. Whatever is to the right of the colon - * the name must be a URL. Field must be filled to be valid Attendee. - */ - UnicodeString m_sName; - - /** ptr to log file to write errors to */ - JLog * m_Log; - - /** the attendee's role value. Default is REQ_PARTICIPANT. */ - t_int32 m_iRole; - - /** the attendee's type value. Default is INDIVIDUAL. */ - t_int32 m_iType; - - /** the attendee's status value. Default is NEEDS-ACTION. */ - t_int32 m_iStatus; - - /** the attendee's RSVP value. Default is FALSE. */ - t_int32 m_iRSVP; - - /** the attendee's expect value. Default is FYI.*/ - t_int32 m_iExpect; - - /** - * the list of members the attendee belongs to - * each element in members must be a MAILTO: - */ - JulianPtrArray * m_vsMember; - - /** - * the list of delegated-to attendees. - * each element in delegated-to must be a MAILTO: - */ - JulianPtrArray * m_vsDelegatedTo; - - /** - * the list of delegated-from attendees. - * each element in delegated-from must be a MAILTO: - */ - JulianPtrArray * m_vsDelegatedFrom; - - /* added newer properties 3-23-98 */ - - /** the common name of attendee. Optional, default is "". */ - UnicodeString m_CN; - - /** the language of the common name of the attendee. Optional, default is "". */ - UnicodeString m_Language; - - /** the MAILTO: of a calendar user acting on behalf of the attendee. - * Optional, default is "". - */ - UnicodeString m_SentBy; - - /** the location of the Attendee's directory information. - * Optional, default is "". */ - UnicodeString m_Dir; - - /** the type of the attendee status: STATUS depends on this */ - ICalComponent::ICAL_COMPONENT m_ComponentType; - - DateTime m_DTStamp; - t_int32 m_Sequence; - - /* ---- END OF DATA MEMBERS ---- */ -}; - -#endif /* __ATTENDEE_H_ */ diff --git a/mozilla/calendar/modules/core/ical/inc/bprprty.h b/mozilla/calendar/modules/core/ical/inc/bprprty.h deleted file mode 100644 index ee12f60f28f..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/bprprty.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * bprprty.h - * John Sun - * 2/12/98 3:31:14 PM - */ - -#include -#include "sdprprty.h" - -#ifndef __BOOLEANPROPERTY_H_ -#define __BOOLEANPROPERTY_H_ - -/** - * BooleanProperty is a subclass of StandardProperty. It implements the ICalProperty - * interface for ICAL properties with TYPE=BOOLEAN. - */ -class BooleanProperty: public StandardProperty -{ -private: - /** the boolean value of property */ - t_bool m_Boolean; - - /** - * Default constructor - */ - BooleanProperty(); - - /** - * Copy constructor - * @param that property to copy - */ - BooleanProperty(const BooleanProperty & that); -public: - - /** - * Constructor that sets value of property to contents of value - * and makes a copy of the contents of parameters ptr. - * @param value value of property - * @param parameters parameters of property - */ - BooleanProperty(t_bool value, JulianPtrArray * parameters); - - /** - * Destructor - */ - ~BooleanProperty(); - - /** - * Return the value of the property - * @return void * ptr to value of the property - */ - virtual void * getValue() const; - - /** - * Set the value of the property - * @param value the value to set property to - */ - virtual void setValue(void * value); - - /** - * Returns a clone of this property. Clients are responsible for deleting - * the returned object. - * - * @return a clone of this property. - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Return TRUE if property is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return a string in human-readable form of the property. - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return a string in human-readable form of the property. - * @param dateFmt format string options - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out); - - /** - * Return the property's string in the ICAL format. - * @param out contains output ICAL string - * - * @return the property in its ICAL string format - */ - virtual UnicodeString & toExportString(UnicodeString & out); -}; - -#endif /* __BOOLEANPROPERTY_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/bydmgntr.h b/mozilla/calendar/modules/core/ical/inc/bydmgntr.h deleted file mode 100644 index ae5569e9213..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/bydmgntr.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * bydmgntr.h - * John Sun - * 2/3/98 3:06:20 PM - */ - -#ifndef __BYDAYMONTHLYGENERATOR_H_ -#define __BYDAYMONTHLYGENERATOR_H_ - -#include "dategntr.h" -#include "rrday.h" - -/** - * The ByDayMonthlyGenerator class generates dates for the - * BYDAY tag w/ a MONTHLY frequency. - * - * @see DateGenerator - */ -class ByDayMonthlyGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - ByDayMonthlyGenerator(); - - /** - * Destructor - */ - ~ByDayMonthlyGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (DAILY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, - JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the week start parameter. - * @param param the week start value - */ - virtual void setParams(t_int32 param) { m_iWkSt = param; } - - /** - * Sets the RRDay parameters. - * @param params[] the list of RRDay to set to - * @param length the length of params[] - * @see RRDay - */ - virtual void setRDay(RRDay params[], t_int32 length) - { - m_aiParams = params; - m_iParamsLen = length; - } - - /** - * Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if parameters set, FALSE otherwise. - */ - virtual t_bool active() { return (m_aiParams != 0); } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** - * ptr to array of RRDay objects - * @see RRDay - */ - RRDay * m_aiParams; - - /** - * week start value - * @see Calendar - */ - t_int32 m_iWkSt; - -}; - -#endif /* __BYDAYMONTHLYGENERATOR_H_ */ - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/bydwgntr.h b/mozilla/calendar/modules/core/ical/inc/bydwgntr.h deleted file mode 100644 index 5117849e504..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/bydwgntr.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * bydwgntr.h - * John Sun - * 2/3/98 3:00:42 PM - */ - -#ifndef __BYDAYWEEKLYGENERATOR_H_ -#define __BYDAYWEEKLYGENERATOR_H_ - -#include "dategntr.h" -#include "rrday.h" - -/** - * The ByDayWeeklyGenerator class generates dates for the - * BYDAY tag w/ a Weekly frequency. - * - * @see DateGenerator - */ -class ByDayWeeklyGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - ByDayWeeklyGenerator(); - - /** - * Destructor - */ - ~ByDayWeeklyGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (DAILY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the week start parameter. - * @param param the week start value - */ - virtual void setParams(t_int32 param) { m_iWkSt = param; } - - /** - * Sets the RRDay parameters. - * @param params[] the list of RRDay to set to - * @param length the length of params[] - * @see RRDay - */ - virtual void setRDay(RRDay params[], t_int32 length) - { - m_aiParams = params; - m_iParamsLen = length; - } - - /** - * Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if parameters set, FALSE otherwise. - */ - virtual t_bool active() { return (m_aiParams != 0); } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** - * ptr to array of RRDay objects - * @see RRDay - */ - RRDay * m_aiParams; - - /** - * week start value - * @see Calendar - */ - t_int32 m_iWkSt; - -}; - -#endif /* __BYDAYWEEKLYGENERATOR_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/bydygntr.h b/mozilla/calendar/modules/core/ical/inc/bydygntr.h deleted file mode 100644 index dad684044d2..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/bydygntr.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * bydygntr.h - * John Sun - * 2/3/98 3:10:39 PM - */ - -#ifndef __BYDAYYEARLYGENERATOR_H_ -#define __BYDAYYEARLYGENERATOR_H_ - -#include "dategntr.h" -#include "rrday.h" - - /** - * The ByDayYearlyGenerator class generates dates for the - * BYDAY tag w/ a YEARLY frequency. - * - * @see DateGenerator - */ -class ByDayYearlyGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - ByDayYearlyGenerator(); - - /** - * Destructor - */ - ~ByDayYearlyGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (DAILY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the week start parameter. - * @param param the week start value - */ - void setParams(t_int32 param) { m_iWkSt = param; } - - /** - * Sets the RRDay parameters. - * @param params[] the list of RRDay to set to - * @param length the length of params[] - * @see RRDay - */ - virtual void setRDay(RRDay params[], t_int32 length) - { - m_aiParams = params; - m_iParamsLen = length; - } - - /** - * Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if parameters set, FALSE otherwise. - */ - virtual t_bool active() { return (m_aiParams != 0); } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** - * ptr to array of RRDay objects - * @see RRDay - */ - RRDay * m_aiParams; - - /** - * week start value - * @see Calendar - */ - t_int32 m_iWkSt; -}; - -#endif /* __BYDAYYEARLYGENERATOR_H_ */ diff --git a/mozilla/calendar/modules/core/ical/inc/byhgntr.h b/mozilla/calendar/modules/core/ical/inc/byhgntr.h deleted file mode 100644 index 755ac5bf167..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/byhgntr.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * byhgntr.h - * John Sun - * 2/3/98 3:13:16 PM - */ - -#ifndef __BYHOURGENERATOR_H_ -#define __BYHOURGENERATOR_H_ - -#include "dategntr.h" - -/** - * The ByHourGenerator class generates dates for the BYHOUR tag. - * - * @see DateGenerator - */ -class ByHourGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - ByHourGenerator(); - - /** - * Destructor - */ - ~ByHourGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (HOURLY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the hour (i.e. -23 - +23) parameters. - * @param params[] the list of hours to set to - * @param length the length of params[] - */ - virtual void setParamsArray(t_int32 params[], t_int32 length) - { - m_aiParams = params; - m_iParamsLen = length; - } - - /** - * Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if parameters set, FALSE otherwise. - */ - virtual t_bool active() - { - return (m_aiParams != 0); - } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** hour parameters */ - t_int32 * m_aiParams; -}; - -#endif /* __BYHOURGENERATOR_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/bymdgntr.h b/mozilla/calendar/modules/core/ical/inc/bymdgntr.h deleted file mode 100644 index 0846d94c9f3..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/bymdgntr.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * bymdgntr.h - * John Sun - * 2/3/98 3:19:58 PM - */ - -#ifndef __BYMONTHDAYGENERATOR_H_ -#define __BYMONTHDAYGENERATOR_H_ - -#include "dategntr.h" - -/** - * The ByMonthDayGenerator class generates dates for the BYMONTHDAY tag. - * - * @see DateGenerator - */ -class ByMonthDayGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - ByMonthDayGenerator(); - - /** - * Destructor - */ - ~ByMonthDayGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (DAILY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the dates in month (i.e. -31 - +31) parameters. - * @param params[] the list of dates in month to set to - * @param length the length of params[] - */ - virtual void setParamsArray(t_int32 params[], t_int32 length) - { - m_aiParams = params; - m_iParamsLen = length; - } - - /** - * Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if parameters set, FALSE otherwise. - */ - virtual t_bool active() { return (m_aiParams != 0); } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** dates in month parameters */ - t_int32 * m_aiParams; - -}; - -#endif /* __BYMONTHDAYGENERATOR_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/bymgntr.h b/mozilla/calendar/modules/core/ical/inc/bymgntr.h deleted file mode 100644 index 9b05ec21ccf..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/bymgntr.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * bymgntr.h - * John Sun - * 2/3/98 2:59:55 PM - */ - -#ifndef __BYMINUTEGENERATOR_H_ -#define __BYMINUTEGENERATOR_H_ - -#include "dategntr.h" - -/** - * The ByMinuteGenerator class generates dates for the BYMINUTE tag. - * - * @see DateGenerator - */ -class ByMinuteGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - ByMinuteGenerator(); - - /** - * Destructor - */ - ~ByMinuteGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (MINUTELY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the minute (i.e. -59 - +59) parameters. - * @param params[] the list of minutes to set to - * @param length the length of params[] - */ - virtual void setParamsArray(t_int32 params[], t_int32 length) - { - m_aiParams = params; - m_iParamsLen = length; - } - - /** - * Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if parameters set, FALSE otherwise. - */ - virtual t_bool active() { return (m_aiParams != 0); } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** minute parameters */ - t_int32 * m_aiParams; -}; - -#endif /* __BYMINUTEGENERATOR_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/bymogntr.h b/mozilla/calendar/modules/core/ical/inc/bymogntr.h deleted file mode 100644 index 8c3a5a5cc6b..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/bymogntr.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * bymogntr.h - * John Sun - * 2/3/98 3:19:43 PM - */ - -#ifndef __BYMONTHGENERATOR_H_ -#define __BYMONTHGENERATOR_H_ - -#include "dategntr.h" - -/** - * The ByMonthGenerator class generates dates for the BYMONTH tag. - * - * @see DateGenerator - */ -class ByMonthGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - ByMonthGenerator(); - - /** - * Destructor - */ - ~ByMonthGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (MONTHLY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the month (i.e. -12 - +12) parameters. - * @param params[] the list of months to set to - * @param length the length of params[] - */ - virtual void setParamsArray(t_int32 params[], t_int32 length) - { - m_aiParams = params; - m_iParamsLen = length; - } - - /** - * Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if parameters set, FALSE otherwise. - */ - virtual t_bool active() { return (m_aiParams != 0); } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** month parameters */ - t_int32 * m_aiParams; - -}; - -#endif /* __BYMONTHGENERATOR_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/bywngntr.h b/mozilla/calendar/modules/core/ical/inc/bywngntr.h deleted file mode 100644 index c7055c6ec47..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/bywngntr.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * bywngntr.h - * John Sun - * 2/3/98 3:19:13 PM - */ - -#ifndef __BYWEEKNOGENERATOR_H_ -#define __BYWEEKNOGENERATOR_H_ - -#include "dategntr.h" - -/** - * The ByWeekNoGenerator class generates dates for the BYWEEKNO tag. - * - * @see DateGenerator - */ -class ByWeekNoGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - ByWeekNoGenerator(); - - /** - * Destructor - */ - ~ByWeekNoGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (WEEKLY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the week number (i.e. -53 - +53) parameters. - * @param params[] the list of weeks to set to - * @param length the length of params[] - */ - virtual void setParamsArray(t_int32 params[], t_int32 length) - { - m_aiParams = params; - m_iParamsLen = length; - } - - /** - * Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if parameters set, FALSE otherwise. - */ - virtual t_bool active() { return (m_aiParams != 0); } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** week parameters */ - t_int32 * m_aiParams; -}; - -#endif /* __BYWEEKNOGENERATOR_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/byydgntr.h b/mozilla/calendar/modules/core/ical/inc/byydgntr.h deleted file mode 100644 index dc932801628..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/byydgntr.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * byydgntr.h - * John Sun - * 2/3/98 3:41:44 PM - */ - -#ifndef __BYYEARDAYGENERATOR_H_ -#define __BYYEARDAYGENERATOR_H_ - -#include "dategntr.h" - -/** - * The ByYearDayGenerator class generates dates for the BYYEARDAY tag. - * - * @see DateGenerator - */ -class ByYearDayGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - ByYearDayGenerator(); - - /** - * Destructor - */ - ~ByYearDayGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (DAILY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the dates in year (i.e. -366 - +366) parameters. - * @param params[] the list of dates in year to set to - * @param length the length of params[] - */ - virtual void setParamsArray(t_int32 params[], t_int32 length) - { - m_aiParams = params; - m_iParamsLen = length; - } - - /** - * Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if parameters set, FALSE otherwise. - */ - virtual t_bool active() { return (m_aiParams != 0); } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** dates in year parameters */ - t_int32 * m_aiParams; - -}; - -#endif /* __BYYEARDAYGENERATOR_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/capiredr.h b/mozilla/calendar/modules/core/ical/inc/capiredr.h deleted file mode 100644 index 4381fe7db2b..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/capiredr.h +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * capiredr.h - * John Sun - * 4/16/98 3:31:51 PM - */ -#ifndef __ICALCAPIREADER_H_ -#define __ICALCAPIREADER_H_ - -/*#ifdef XP_WIN -#ifndef CAPI_READY -#define CAPI_READY -#endif -#endif*/ - -#include "jdefines.h" -#include -#include "ptrarray.h" -#include "icalredr.h" -#include "prmon.h" -#include "jutility.h" -/** - * ICalCAPIReader is a subclass of ICalReader. It implements - * the ICalReader interface to work with CAPI callback method - * to parse from stream. - * Uses multiple threads. - */ -class ICalCAPIReader -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - /* current buffer of iCal information, - * when CAPI has information to return to - * the buffer, it must append to this buffer - * when no more full-lines can be made from the - * buffer, block on the monitor. Will be - * notified when CAPI gets back more information - */ - char * m_Buffer; - t_int32 m_BufferSize; - t_bool m_Init; - t_int32 m_Mark; - t_int32 m_ChunkMark; - t_int32 m_Pos; - t_int32 m_ChunkIndex; - - /** encoding of stream */ - nsCalUtility::MimeEncoding m_Encoding; - - JulianPtrArray * m_Chunks; - - static const t_int32 m_MAXBUFFERSIZE; - static const t_int32 m_NOMORECHUNKS; - - /* finished getting input from CAPI callback */ - t_bool m_bFinished; - - PRMonitor * m_Monitor; - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - - UnicodeString & createLine(t_int32 oldPos, t_int32 oldChunkIndex, - t_int32 newPos, t_int32 newChunkIndex, UnicodeString & aLine); - - static void deleteUnicodeStringVector(JulianPtrArray * stringVector); - - ICalCAPIReader(); -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - ICalCAPIReader(PRMonitor * monitor, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - virtual ~ICalCAPIReader(); - - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - - virtual void * getMonitor() { return m_Monitor; } - - void setFinished() { m_bFinished = TRUE; } - void setEncoding(nsCalUtility::MimeEncoding encoding) { m_Encoding = encoding; } - t_bool isFinished() const { return m_bFinished; } - /** - * Sets a the buffer to read from. - * Appends the m_Buffer. - */ - /*virtual void setBuffer(const char * capiChunk);*/ - - - /** - * Don't delete u until this object is deleted. - * @param UnicodeString * u - * - * @return void - */ - void AddChunk(UnicodeString * u); - - /*----------------------------- - ** UTILITIES - **---------------------------*/ - - void mark() { m_Mark = m_Pos; m_ChunkMark = m_ChunkIndex;} - - void reset() { m_Pos = m_Mark; m_ChunkIndex = m_ChunkMark;} - - /** - * Read next character from file. - * - * @param status, return 1 if no more characters - * @return next character of string - */ - virtual t_int8 read(ErrorCode & status); - - - - /** - * Read the next ICAL full line of the file. The definition - * of a full ICAL line can be found in the ICAL spec. - * Basically, a line followed by a CRLF and a space character - * signifies that the next line is a continuation of the previous line. - * Uses the readLine, read methods. - * - * @param aLine, returns next full line of string - * @param status, return 1 if no more lines - * - * @return next full line of string - */ - virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0); - - /** - * Read next line of file. A line is defined to be - * characters terminated by either a '\n', '\r' or "\r\n". - * @param aLine, return next line of string - * @param status, return 1 if no more lines - * - * @return next line of string - */ - virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status); -public: - - /*virtual UnicodeString & readLineZero(UnicodeString & aLine, ErrorCode & status);*/ - - - -}; - -#endif /* __ICALCAPIREADER_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/dategntr.h b/mozilla/calendar/modules/core/ical/inc/dategntr.h deleted file mode 100644 index d5bee097fbe..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/dategntr.h +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * dategntr.h - * John Sun - * 2/3/98 2:57:44 PM - */ - -#ifndef __DATEGENERATOR_H_ -#define __DATEGENERATOR_H_ - -#include -#include "nspr.h" -#include "ptypes.h" -#include "datetime.h" -#include "ptrarray.h" -#include "rrday.h" - -/** - * The DateGenerator class defines an interface that provides a basic - * call structure for a BYxxx tag. - * DateGenerators are combined in the context of a Recurrence object - * to create more specialized and versatile date recurrences. - * - * @see DateGenerator - */ -class DateGenerator -{ -public: - - - /** - * Virtual Destructor. - */ - virtual ~DateGenerator() {} - - /** - * Returns the interval for which the generator spans. - * (i.e. a year, a month, a week, etc) - * - * @return the generator's interval - */ - t_int32 getSpan() const { return m_iSpan; } - - /** - * Sets the generation interval. - * (i.e. minutely, hourly, daily, weekly, monthly, yearly) - * @param span span value to set to. - */ - void setSpan(t_int32 span) { m_iSpan = span; } - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Pure virtual. Returns the interval for which the generator represents. - * @return the interval (DAILY) - */ - virtual t_int32 getInterval() const { PR_ASSERT(FALSE); return -1;} - - /** - * Pure virtual. Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * startDate, - JulianPtrArray & dateVector, DateTime * until) - { - /* PR_ASSERT(FALSE); */ - if (startDate) {} - if (until) {} - if (dateVector.GetSize() == 0) {} - return FALSE; - } - - /** - * Pure virtual. A general method to set a single parameter. - * Usually sets the week start parameter. - * @param param the week start value - */ - virtual void setParams(t_int32 param) - { - if (param == 0) {} - } - - /** - * Pure virtual. A general method to set a list of parameters. - * @param params[] a list of parameters - * @param length the length of params[] - * - */ - virtual void setParamsArray(t_int32 params[], t_int32 length) - { - if (params != 0) {} - if (length == 0) {} - } - - /** - * A general method to set a list of lists of parameters for a DateGenerator. - */ - virtual void setRDay(RRDay params[], t_int32 length) - { - /* PR_ASSERT(FALSE); */ - if (params != 0) {} - if (length == 0) {} - } - - /** - * Pure virtual. Determines if a generator has been set active. - * Usually tests if parameters have been set or not. - * - * @return TRUE if generator is active, FALSE otherwise. - */ - virtual t_bool active() { PR_ASSERT(FALSE); return FALSE; } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -protected: - - /** - * Constructor sets span, parameters length. - * @param span initial span value - * @param paramsLen initial parameters length value - */ - DateGenerator(t_int32 span, t_int32 paramsLen = 0); - - /** span value */ - t_int32 m_iSpan; - - /** parameters length */ - t_int32 m_iParamsLen; - -private: - - /** hide default constructor */ - DateGenerator(); - -}; - -#endif /* __DATEGENERATOR_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/deftgntr.h b/mozilla/calendar/modules/core/ical/inc/deftgntr.h deleted file mode 100644 index 1b1039bbff0..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/deftgntr.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * deftgntr.h - * John Sun - * 2/3/98 3:46:49 PM - */ - -#ifndef __DEFAULTGENERATOR_H_ -#define __DEFAULTGENERATOR_H_ - -#include "dategntr.h" - -/** - * The DefaultGenerator class generates dates for rules w/o BYxxx tags. - * - * @see DateGenerator - */ -class DefaultGenerator : public DateGenerator -{ -public: - - /** - * Default Constructor - */ - DefaultGenerator(); - - /** - * Destructor - */ - ~DefaultGenerator() {} - - /*---------------------------------------------------------------------*/ - /* --- DateGenerator interface --- */ - - /** - * Returns the interval for which the generator represents. - * @return the interval (MONTHLY) - */ - virtual t_int32 getInterval() const; - - /** - * Fills in dateVector with DateTime objects that correspond to the - * parameters and start value and the until value. - * DateTime generated should be after start's value and before until's - * value. If until is invalid, ignore it. - * - * @param start the date from which to begin generating recurrences - * @param dateVector storage for the generated dates - * @param until the end date for the recurrence - * - * @return TRUE if until date boundary was reached, FALSE otherwise - */ - virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until); - - /** - * Sets the week start parameter. - * @param param the week start value - */ - virtual void setParams(t_int32 param) { m_iSpan = m_aiParams[2] = param; } - - /** - * Sets the span, count, interval parameters. TODO: move to the .cpp file. - * @param params[] the list of parameters to set to - * @param length the length of params[] - */ - virtual void setParamsArray(t_int32 params[], t_int32 length) - { - isActive = TRUE; - t_int32 i; - for (i = 0; i < length; i++) - m_aiParams[i] = params[i]; - } - /** - * Determines if a generator has been set active. - * - * @return TRUE if isActive in On, FALSE otherwise - */ - virtual t_bool active() { return isActive; } - - /* --- End of DateGenerator interface --- */ - /*---------------------------------------------------------------------*/ - -private: - - /** whether generator's parameters have been set by client */ - t_bool isActive; - - /** contains span, interval, count as parameters */ - t_int32 m_aiParams[3]; -}; - -#endif /* __DEFAULTGENERATOR_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/dprprty.h b/mozilla/calendar/modules/core/ical/inc/dprprty.h deleted file mode 100644 index 3d903f860f8..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/dprprty.h +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * dprprty.h - * John Sun - * 2/12/98 3:16:32 PM - */ - -#include -#include "sdprprty.h" -#include "datetime.h" - -#ifndef __DATETIMEPROPERTY_H_ -#define __DATETIMEPROPERTY_H_ - -/** - * DateTimeProperty is a subclass of StandardProperty. It implements the ICalProperty - * interface for ICAL properties with TYPE=DATETIME or TYPE=DATE. - */ -class DateTimeProperty: public StandardProperty -{ -private: - - /** the DateTime value of the property */ - DateTime m_DateTime; - - /** - * Default constructor - */ - DateTimeProperty(); - - /** - * Copy constructor - * @param that property to copy - */ - DateTimeProperty(const DateTimeProperty & that); -public: - - /** - * Constructor that sets value of property to contents of value - * and makes a copy of the contents of parameters ptr. - * @param value value of property - * @param parameters parameters of property - */ - DateTimeProperty(DateTime value, JulianPtrArray * parameters); - - /** - * Destructor - */ - ~DateTimeProperty(); - - /** - * Return the value of the property - * @return void * ptr to value of the property - */ - virtual void * getValue() const; - - /** - * Set the value of the property - * @param value the value to set property to - */ - virtual void setValue(void * value); - - /** - * Returns a clone of this property. Clients are responsible for deleting - * the returned object. - * - * @return a clone of this property. - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Return TRUE if property is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return a string in human-readable form of the property. - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return a string in human-readable form of the property. For DateTimes, - * dateFmt would contain the a DateFormat string (i.e "MM/dd/yy hh:mm:ss a"). - * @param dateFmt format string options - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out); - - /** - * Return the property's string in the ICAL format. For DateTimes, this - * would be the ISO8601 UTC date format of the datetime (i.e. 19971110T112233Z). - * @param out contains output ICAL string - * - * @return the property in its ICAL string format - */ - virtual UnicodeString & toExportString(UnicodeString & out); - - /** - * Returns the property's ICAL format strings, - * to output string of the form - * :value or ;param1;param2;param3(etc.):value - * ONLY: DateTimeProperty overrides this - * (This is too handle NOT printing VALUE and TZID parameters) - * - * @param out output ICAL string - * - * @return output ICAL string (out) - */ - UnicodeString & toICALString(UnicodeString & out); - - /** - * Returns the property's ICAL format strings, inserting - * sProp (property name) to output string of the form - * sProp:value or sProp;param1;param2;param3(etc.):value - * ONLY: DateTimeProperty overrides this - * (This is too handle NOT printing VALUE and TZID parameters) - * - * @param sProp property name of property - * @param out output ICAL string - * - * @return output ICAL string (out) - */ - UnicodeString & toICALString(UnicodeString & sProp, - UnicodeString & out); -}; - -#endif /* __DATETIMEPROPERTY_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/duprprty.h b/mozilla/calendar/modules/core/ical/inc/duprprty.h deleted file mode 100644 index df1d71f9f64..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/duprprty.h +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * duprprty.h - * John Sun - * 2/12/98 3:37:06 PM - */ - -#include -#include "sdprprty.h" -#include "duration.h" - -#ifndef __DURATIONPROPERTY_H_ -#define __DURATIONPROPERTY_H_ - -/** - * DurationProperty is a subclass of StandardProperty. It implements the ICalProperty - * interface for ICAL properties with TYPE=DURATION. - */ -class DurationProperty: public StandardProperty -{ -private: - /** the nsCalDuration value of the property */ - nsCalDuration m_Duration; - - /** - * Default constructor - */ - DurationProperty(); - - /** - * Copy constructor - * @param that property to copy - */ - DurationProperty(const DurationProperty & that); -public: - - /** - * Constructor that sets value of property to contents of value - * and makes a copy of the contents of parameters ptr. - * @param value value of property - * @param parameters parameters of property - */ - DurationProperty(nsCalDuration value, JulianPtrArray * parameters); - - /** - * Destructor - */ - ~DurationProperty(); - - /** - * Return the value of the property - * @return void * ptr to value of the property - */ - virtual void * getValue() const; - - /** - * Set the value of the property - * @param value the value to set property to - */ - virtual void setValue(void * value); - - /** - * Returns a clone of this property. Clients are responsible for deleting - * the returned object. - * - * @return a clone of this property. - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Return TRUE if property is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return a string in human-readable form of the property. - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return a string in human-readable form of the property. - * @param dateFmt format string options - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out); - - /** - * Return the property's string in the ICAL format. - * @param out contains output ICAL string - * - * @return the property in its ICAL string format - */ - virtual UnicodeString & toExportString(UnicodeString & out); -}; - -#endif /* __DURATIONPROPERTY_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/freebusy.h b/mozilla/calendar/modules/core/ical/inc/freebusy.h deleted file mode 100644 index 003de0fbfc9..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/freebusy.h +++ /dev/null @@ -1,439 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * freebusy.h - * John Sun - * 2/18/98 1:35:51 PM - */ - -#ifndef __FREEBUSY_H_ -#define __FREEBUSY_H_ - -#include -#include "datetime.h" -#include "period.h" -#include "prprty.h" -#include "jlog.h" -#include "julnstr.h" - -/** - * The Freebusy class encapsulates the data in the iCalendar - * FREEBUSY property. A Freebusy contains two parameters, a TYPE and BSTAT - * parameters. These are repesented by the enumerations (FB_TYPE). - * (FB_STATUS ifdef'd out 4-28-98). - * The Freebusy must contain periods, which are contained in a vector of periods. - */ -class Freebusy: public ICalProperty -{ -public: - - /* 4-28-98 combine TYPE and STATUS into just TYPE */ -#if 0 - /** enumeration of TYPE parameters */ - enum FB_TYPE{FB_TYPE_BUSY = 0, FB_TYPE_FREE = 1, - FB_TYPE_LENGTH = 2, FB_TYPE_INVALID = -1 - }; - - /** enumeration of BSTAT parameters */ - enum FB_STATUS{FB_STATUS_BUSY = 0, FB_STATUS_UNAVAILABLE = 1, - FB_STATUS_TENTATIVE = 2, - FB_STATUS_LENGTH = 3, FB_STATUS_INVALID = -1 - }; - - /** list acceptable keywords properties in a FREEBUSY */ - enum FB_PROPS{FB_PROPS_TYPE = 0, FB_PROPS_STATUS}; -#else - /** enumeration of TYPE parameters */ - enum FB_TYPE{FB_TYPE_BUSY = 0, FB_TYPE_FREE = 1, - FB_TYPE_BUSY_UNAVAILABLE = 2, FB_TYPE_BUSY_TENTATIVE = 3, - FB_TYPE_XPARAMVAL = 4, - FB_TYPE_LENGTH = 5, FB_TYPE_INVALID = -1}; - - /** list acceptable keywords properties in a FREEBUSY */ - enum FB_PROPS{FB_PROPS_TYPE = 0}; -#endif - - /** - * Converts TYPE string to a FB_TYPE enumeration value - * @param sType type string - * - * @return FB_TYPE that represents that string - */ - static Freebusy::FB_TYPE stringToType(UnicodeString & sType); - - /** - * Converts FB_TYPE to string. If bad type, return default (BUSY). - * @param type FB_TYPE enumeration value - * @param out output type string - * - * @return output type string (out) - */ - static UnicodeString & typeToString(Freebusy::FB_TYPE type, UnicodeString & out); - -#if 0 - /** - * Converts BSTAT string to a FB_STATUS enumeration - * @param sStatus status string - * - * @return FB_STATUS that represents that string - */ - static Freebusy::FB_STATUS stringToStatus(UnicodeString & sType); - - /** - * Converts FB_STATUS to string. If bad status, return default (BUSY). - * @param attstat FB_STATUS enumeration value - * @param out output BSTAT string - * - * @return output BSTAT string (out) - */ - static UnicodeString & statusToString(Freebusy::FB_STATUS status, UnicodeString & out); -#endif - -private: - -#if 0 - /** default FB_STATUS value */ - static const t_int32 ms_iDEFAULT_STATUS; -#endif - - /** default FB_TYPE value */ - static const t_int32 ms_iDEFAULT_TYPE; - - /* DATA-MEMBERS */ - /* storing type and status as ints instead of strings */ - - /** type value. Default is FB_TYPE_BUSY. */ - t_int32 m_Type; - -#if 0 - /** bstat value. Default is FB_STATUS_BUSY. */ - t_int32 m_Status; -#endif - - /** vector of freebusy periods */ - JulianPtrArray * m_vPeriod; - - /** ptr to log file to write errors to */ - JLog * m_Log; - - JulianString m_sCurl; /* cal url where this curl is stored, may be an empty string */ - - /* characters for printing Freebusy parameters */ - static const t_int32 ms_cFreebusyType;/* = 'T';*/ - static const t_int32 ms_cFreebusyPeriod;/* = 'P';*/ -#if 0 - static const t_int32 ms_cFreebusyStatus;/* = 'S';*/ -#endif - - - /* -- private methods -- */ - - /** - * convert a character to the content of a parameter in - * human-readable string format - * - * @param c a character represents a parameter - * @return parameter in a string - */ - UnicodeString & toStringChar(t_int32 c, UnicodeString & out); - - /** - * Helper method to parse a string of periods. - * @param s string containing periods - * @param vTimeZones vector of timezones (usually 0) - */ - void parsePeriod(UnicodeString & s, JulianPtrArray * vTimeZones); - - /** - * Sets parameter with name paramName with value paramVal. - * @param paramName parameter name to set - * @param paramVal new value of parameter - */ - void setParam(UnicodeString & paramName, UnicodeString & paramVal); - - /** - * Fixes data-members are so that they are valid. If properties - * are invalid, then it will set it to defaults. - */ - void selfCheck(); - - /** - * Sets default value for property - * @param prop property to set default value - */ - void setDefaultProps(Freebusy::FB_PROPS prop); - - /** - * Sort the periods vector by the starting time of periods. - */ - void sortPeriods(); - - /** - * Sort the periods vector by the ending time of the periods. - */ - void sortPeriodsByEndTime(); - -#if 0 - /** - * Default constructor. Hide from clients. - */ - Freebusy(); -#endif - - /** - * Copy constructor. - * @param that Freebusy to copy - */ - Freebusy(Freebusy & that); - -public: - - /** - * Constructor. Also sets log file to write errors to. - * @param initLog log file to write errors to - */ - Freebusy(JLog * initLog = 0); - - /** - * Destructor - */ - ~Freebusy(); - - /*---------- To satisfy ICalProperty interface ----------*/ - /** - * Sets parameters. - * @param parameters vector of parameters to set - * - */ - virtual void setParameters(JulianPtrArray * parameters); - - /** - * Return value of property. Never use. Use getPeriod(). - * - * @return value of property - */ - virtual void * getValue() const { PR_ASSERT(FALSE); return 0; } - - /** - * Sets value of property. Never use. Use addPeriod(). - * @param value new value of property - * - */ - virtual void setValue(void * value) {PR_ASSERT(FALSE); if(value){} } - - /** - * Returns a clone of this property. - * @param initLog the log file for clone to write to - * - * @return clone of this ICalProperty object - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Checks whether this property is valid or not. Period vector size - * must be greater than 0 to be TRUE. - * - * @return TRUE if property is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return property to human-readable string. - * @param dateFmt formatting string - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & strFmt, UnicodeString & out); - - /** - * Return property to human-readable string. - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return property to iCal property string. - * @param out output iCal string - * - * @return output iCal string (out) - */ - virtual UnicodeString & toICALString(UnicodeString & out); - - /** - * Return property to iCal property string. Inserts sProp to - * front of output string. sProp should be the property name of this - * property. - * @param sProp property name to append to insert at front of out - * @param out output iCal string with sProp in front - * - * @return output iCal string with sProp in front (out) - */ - virtual UnicodeString & toICALString(UnicodeString & sProp, UnicodeString & out); - /*----------End of ICalProperty interface----------*/ - - /** - * Returns FB_TYPE value. - * - * @return FB_TYPE value - */ - Freebusy::FB_TYPE getType() const { return (Freebusy::FB_TYPE) m_Type; } - - /** - * Sets FB_TYPE. - * @param i new FB_TYPE value - * - */ - void setType(FB_TYPE type) {m_Type = type;} - -#if 0 - /** - * Returns FB_STATUS value. - * - * @return FB_STATUS value - */ - Freebusy::FB_STATUS getStatus() const { return (Freebusy::FB_STATUS) m_Status; } - - /** - * Sets FB_STATUS. - * @param i new FB_STATUS value - * - */ - void setStatus(FB_STATUS status) {m_Status = status;} -#endif - - /** - * Return vector of periods. - * - * @return vector of periods - */ - JulianPtrArray * getPeriod() const { return m_vPeriod; } - - - /** - * Adds a period to period vector. It makes a copy of the period. - * So client must delete p. Freebusy does NOT take ownership of p. - * @param p period to add to vector - */ - void addPeriod(Period * p); - - /** - * Adds each period in argument vector to this Freebusy's - * period vector - * @param periods vector of periods to add - */ - void addAllPeriods(JulianPtrArray * periods); - - /* - void removePeriod(Period *p) - { - PR_ASSERT(p != 0); - PR_ASSERT(m_vPeriod != 0); - m_vPeriod->Remove(p); - delete p; - } - */ - - /** - * Return starting time of first period chronologically. - * - * @return starting time of first period. - */ - DateTime startOfFreebusyPeriod(); - - /** - * Return ending time of last period chronologically. - * - * @return starting time of first period. - */ - DateTime endOfFreebusyPeriod(); - - /** - * Parse a Freebusy property line and populate data. - * @param in line to parse. - */ - void parse(UnicodeString & in); - - /** - * Given freebusy period values in string, parameters, and timezones - * populates Freebusy data members. - * @param propVal freebusy period string - * @param parameters freebusy parameters - * @param vTimeZones vector of timezones to adjust dates to - * - */ - void parse(UnicodeString & sPeriods, JulianPtrArray * parameters, - JulianPtrArray * vTimeZones = 0); - - /** - * Compresses overlapping periods in vector. - */ - void normalizePeriods(); - - /** - * Compare method to pass into JulianPtrArray::QuickSort method. - * Currently compares against first period in a vs. first period in b. - * @param a first freebusy - * @param b second freebusy - * - * @return ComparePeriods(a[0], b[0]) - */ - static int CompareFreebusy(const void * a, const void * b); - - /** - * Check if two freebusy objects have the same TYPE and BSTAT. If they - * have the same TYPE and BSTAT, return TRUE, otherwise return FALSE. - * @param f1 first freebusy - * @param f2 second freebusy - * - * @return TRUE if TYPE and BSTAT are same in both freebusy, FALSE otherwise - */ - static t_bool HasSameParams(Freebusy * f1, Freebusy * f2); - - protected: - /** - * Returns the curl associated with this nsCalendar. The - * curl points to the calendar store where components in - * this nsCalendar are to be stored. It is required - * for an nsCalendar to have an associated curl if any - * of its components will be persisted in a calendar store. - * - * @return a JulianString containing the curl - */ - JulianString getCurl() const {return m_sCurl;} - - /** - * Set the default curl for this nsCalendar. - */ - void setCurl(const char* ps) {m_sCurl = ps;} - - /** - * Set the default curl for this nsCalendar. - */ - void setCurl(const JulianString& s) {m_sCurl = s;} - -}; - -#endif /* __FREEBUSY_H_ */ diff --git a/mozilla/calendar/modules/core/ical/inc/functbl.h b/mozilla/calendar/modules/core/ical/inc/functbl.h deleted file mode 100644 index b6b378c99d9..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/functbl.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -/* - * functbl.h - * John Sun - * 7/27/98 1:57:12 PM - */ - -#include "valarm.h" -#include "tmbevent.h" -#include "tzpart.h" -#include "vevent.h" -#include "vfrbsy.h" -#include "vtodo.h" - -#ifndef __JULIANFUNCTIONTABLE_H_ -#define __JULIANFUNCTIONTABLE_H_ - -/** - * These structs are used by - * classes that need to contain ICalProperty's to - * quickly find the function to store data-members. - * Its keeps a hashCode and a ptr to a store-property - * function - */ -typedef struct -{ - t_int32 hashCode; - VAlarm::SetOp op; - void set(t_int32 i, VAlarm::SetOp sOp) { hashCode = i; op = sOp; } -} VAlarmStoreTable; - -typedef struct -{ - t_int32 hashCode; - TimeBasedEvent::SetOp op; - void set(t_int32 i, TimeBasedEvent::SetOp sOp) { hashCode = i; op = sOp; } -} TimeBasedEventStoreTable; - -typedef struct -{ - t_int32 hashCode; - TZPart::SetOp op; - void set(t_int32 i, TZPart::SetOp sOp) { hashCode = i; op = sOp; } -} TZPartStoreTable; - -typedef struct -{ - t_int32 hashCode; - VEvent::SetOp op; - void set(t_int32 i, VEvent::SetOp sOp) { hashCode = i; op = sOp; } -} VEventStoreTable; - -typedef struct -{ - t_int32 hashCode; - VFreebusy::SetOp op; - void set(t_int32 i, VFreebusy::SetOp sOp) { hashCode = i; op = sOp; } -} VFreebusyStoreTable; - -typedef struct -{ - t_int32 hashCode; - VTodo::SetOp op; - void set(t_int32 i, VTodo::SetOp sOp) { hashCode = i; op = sOp; } -} VTodoStoreTable; - -class JulianFunctionTable -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - static JulianFunctionTable * m_Instance; - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - JulianFunctionTable(); -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - ~JulianFunctionTable(); - static JulianFunctionTable * Instance(); - - /* VAlarm storeData function table */ - VAlarmStoreTable alarmStoreTable[10]; - TimeBasedEventStoreTable tbeStoreTable[25]; - TZPartStoreTable tzStoreTable[8]; - VEventStoreTable veStoreTable[8]; - /* VFreebusyStoreTable vfStoreTable[16]; */ - VFreebusyStoreTable vfStoreTable[15]; - VTodoStoreTable vtStoreTable[9]; - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - /*----------------------------- - ** UTILITIES - **---------------------------*/ - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - /*----------------------------- - ** OVERLOADED OPERATORS - **---------------------------*/ -}; - -#endif /* __JULIANFUNCTIONTABLE_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/icalcomp.h b/mozilla/calendar/modules/core/ical/inc/icalcomp.h deleted file mode 100644 index 531705e42bd..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/icalcomp.h +++ /dev/null @@ -1,520 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * icalcomp.h - * John Sun - * 2/5/98 2:57:16 PM - */ - -#include -#include "ptrarray.h" -#include "icalredr.h" -#include "prprty.h" -#include "jutility.h" -#include "datetime.h" -#include "jlog.h" -#include "nscalcoreicalexp.h" - -#ifndef __ICALCOMPONENT_H_ -#define __ICALCOMPONENT_H_ - -/** - * ICalComponent defines a Calendar Component in iCal. A calendar - * component can contain iCalendar properties as well as - * other iCalendar components. - * Examples of iCalendar components include VEvent, VTodo, - * VJournal, VFreebusy, VTimeZone, and VAlarms. - * TZPart, althought not an iCal component, subclasses from - * ICalComponent. - */ -class NS_CAL_CORE_ICAL ICalComponent -{ -protected: - - /** - * Constructor. Hide from clients except subclasses. - */ - ICalComponent(); - -public: - - /** - * An enumeration of Calendar Components. TZPart is not - * actually a Calendar component. However, it is useful to add - * it here because it implements this class' interface. - */ - enum ICAL_COMPONENT - { - ICAL_COMPONENT_VEVENT = 0, - ICAL_COMPONENT_VTODO = 1, - ICAL_COMPONENT_VJOURNAL = 2, - ICAL_COMPONENT_VFREEBUSY = 3, - ICAL_COMPONENT_VTIMEZONE = 4, - ICAL_COMPONENT_VALARM = 5, - ICAL_COMPONENT_TZPART = 6 - }; - - - /** - * Converts ICAL_COMPONENT to string. If bad ic, then return "". - * @param ICAL_COMPONENT ic - * - * @return output name of component - */ - static UnicodeString componentToString(ICAL_COMPONENT ic); - - static ICAL_COMPONENT stringToComponent(UnicodeString & s, t_bool & error); - - /** - * Destructor. - * - * @return virtual - */ - virtual ~ICalComponent(); - - - /* -- Start of ICALComponent interface (PURE VIRTUAL METHODS)-- */ - - /** - * The parse method is the standard interface for ICalComponent - * subclasses to parse from an ICalReader object - * and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.). - * The method type can be set to \"\" if there is no method to be loaded. - * Also accepts a vector of VTimeZone objects to apply to - * the DateTime properties of the component. - * TODO: maybe instead of passing a UnicodeString for method, why not a enum METHOD - * 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level, - * it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for - * this. - * - * @param brFile ICalReader to load from - * @param sMethod method of component (i.e. PUBLISH, REQUEST, REPLY) - * @param parseStatus return parse error status string (normally return "OK") - * @param vTimeZones vector of VTimeZones to apply to datetimes - * @param bIgnoreBeginError TRUE = ignore first "BEGIN:VEVENT", FALSE otherwise - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parse error status string (parseStatus) - */ - virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0, - t_bool bIgnoreBeginError = FALSE, nsCalUtility::MimeEncoding encoding = - nsCalUtility::MimeEncoding_7bit) - { - PR_ASSERT(FALSE); - if (brFile != NULL && vTimeZones != NULL - && sMethod.size() > 0 && parseStatus.size() > 0 && bIgnoreBeginError) - {} - return parseStatus; - } - - /** - * Returns a clone of this object - * @param initLog log file to write errors to - * - * @return clone of this object - */ - virtual ICalComponent * clone(JLog * initLog) { PR_ASSERT(FALSE); if (initLog) {} return 0; } - - /** - * Return TRUE if component is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid() { PR_ASSERT(FALSE); return FALSE; } - - /** - * Print all contents of ICalComponent to iCal export format. - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString() { PR_ASSERT(FALSE); return "";} - - /** - * Print all contents of ICalComponent to iCal export format, depending - * on attendee name, attendee delegated-to, and where to include recurrence-id or not - * - * @param method method name (REQUEST,PUBLISH, etc.) - * @param name attendee name to filter with - * @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString(UnicodeString method, UnicodeString name, - t_bool isRecurring) - { - PR_ASSERT(FALSE); - if (method.size() == 0 && name.size() == 0 && isRecurring) - {} - return ""; - } - - /** - * Print all contents of ICalComponent to human-readable string. - * - * @return string containing human-readable format of ICalComponent - */ - virtual UnicodeString toString() {PR_ASSERT(FALSE); return "";} - - /** - * Depending on character passed in, returns a string that represents - * the ICAL export string of that property that the character represents, if - * other paramaters not null, then print out information is filtered in several ways - * Attendee print out can be filtered so that only attendee with certain name is printed - * also, can print out the relevant attendees in a delegation message - * (ie. owner, delegate-to, delegate-from) - * - * @param c char of what property to print - * @param sFilterAttendee name of attendee to print - * @param bDelegateRequest TRUE if a delegate request, FALSE if not - * @return ICAL export format of that property - */ - virtual UnicodeString formatChar(t_int32 c, - UnicodeString sFilterAttendee, - t_bool delegateRequest = FALSE) - { - PR_ASSERT(FALSE); -#if 0 - if (c == 8 || sFilterAttendee.size() == 0 || delegateRequest) {} -#endif - return ""; - } - - /** - * convert a character to the content of a property in string - * human-readable format - * @param c a character represents a property - * @param dateFmt for formatting datetimes - * - * @return property in human-readable string - */ - virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt) - { - PR_ASSERT(FALSE); - -#if 0 /* fix HPUX build busgage - this is dead code anyway - alecf 4/30/98 */ - if (c == 8) {} -#endif - return ""; -#if 0 - if (dateFmt.size() > 0) {} -#endif - } - - /** - * Returns the ICAL_COMPONENT enumeration value of this ICalComponent. - * Each ICalComponent subclass must return a unique ICAL_COMPONENT value. - * - * @return ICAL_COMPONENT value of this component - */ - virtual ICAL_COMPONENT GetType() const { PR_ASSERT(FALSE); return ICAL_COMPONENT_VEVENT; } - - /** - * Update the private property data-members with updatedComponent's - * property data-members. - * Usually, overwriting data-members should only occur if updatedComponent - * is more recent than the current component. - * Return TRUE if component was changed, FALSE otherwise - * @param ICalComponent * updatedComponent - * - * @return virtual t_bool - */ - virtual t_bool updateComponent(ICalComponent * updatedComponent) - { - PR_ASSERT(FALSE); - return FALSE; - } - - /* -- End of ICALComponent PURE VIRTUAL interface -- */ - - - /*-------------------------------------------------------------------*/ - /* NOT PURE - * TRYING TO MERGE SIMILARITIES IN VFREEBUSY AND TIMEBASEDEVENT TOGETHER - */ - - /** - * Check if this component matches a UID and a sequence number. - * TimeBasedEvent and VFreebusy should override this method. - * @param sUID uid to look for - * @param iSeqNo sequence number to look for - * - * @return TRUE if match, FALSE otherwise - */ - virtual t_bool MatchUID_seqNO(UnicodeString sUID, t_int32 iSeqNo = -1) - { - /* NOTE: remove later, just to get rid of compiler warnings */ - if (sUID.size() > 0 && iSeqNo > 0) {} - return FALSE; - } - - /** - * Return the UID of this component. TimeBasedEvent and VFreebusy - * should override this method. - * - * @return the UID of this component. - */ - virtual UnicodeString getUID() const { return ""; } - - /** - * Return the sequence number of this component. - * TimeBasedEvent and VFreebusy should override this method. - * - * @return the sequence number of this component. - */ - virtual t_int32 getSequence() const { return -1; } - - /*---------------------------------------------------------------------*/ - - /* -- End of ICALComponent interface -- */ - - - /** - * Given a component name, a component format string, print the component in - * following manner with properties specified by the format string. It does - * this by calling abstract formatChar method. - * (i.e. sComponentName = VEVENT) - * - * BEGIN:VEVENT - * DTSTART:19980331T112233Z (properties dependent on format string) - * ... - * END:VEVENT - * - * Optionally, the caller may pass in an sFilterAttendee and delegateRequest args. - * If sFilterAttendee != "", then filter on sFilterAttendee, meaning that - * only the attendee with the name sFilterAttendee should be printed. If the - * delegateRequest is set to TRUE, - * also print attendees who are delegates or related-to the delegates. - * @param sComponentName name of ICalComponent - * @param strFmt property format string - * @param sFilterAttendee attendee to filter on - * @param delegateRequest whether to print delegates - * - * @return iCal export string of component - */ - UnicodeString format(UnicodeString & sComponentName, UnicodeString & strFmt, - UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE); - - /** - * Given a format string, prints the component to human-readable format - * with properties specified by format string. It does this by calling - * abstract toStringChar method. - * @param strFmt property format string - * - * @return human-readable string of component - */ - UnicodeString toStringFmt(UnicodeString & strFmt); - - /* STATIC METHODS */ - - /** - * Returns the keyletter representing that property - * For example, if propertyName = "DTSTART", outLetter would return 'B' - * and return boolean would be TRUE. - * return FALSE if property not found. - * @param UnicodeString & propertyName - * @param t_int32 & outLetter - * - * @return static t_bool - */ - static t_bool propertyNameToKeyLetter(UnicodeString & propertyName, - t_int32 & outLetter); - - - /** - * Given a ptr to an array of properties strings (char *) and the count - * create the iCal formatting string for those properties and return - * it in out. - * If ppsPropList is null or iPropCount is 0, then - * return the string of all properties and alarms. - * @param char ** ppsPropList - * @param t_int32 iPropCount - * @param UnicodeString & out - * - * @return static UnicodeString - */ - static UnicodeString & makeFormatString(char ** ppsPropList, t_int32 iPropCount, - UnicodeString & out); - - /** - * Cleanup vector of UnicodeString objects. Delete each UnicodeString - * in vector. - * @param strings vector of elements to delete from - */ - static void deleteUnicodeStringVector(JulianPtrArray * stringVector); - - /** - * Cleanup vector of ICalComponent objects. Delete each ICalComponent - * in vector - * @param strings vector of elements to delete from - */ - static void deleteICalComponentVector(JulianPtrArray * componentVector); - - /** - * Clones each ICalComponent element in the toClone vector and put clone in - * the out vector - * @param JulianPtrArray * out - * @param JulianPtrArray * toClone - * - * @return static void - */ - static void cloneICalComponentVector(JulianPtrArray * out, JulianPtrArray * toClone); - -#if 0 - /** - * Sets the ICalProperty in dateTimePropertyPtr to have - * a value on inVal and paramter value on inParameters - * @param ICalProperty ** dateTimePropertyPtr - * @param DateTime inVal - * @param JulianPtrArray * inParameters - * - * @return static void - */ - static void setDateTimeValue(ICalProperty ** dateTimePropertyPtr, - DateTime inVal, JulianPtrArray * inParameters); - - /** - * Return the value of the dateTimePropertyPtr in outVal - * @param ICalProperty ** dateTimePropertyPtr - * @param DateTime & outVal - * - * @return static void - */ - static void getDateTimeValue(ICalProperty ** dateTimePropertyPtr, - DateTime & outVal); - - /** - * Sets the ICalProperty in stringPropertyPtr to have - * a value on inVal and paramter value on inParameters - * @param ICalProperty ** stringPropertyPtr - * @param UnicodeString inVal - * @param JulianPtrArray * inParameters - * - * @return static void - */ - static void setStringValue(ICalProperty ** stringPropertyPtr, - UnicodeString inVal, JulianPtrArray * inParameters); - - /** - * Return the value of the stringPropertyPtr in outVal - * @param ICalProperty ** stringPropertyPtr - * @param UnicodeString & outVal - * - * @return static void - */ - static void getStringValue(ICalProperty ** stringPropertyPtr, - UnicodeString & outVal); - - /** - * Sets the ICalProperty in integerPropertyPtr to have - * a value on inVal and paramter value on inParameters - * @param ICalProperty ** integerTimePropertyPtr - * @param t_int32 inVal - * @param JulianPtrArray * inParameters - * - * @return static void - */ - static void setIntegerValue(ICalProperty ** integerPropertyPtr, - t_int32 inVal, JulianPtrArray * inParameters); - - /** - * Return the value of the integerPropertyPtr in outVal - * @param ICalProperty ** integerPropertyPtr - * @param t_int32 & outVal - * - * @return static void - */ - static void getIntegerValue(ICalProperty ** integerPropertyPtr, - t_int32 & outVal); - -#endif -protected: - /* replace current vector with contents in replaceVctr */ - /* don't overwrite if replaceVctr is empty and bForceOverwriteOnEmpty is FALSE */ - - /** - * Replace the ICalProperty contents of propertyVctrPtr with the ICalProperty - * elements in replaceVctr. This means delete all ICalProperty elements in - * (*propertyVctrPtr), then clone each element in replaceVctr and add to - * (*propertyVctrPtr). If however replaceVctr is empty, don't delete current - * elements unless bForceOverwriteOnEmpty flag is ON. (see below) - * If bAddInsteadOfOverwrite is TRUE, don't delete all ICalProperty elements, - * just add all elements in replaceVctr to propertyVctrPtr - * If bForceOverwriteOnEmpty is TRUE, delete all ICalProperty elements even if - * replaceVctr is empty or NULL. - * @param JulianPtrArray ** propertyVctrPtr - * @param JulianPtrArray * replaceVctr - * @param t_bool bAddInsteadOfOverwrite = FALSE - * @param t_bool bForceOverwriteOnEmpty = FALSE - * - * @return static void - */ - static void internalSetPropertyVctr(JulianPtrArray ** propertyVctrPtr, - JulianPtrArray * replaceVctr, t_bool bAddInsteadOfOverwrite = FALSE, - t_bool bForceOverwriteOnEmpty = FALSE); - - /** - * Replace the XToken contents of xTokensVctrPtr with the XToken - * elements in replaceVctr. This means delete all XToken elements in - * (*xTokensVctrPtr), then clone each element in replaceVctr and add to - * (*xTokensVctrPtr). If however replaceVctr is empty, don't delete current - * elements unless bForceOverwriteOnEmpty flag is ON. (see below) - * If bAddInsteadOfOverwrite is TRUE, don't delete all XToken elements, - * just add all elements in replaceVctr to xTokensVctrPtr - * If bForceOverwriteOnEmpty is TRUE, delete all XToken elements even if - * replaceVctr is empty or NULL. - * @param JulianPtrArray ** xTokensVctrPtr - * @param JulianPtrArray * replaceVctr - * @param t_bool bAddInsteadOfOverwrite = FALSE - * @param t_bool bForceOverwriteOnEmpty = FALSE - * - * @return static void - */ - static void internalSetXTokensVctr(JulianPtrArray ** xTokensVctrPtr, - JulianPtrArray * replaceVctr, t_bool bAddInsteadOfOverwrite = FALSE, - t_bool bForceOverwriteOnEmpty = FALSE); - - - /** - * Replace the ICalProperty in (*propertyPtr) to with replaceProp. - * This means delete the current ICalProperty and cloning replaceProp - * and setting (*propertyPtr) to clone. - * If replaceProp == NULL, don't delete current ICalProperty. - * However, if bForceOverwriteOnEmpty is TRUE, delete current ICalProperty - * even if replaceProp is NULL. - * @param ICalProperty ** propertyPtr - * @param ICalProperty * replaceProp - * @param t_bool bForceOverwriteOnEmpty = FALSE - * - * @return static void - */ - static void internalSetProperty(ICalProperty ** propertyPtr, - ICalProperty * replaceProp, t_bool bForceOverwriteOnEmpty = FALSE); - - - -}; - -#endif /* __ICALCOMPONENT_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/icalfrdr.h b/mozilla/calendar/modules/core/ical/inc/icalfrdr.h deleted file mode 100644 index b2f2f4a0466..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/icalfrdr.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * icalfrdr.h - * John Sun - * 2/10/98 11:37:48 PM - */ - -#include -#include -#include -#include "nscalcoreicalexp.h" - -#ifndef __ICALFILEREADER_H_ -#define __ICALFILEREADER_H_ - -/** - * ICalFileReader is a subclass of ICalReader. It implements the - * ICalReader interface to work with files. - * TODO: handle QuotedPrintable - */ -class NS_CAL_CORE_ICAL ICalFileReader -{ -private: - - /** filename of file */ - const char * m_filename; - - /** ptr to file */ - FILE * m_file; - - /** buffer to contain current line, assumed to be less than 1024 bytes */ - char m_pBuffer[1024]; - -private: - - /** - * Default constructor. Made private to hide from clients. - */ - ICalFileReader(); - -public: - - /** - * Constructor. Clients should call this to create ICalFileReader - * objects to read ICAL objects from a file. - * Opens file for reading. - * - * @param filename filename of target file - * @param status set to 1 if can't open file - */ - ICalFileReader(char * filename, ErrorCode & status); - - /** - * Destructor. Also closes file. - */ - virtual ~ICalFileReader(); - - /** - * Read next character from file. - * - * @param status, return 1 if no more characters - * @return next character of string - */ - virtual t_int8 read(ErrorCode & status); - - /** - * Read next line of file. A line is defined to be - * characters terminated by either a '\n', '\r' or "\r\n". - * @param aLine, return next line of string - * @param status, return 1 if no more lines - * - * @return next line of string - */ - virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status); - - /** - * Read the next ICAL full line of the file. The definition - * of a full ICAL line can be found in the ICAL spec. - * Basically, a line followed by a CRLF and a space character - * signifies that the next line is a continuation of the previous line. - * Uses the readLine, read methods. - * - * @param aLine, returns next full line of string - * @param status, return 1 if no more lines - * - * @return next full line of string - */ - virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0); -}; - -#endif /* __ICALFILEREADER_H_ */ diff --git a/mozilla/calendar/modules/core/ical/inc/icalprm.h b/mozilla/calendar/modules/core/ical/inc/icalprm.h deleted file mode 100644 index d8e461959d1..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/icalprm.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * icalprm.h - * John Sun - * 2/10/98 3:41:52 PM - */ - -#include -#include "ptrarray.h" - -#ifndef __ICALPARAMETER_H_ -#define __ICALPARAMETER_H_ - -/** - * This is a simple class holding ICAL parameters in an ICalProperty. - * NOTE: this class may eventually become abstract - * since it limits only to have one parameter value, - * so multiple parameter value aren't allowed - * also only allows for string parameter values - */ -class ICalParameter -{ -private: - /** the parameter name of the parameter */ - UnicodeString m_ParameterName; - - /** the parameter value of the parameter */ - UnicodeString m_ParameterValue; -public: - - /** default constructor, returns ("","") */ - ICalParameter(); - - /** - * Copy constructor - * @param that ICalParameter to copy - */ - ICalParameter(ICalParameter & that); - - /** - * Normal constructor - * @param parameterName initial parameter name - * @param parameterValue initial parameter value - */ - ICalParameter(const UnicodeString & parameterName, - const UnicodeString & parameterValue); - - - /** - * Returns a copy of this ICalParameter. Clients responsible - * for de-allocating returned ICalParameter *. - * - * @return a clone of this ICalParameter - */ - ICalParameter * clone(); - - - /** - * Sets the parameter name. - * @param parameterName new parameter name - */ - void setParameterName(const UnicodeString & parameterName); - - /** - * Sets the parameter value. - * @param parameterValue new parameter value - */ - void setParameterValue(const UnicodeString & parameterValue); - - - /** - * Return parameter name - * @param retName return storage for parameter name - * - * @return retName (storage for parameter name) - */ - UnicodeString & getParameterName(UnicodeString & retName) const; - - /** - * Return parameter value - * @param retValue return storage for parameter value - * - * @return retValue (storage for parameter value) - */ - UnicodeString & getParameterValue(UnicodeString & retValue) const; - - - /** - * Returns parameter in string of form ";PARAMETERNAME=PARAMETERVALUE - * @param result output string - * - * @return result (output string) - */ - UnicodeString & toICALString(UnicodeString & result) const; - - /** - * Assignment operator. - * @param d ICalParameter to assign to. - * - * @return - */ - const ICalParameter & operator=(const ICalParameter & d); - - - /** - * Searches parameters for a first occurrence of ICalParameter with - * parameter name equal to paramName. Returns the value of parameter - * in retVal. Returns "", if no match. - * @param paramName parameter name to look for - * @param retVal return value of parameter - * @param parameters parameters to search from - * - * @return retVal (value of parameter) - */ - static UnicodeString & GetParameterFromVector(UnicodeString & paramName, - UnicodeString & retVal, JulianPtrArray * parameters); -}; - -#endif /* __ICALPARAMETER_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/icalredr.h b/mozilla/calendar/modules/core/ical/inc/icalredr.h deleted file mode 100644 index 343f1aca552..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/icalredr.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * icalredr.h - * John Sun - * 2/10/98 11:33:55 AM - */ - -#include "jdefines.h" -#include -#include "nscalcoreicalexp.h" - -#ifndef __ICALREADER_H_ -#define __ICALREADER_H_ - -/** - * ICalReader is an abstract class that defines an interface for - * reading iCalendar objects from a data source. All methods in - * this class are defined to be pure virtual methods. Currently, this - * data source can be a string (ICalStringReader) or a file (ICalFileReader). - * The interface defined allows for the reading of a character, a line, and a full-line. - * A full-line is defined by the iCal Content-Line definition. - * For clients, object acts like an input stream of UnicodeString data. - */ -class NS_CAL_CORE_ICAL ICalReader -{ -protected: - - /** - * Hide constructor from clients. - */ - ICalReader(); - -public: - - virtual ~ICalReader() {} - /** - * Pure virtual. Read the next character from the data. - * @param status return status > 0 if failure in reading character - * - * @return next character in data - */ - virtual t_int8 read(ErrorCode & status) - { - PR_ASSERT(FALSE); - if (status == 0) {} - return -1; - } - - /** - * Pure virtual. Read the next line from the data. A line - * is defined to be characters terminated by a '\n', '\r', or '\n\r'. - * @param aLine placeholder to return next line - * @param status return status > 0 if failure in reading line - * - * @return aLine (next line) - */ - virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status) - { - PR_ASSERT(FALSE); - if (status == 0) {} - if (aLine.size() == 0) {} - return aLine; - } - - /** - * Pure virtual. Read the next full-line from the data. A full-line - * is defined by the iCalendar Content-Line definition. - * @param aLine placeholder to return next full-line - * @param status return status > 0 if failure in reading full-line - * - * @return aLine (next full-line) - */ - virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0) - { - PR_ASSERT(FALSE); - if (status == 0) {} - if (aLine.size() == 0) {} - return aLine; - } - - /** - * Sets a the buffer to read from. This method should only be overwritten by - * the ICalCAPIReader class. (4-16-98) - */ - virtual void setBuffer(const char * capiChunk) - { - if (capiChunk != 0) {} - } - - virtual void * getMonitor() { return 0; } - - /* static methods */ - - static t_bool isHex(t_int8 aToken); - static t_int8 convertHex(char fToken, char sToken); - static UnicodeString & convertQuotedPrintableString(UnicodeString & stringToConvert); -}; - -#endif /* __ICALREADER_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/icalsrdr.h b/mozilla/calendar/modules/core/ical/inc/icalsrdr.h deleted file mode 100644 index bb5946d32c2..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/icalsrdr.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * icalsrdr.h - * John Sun - * 2/10/98 11:37:39 AM - */ - -#include -#include "icalredr.h" -#include "jutility.h" -#include "nscalcoreicalexp.h" - -#ifndef __ICALSTRINGREADER_H_ -#define __ICALSTRINGREADER_H_ - -/** - * ICalStringReader is a subclass of ICalReader. It implements the - * ICalReader interface to work with strings (const char *). - * DO NOT delete the char * object for which the object is constructed with. - TODO: remove Unistring dependency. There is a bug if the - target string is encoded with 2byte character. If so, then the - m_pos and m_length variables are wrong. Currently, I will assume that - all const char * passed in will be us-ascii 8-bit chars -*/ -#if defined(XP_PC) -#pragma warning ( disable : 4275 ) -#endif -class NS_CAL_CORE_ICAL ICalStringReader: public ICalReader -{ -private: - - /** BUG:?? used to extract substring. Dangerous if encoded */ - UnicodeString m_unistring; - - /** string: do not delete outside */ - const char * m_string; - - /** length of string */ - t_int32 m_length; - - /** current position in string */ - t_int32 m_pos; - - /** last marked position of string */ - t_int32 m_mark; - - /** encoding of stream */ - nsCalUtility::MimeEncoding m_Encoding; - - /** - * Default constructor. Made private to hide from clients. - */ - ICalStringReader(); - - - -public: - - /** - * Creates object to read ICAL objects from a string. - * @param string string to read from - */ - ICalStringReader(const char * string, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Mark current position in string - */ - void mark(); - - /** - * Reset position to last mark - */ - void reset(); - - /** - * Read next character of string. - * - * @param status, return 1 if no more characters - * @return next character of string - */ - virtual t_int8 read(ErrorCode & status); - - /** - * Read next line of string. A line is defined to be - * characters terminated by either a '\n', '\r' or "\r\n". - * @param aLine, return next line of string - * @param status, return 1 if no more lines - * - * @return next line of string - */ - virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status); - - - /** - * Read the next ICAL full line of the string. The definition - * of a full ICAL line can be found in the ICAL spec. - * Basically, a line followed by a CRLF and a space character - * signifies that the next line is a continuation of the previous line. - * Uses the readLine, read methods. - * - * @param aLine, returns next full line of string - * @param status, return 1 if no more lines - * - * @return next full line of string - */ - virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0); -}; -#if defined(XP_PC) -#pragma warning ( default : 4275 ) -#endif - -#endif /* __ICALSTRINGREADER_H_ */ diff --git a/mozilla/calendar/modules/core/ical/inc/icompfy.h b/mozilla/calendar/modules/core/ical/inc/icompfy.h deleted file mode 100644 index de4fba0c630..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/icompfy.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * icompfy.h - * John Sun - * 2/20/98 10:44:52 AM - */ - -#include "icalcomp.h" -#include "jlog.h" - -#ifndef __ICALCOMPONENTFACTORY_H_ -#define __ICALCOMPONENTFACTORY_H_ - -/** - * ICalComponentFactory is a factory class that creates - * ICalComponent instances. - * - * @see ICalComponent - */ -class ICalComponentFactory -{ -private: - - /** - * Hide default constructor from use. - */ - ICalComponentFactory(); - -public: - - /** - * Factory method that creates ICalComponent objects. - * Clients are responsible for calling parse method - * to populate the returned ICalComponent. - * Clients are also responsible for de-allocating - * return ICalComponent. - * TODO: instead of passing string, why not pass a enum. - * - * @param name the name of the ICalComponent - * @param initLog the log of the ICalComponent - * - * @return ptr to the newly created ICalComponent object - * @see ICalComponent - */ - static ICalComponent * Make(UnicodeString & name, JLog * initLog); -}; - -#endif /* __ICALCOMPONENTFACTORY_H_ */ diff --git a/mozilla/calendar/modules/core/ical/inc/iprprty.h b/mozilla/calendar/modules/core/ical/inc/iprprty.h deleted file mode 100644 index 486c3440563..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/iprprty.h +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * iprprty.h - * John Sun - * 2/12/98 3:26:51 PM - */ - -#include -#include "sdprprty.h" - -#ifndef __INTEGERPROPERTY_H_ -#define __INTEGERPROPERTY_H_ - -/** - * IntegerProperty is a subclass of StandardProperty. It implements the ICalProperty - * interface for ICAL properties with TYPE=INTEGER. - */ -class IntegerProperty: public StandardProperty -{ -private: - /** the Integer value of the property */ - t_int32 m_Integer; - - /** - * Default constructor - */ - IntegerProperty(); - - /** - * Copy constructor - * @param that property to copy - */ - IntegerProperty(const IntegerProperty & that); - -public: - - /** - * Constructor that sets value of property to contents of value - * and makes a copy of the contents of parameters ptr. - * @param value value of property - * @param parameters parameters of property - */ - IntegerProperty(t_int32 value, JulianPtrArray * parameters); - - /** - * Destructor - */ - ~IntegerProperty(); - - /** - * Return the value of the property - * @return void * ptr to value of the property - */ - virtual void * getValue() const; - - /** - * Set the value of the property - * @param value the value to set property to - */ - virtual void setValue(void * value); - - /** - * Returns a clone of this property. Clients are responsible for deleting - * the returned object. - * - * @return a clone of this property. - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Return TRUE if property is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return a string in human-readable form of the property. - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return a string in human-readable form of the property. - * @param dateFmt format string options - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out); - - /** - * Return the property's string in the ICAL format. - * @param out contains output ICAL string - * - * @return the property in its ICAL string format - */ - virtual UnicodeString & toExportString(UnicodeString & out); -}; -#endif /* __INTEGERPROPERTY_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/jparser.h b/mozilla/calendar/modules/core/ical/inc/jparser.h deleted file mode 100644 index 0157d6dbaae..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/jparser.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * jparser.h - * John Sun - * 4/28/98 10:45:21 AM - */ -#ifndef __JULIANPARSER_H_ -#define __JULIANPARSER_H_ - -#include "ptrarray.h" -#include "icalredr.h" -#include "capiredr.h" -#include "jutility.h" -#include "nspr.h" - -/** - * This class will be removed later. It is a hack I created to - * parse the MIME-message from the CS&T server fetch results. - * I will try to extract the iCalendar information from it. - * I will need to handle multi-threaded parsing somehow as well. - */ -class JulianParser -{ -private: - /*char * m_Buffer;*/ - - static nsCalUtility::MimeEncoding stringToEncodingType(UnicodeString & propVal); - - JulianPtrArray * m_OutCalendars; - ICalCAPIReader * m_Reader; - t_bool m_bParseStarted; - t_bool m_bParseFinished; - PRThread * m_Thread; - -public: - JulianParser(); - JulianParser(ICalCAPIReader * reader, JulianPtrArray * outCalendars, - PRThread * thread); - /* - void setBuffer(char * buf) - { - strcat(m_Buffer, buf); - } - */ - - t_bool isParseStarted() const { return m_bParseStarted; } - void setParseStarted() { m_bParseStarted = TRUE; } - - t_bool isParseFinished() const { return m_bParseFinished; } - void setParseFinished() { m_bParseFinished = TRUE; } - - ICalCAPIReader * getReader() const { return m_Reader; } - PRThread * getThread() const { return m_Thread; } - - void ParseCalendars(ICalReader * reader, - JulianPtrArray * outCalendars); - - void ParseCalendars(); - -}; - -#ifdef XP_CPLUSPLUS -extern "C"{ -#endif - - void jparser_ParseCalendarsZero(void * jp, void *); - -#ifdef XP_CPLUSPLUS -} -#endif - -#endif /* __JULIANPARSER_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/manifest.mn b/mozilla/calendar/modules/core/ical/inc/manifest.mn deleted file mode 100644 index e06fca7a179..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/manifest.mn +++ /dev/null @@ -1,70 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - abprprty.h \ - attendee.h \ - bprprty.h \ - bydmgntr.h \ - bydwgntr.h \ - bydygntr.h \ - byhgntr.h \ - bymdgntr.h \ - bymgntr.h \ - bymogntr.h \ - bywngntr.h \ - byydgntr.h \ - capiredr.h \ - dategntr.h \ - deftgntr.h \ - dprprty.h \ - duprprty.h \ - freebusy.h \ - functbl.h \ - icalcomp.h \ - icalfrdr.h \ - icalprm.h \ - icalredr.h \ - icalsrdr.h \ - icompfy.h \ - iprprty.h \ - jparser.h \ - nscal.h \ - orgnzr.h \ - period.h \ - pprprty.h \ - prprty.h \ - prprtyfy.h \ - rcrrence.h \ - recid.h \ - rrday.h \ - sdprprty.h \ - sprprty.h \ - stdafx.h \ - tmbevent.h \ - tzpart.h \ - unistrto.h \ - uri.h \ - valarm.h \ - vevent.h \ - vfrbsy.h \ - vjournal.h \ - vtimezne.h \ - vtodo.h \ - nscalcoreicalexp.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalAttendeeProperty.h b/mozilla/calendar/modules/core/ical/inc/nsCalAttendeeProperty.h deleted file mode 100644 index 449534e12aa..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalAttendeeProperty.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalAttendeeProperty_h___ -#define nsCalAttendeeProperty_h___ - -#include "nsCalProperty.h" -#include "attendee.h" - -class NS_CAL_CORE_ICAL nsCalAttendeeProperty : public nsCalProperty -{ -public: - nsCalAttendeeProperty(); - ~nsCalAttendeeProperty(); - -public: - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue); - - NS_IMETHOD_(JulianPtrArray *) GetParameters(); - NS_IMETHOD SetParameters(JulianPtrArray * parameters); - NS_IMETHOD_(void *) GetValue() const; - NS_IMETHOD SetValue(void * value); - NS_IMETHOD_(nsICalProperty *) Clone(); - NS_IMETHOD_(PRBool) IsValid(); - NS_IMETHOD_(nsString &) ToString(nsString & out); - NS_IMETHOD_(nsString &) ToICALString(nsString & out); - NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out); -}; - -#endif diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalDateTimeProperty.h b/mozilla/calendar/modules/core/ical/inc/nsCalDateTimeProperty.h deleted file mode 100644 index 9bb2f7302e5..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalDateTimeProperty.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalDateTimeProperty_h___ -#define nsCalDateTimeProperty_h___ - -#include "jdefines.h" -#include "nsICalProperty.h" -#include "nsICalICalendarParserObject.h" -#include "nsCalStandardProperty.h" -#include "jdefines.h" -#include "dprprty.h" -#include "nscalcoreicalexp.h" - -/* - * XPCOM wrapper around non-XPCOM julian classes DateTimeProperty - * TODO: XXX: XPCOM julian classes and remove them - */ -class NS_CAL_CORE_ICAL nsCalDateTimeProperty : public nsCalStandardProperty -{ -public: - nsCalDateTimeProperty(); - - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - /* nsICalProperty */ - NS_IMETHOD_(void *) GetValue() const; - NS_IMETHOD SetValue(void * value); - NS_IMETHOD_(nsICalProperty *) Clone(); - NS_IMETHOD_(PRBool) IsValid(); - NS_IMETHOD_(nsString &) ToString(nsString & out); - NS_IMETHOD_(nsString &) ToICALString(nsString & out); - NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out); - - /* nsICalStandardProperty */ - NS_IMETHOD_(nsString &) toExportString(nsString & out); - -protected: - ~nsCalDateTimeProperty(); - -}; - -#endif - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalDurationProperty.h b/mozilla/calendar/modules/core/ical/inc/nsCalDurationProperty.h deleted file mode 100644 index 7a74ae925d9..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalDurationProperty.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsDurationProperty_h___ -#define nsDurationProperty_h___ - -#include "nsICalProperty.h" -#include "nsICalStandardProperty.h" -#include "jdefines.h" -#include "prprty.h" -#include "sprprty.h" -#include "nscalcoreicalexp.h" - -/* - * XPCOM wrapper around non-XPCOM julian classes DurationProperty - * TODO: XXX: XPCOM julian classes and remove them - */ -class NS_CAL_CORE_ICAL nsDurationProperty : public nsICalProperty, - public nsICalStandardProperty, - public nsICalICalendarParserObject -{ -public: - nsDurationProperty(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - /* nsICalICalendarParserObject */ - NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue); - - /* nsICalProperty */ - NS_IMETHOD SetParameters(JulianPtrArray * parameters) = 0; - NS_IMETHOD_(void *) GetValue() const = 0; - NS_IMETHOD SetValue(void * value) const = 0; - NS_IMETHOD_(nsICalProperty *) Clone() = 0; - NS_IMETHOD_(PRBool) IsValid() = 0; - NS_IMETHOD_(nsString &) ToString(nsString & out) = 0; - NS_IMETHOD_(nsString &) ToICALString(nsString & out) = 0; - NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out) = 0; - - /* nsICalStandardProperty */ - NS_IMETHOD AddParameter(nsICalParameter * parameter) = 0; - NS_IMETHOD_(nsString &) toExportString(nsString & out) = 0; - NS_IMETHOD Parse(nsString & in); - -protected: - ~nsCalendar(); - -private: - DurationProperty * mDurationProperty; - -}; - -#endif - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalICalendarComponent.h b/mozilla/calendar/modules/core/ical/inc/nsCalICalendarComponent.h deleted file mode 100644 index 20ac80e1835..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalICalendarComponent.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalICalendarComponent_h___ -#define nsCalICalendarComponent_h___ - -#include "jdefines.h" -#include "nsICalICalendarComponent.h" -#include "nsICalICalendarContainer.h" -#include "nsICalProperty.h" -#include "nsICalICalendarParserObject.h" -#include "icalcomp.h" - -class NS_CAL_CORE_ICAL nsCalICalendarComponent: public nsICalICalendarComponent, - public nsICalICalendarContainer, - public nsICalICalendarParserObject -{ - -protected: - nsCalICalendarComponent(); - ~nsCalICalendarComponent(); - -public: - - NS_IMETHOD Init(); - - NS_DECL_ISUPPORTS - - /* nsICalICalendarParserObject */ - NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue); - - NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop, - JulianPtrArray * vTimeZones); - - -protected: - ICalComponent * mICalComponent; - -}; - -#endif - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalIntegerProperty.h b/mozilla/calendar/modules/core/ical/inc/nsCalIntegerProperty.h deleted file mode 100644 index 8c504d23d62..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalIntegerProperty.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalIntegerProperty_h___ -#define nsCalIntegerProperty_h___ - -#include "jdefines.h" -#include "nsICalProperty.h" -#include "nsICalICalendarParserObject.h" -#include "nsCalStandardProperty.h" -#include "jdefines.h" -#include "prprty.h" -#include "sprprty.h" -#include "nscalcoreicalexp.h" - -/* - * XPCOM wrapper around non-XPCOM julian classes CalStringProperty - * TODO: XXX: XPCOM julian classes and remove them - */ -class NS_CAL_CORE_ICAL nsCalIntegerProperty : public nsCalStandardProperty -{ -public: - nsCalIntegerProperty(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - /* nsICalProperty */ - NS_IMETHOD_(void *) GetValue() const; - NS_IMETHOD SetValue(void * value); - NS_IMETHOD_(nsICalProperty *) Clone(); - NS_IMETHOD_(PRBool) IsValid(); - NS_IMETHOD_(nsString &) ToString(nsString & out); - NS_IMETHOD_(nsString &) ToICALString(nsString & out); - NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out); - - /* nsICalStandardProperty */ - NS_IMETHOD_(nsString &) toExportString(nsString & out); - - -protected: - ~nsCalIntegerProperty(); - -}; - -#endif - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalProperty.h b/mozilla/calendar/modules/core/ical/inc/nsCalProperty.h deleted file mode 100644 index 4e7a52dcb91..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalProperty.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalProperty_h___ -#define nsCalProperty_h___ - -#include "nsICalProperty.h" -#include "nsICalICalendarParserObject.h" - -#include "sdprprty.h" - -class NS_CAL_CORE_ICAL nsCalProperty : public nsICalProperty, - public nsICalICalendarParserObject -{ -public: - nsCalProperty(); - ~nsCalProperty(); - -public: - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - /* nsICalICalendarParserObject */ - NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue) = 0; - - /* nsICalStandardProperty */ - NS_IMETHOD_(JulianPtrArray *) GetParameters() = 0; - NS_IMETHOD SetParameters(JulianPtrArray * parameters) = 0; - - NS_IMETHOD_(ICalProperty *) GetICalProperty() const; - -protected: - ICalProperty * mICalProperty; - -}; -#endif - diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalStandardProperty.h b/mozilla/calendar/modules/core/ical/inc/nsCalStandardProperty.h deleted file mode 100644 index 02b9b7845c8..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalStandardProperty.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalStandardProperty_h___ -#define nsCalStandardProperty_h___ - -#include "nsCalProperty.h" -#include "nsICalStandardProperty.h" - -#include "sdprprty.h" - -class NS_CAL_CORE_ICAL nsCalStandardProperty : public nsCalProperty, - public nsICalStandardProperty -{ -public: - nsCalStandardProperty(); - ~nsCalStandardProperty(); - -public: - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - /* nsICalICalendarParserObject */ - NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue); - - /* nsICalStandardProperty */ - NS_IMETHOD_(JulianPtrArray *) GetParameters(); - NS_IMETHOD SetParameters(JulianPtrArray * parameters); - NS_IMETHOD AddParameter(nsString & aKey, nsString & aValue); - NS_IMETHOD AddParameter(ICalParameter * parameter); - NS_IMETHOD Parse(nsString & in); - - -}; -#endif - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalStringProperty.h b/mozilla/calendar/modules/core/ical/inc/nsCalStringProperty.h deleted file mode 100644 index eb1525d53a9..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalStringProperty.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalStringProperty_h___ -#define nsCalStringProperty_h___ - -#include "jdefines.h" -#include "nsICalProperty.h" -#include "nsICalICalendarParserObject.h" -#include "nsCalStandardProperty.h" -#include "jdefines.h" -#include "sprprty.h" -#include "nscalcoreicalexp.h" - -/* - * XPCOM wrapper around non-XPCOM julian classes CalStringProperty - * TODO: XXX: XPCOM julian classes and remove them - */ -class NS_CAL_CORE_ICAL nsCalStringProperty : public nsCalStandardProperty -{ -public: - nsCalStringProperty(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - /* nsICalProperty */ - NS_IMETHOD_(void *) GetValue() const; - NS_IMETHOD SetValue(void * value); - NS_IMETHOD_(nsICalProperty *) Clone(); - NS_IMETHOD_(PRBool) IsValid(); - NS_IMETHOD_(nsString &) ToString(nsString & out); - NS_IMETHOD_(nsString &) ToICALString(nsString & out); - NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out); - - /* nsICalStandardProperty */ - NS_IMETHOD_(nsString &) toExportString(nsString & out); - - -protected: - ~nsCalStringProperty(); - -}; - -#endif - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalTimeBasedEvent.h b/mozilla/calendar/modules/core/ical/inc/nsCalTimeBasedEvent.h deleted file mode 100644 index b0a80dd5d0e..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalTimeBasedEvent.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTimeBasedEvent_h___ -#define nsCalTimeBasedEvent_h___ - -#include "jdefines.h" -#include "nsCalICalendarComponent.h" -#include "nsICalTimeBasedEvent.h" -#include "nsICalProperty.h" -#include "tmbevent.h" -#include "nscalcoreicalexp.h" - -class NS_CAL_CORE_ICAL nsCalTimeBasedEvent: public nsCalICalendarComponent, - public nsICalTimeBasedEvent -{ -protected: - nsCalTimeBasedEvent(); - ~nsCalTimeBasedEvent(); - -public: - NS_IMETHOD Init(); - - NS_DECL_ISUPPORTS - - // nsICalTimeBasedEvent - /* - NS_IMETHOD_(nsIDateTime *) GetDTStart() const; - NS_IMETHOD SetDTStart(nsIDateTime *, JulianPtrArray * parameters = 0); - NS_IMETHOD SetDTStartProperty(nsICalDateTimeProperty * property); - */ - NS_IMETHOD_(PRInt32) GetSequence() const; - NS_IMETHOD SetSequence(PRInt32 i, JulianPtrArray * parameters = 0); - NS_IMETHOD SetSequenceProperty(nsICalProperty * property); - - NS_IMETHOD AddAttachProperty(nsICalProperty * property); - NS_IMETHOD AddAttendeeProperty(nsICalProperty * property); - NS_IMETHOD AddCategoriesProperty(nsICalProperty * property); - NS_IMETHOD SetClassProperty(nsICalProperty * property); - NS_IMETHOD AddCommentProperty(nsICalProperty * property); - NS_IMETHOD AddContactProperty(nsICalProperty * property); - NS_IMETHOD SetCreatedProperty(nsICalProperty * property); - NS_IMETHOD SetDescriptionProperty(nsICalProperty * property); - NS_IMETHOD SetDTStartProperty(nsICalProperty * property); - NS_IMETHOD SetDTStampProperty(nsICalProperty * property); - NS_IMETHOD AddExDateProperty(nsICalProperty * property); - NS_IMETHOD AddExRuleProperty(nsICalProperty * property); - NS_IMETHOD SetLastModifiedProperty(nsICalProperty * property); - NS_IMETHOD SetOrganizerProperty(nsICalProperty * property); - NS_IMETHOD AddRDateProperty(nsICalProperty * property); - NS_IMETHOD AddRRuleProperty(nsICalProperty * property); - NS_IMETHOD SetRecurrenceIDProperty(nsICalProperty * property); - NS_IMETHOD AddRelatedToProperty(nsICalProperty * property); - NS_IMETHOD AddRequestStatusProperty(nsICalProperty * property); - NS_IMETHOD SetStatusProperty(nsICalProperty * property); - NS_IMETHOD SetSummaryProperty(nsICalProperty * property); - NS_IMETHOD SetUIDProperty(nsICalProperty * property); - NS_IMETHOD SetURLProperty(nsICalProperty * property); - -NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop, - JulianPtrArray * vTimeZones); - - NS_IMETHOD SelfCheck(); - - -}; - -#endif - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalVEvent.h b/mozilla/calendar/modules/core/ical/inc/nsCalVEvent.h deleted file mode 100644 index f492c720ddd..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalVEvent.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalVEvent_h___ -#define nsCalVEvent_h___ - -#include "nsCalTimeBasedEvent.h" -#include "nsICalVEvent.h" -#include "vevent.h" -#include "datetime.h" - -class NS_CAL_CORE_ICAL nsCalVEvent: public nsCalTimeBasedEvent, - public nsICalVEvent -{ -public: - nsCalVEvent(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue); - - // nsICalVEvent - NS_IMETHOD_(DateTime) GetDTEnd() const; - NS_IMETHOD SetDTEnd(DateTime d, JulianPtrArray * parameters); - NS_IMETHOD SetDTEndProperty(nsICalProperty * property); - - NS_IMETHOD SetGEOProperty(nsICalProperty * property); - NS_IMETHOD SetLocationProperty(nsICalProperty * property); - NS_IMETHOD SetPriorityProperty(nsICalProperty * property); - NS_IMETHOD SetTranspProperty(nsICalProperty * property); - //NS_IMETHOD SetDurationProperty(nsICalProperty * property); - NS_IMETHOD AddResourcesProperty(nsICalProperty * property); - - NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop, - JulianPtrArray * vTimeZones); - - NS_IMETHOD_(VEvent *) GetICalEvent(); - - NS_IMETHOD_(PRBool) IsValid(); - -protected: - ~nsCalVEvent(); -}; - -#endif - - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nsCalendar.h b/mozilla/calendar/modules/core/ical/inc/nsCalendar.h deleted file mode 100644 index 9b04e351b35..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nsCalendar.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalendar_h___ -#define nsCalendar_h___ - -#include "jdefines.h" -#include "nsICalendar.h" -#include "nsICalICalendarParserObject.h" -#include "nsICalICalendarContainer.h" -#include "nscal.h" -#include "nscalcoreicalexp.h" - -class NS_CAL_CORE_ICAL nsCalendar : public nsICalendar, - public nsICalICalendarContainer, - public nsICalICalendarParserObject -{ -public: - nsCalendar(); - - NS_DECL_ISUPPORTS - - /* nsICalICalendarParserObject */ - NS_IMETHOD Init(); - NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue); - - /* nsICalendar */ - NS_IMETHOD_(UnicodeString) GetCalScale() const; - NS_IMETHOD SetCalScale(UnicodeString s, JulianPtrArray * parameters = 0); - NS_IMETHOD SetCalScaleProperty(nsICalProperty * property); - //NS_IMETHOD_(nsICalProperty *) GetCalScaleProperty() const; - - NS_IMETHOD_(UnicodeString) GetVersion() const; - NS_IMETHOD SetVersion(UnicodeString s, JulianPtrArray * parameters = 0); - NS_IMETHOD SetVersionProperty(nsICalProperty * property); - //NS_IMETHOD_(nsICalProperty *) GetVersionProperty() const; - - NS_IMETHOD_(UnicodeString) GetProdid() const; - NS_IMETHOD SetProdid(UnicodeString s, JulianPtrArray * parameters = 0); - NS_IMETHOD SetProdidProperty(nsICalProperty * property); - //NS_IMETHOD_(nsICalProperty *) GetProdidProperty() const; - - NS_IMETHOD_(PRInt32) GetMethod() const; - NS_IMETHOD SetMethod(PRInt32 i); - NS_IMETHOD SetMethodProperty(nsICalProperty * property); - - NS_IMETHOD AddEvent(nsICalVEvent * event); - - NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop, - JulianPtrArray * vTimeZones); - - NS_IMETHOD_(NSCalendar *) GetNSCalendar() const; -protected: - ~nsCalendar(); - -private: - NSCalendar * mCalendar; -}; - -#endif /* nsCalendar_h___ */ - - - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nscal.h b/mozilla/calendar/modules/core/ical/inc/nscal.h deleted file mode 100644 index 4d711c57b60..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nscal.h +++ /dev/null @@ -1,837 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * nscal.h - * John Sun - * 2/18/98 1:35:06 PM - */ -/* - * Updated 9/24/98 sman - * We need to be able to append a list of events: AddEventList - */ - -#ifndef __NSCALENDAR_H_ -#define __NSCALENDAR_H_ - -#include -#include "ptrarray.h" -#include "prprty.h" -#include "icalredr.h" -#include "icalcomp.h" -#include "vevent.h" -#include "vtodo.h" -#include "vjournal.h" -#include "vfrbsy.h" -#include "jutility.h" -#include "julnstr.h" -#include "nscalcoreicalexp.h" - -/** - * NSCalendar encapsulates a iCalendar calendar object. An NSCalendar - * may contain Calendar Components such as VEvent, VTodo, VJournal, - * VFreebusy and VTimeZones. It also contains the METHOD - * PRODID, VERSION, and CALSCALE properties. (NAME, SOURCE removed 4-28-98). - */ -class NS_CAL_CORE_ICAL NSCalendar -{ -private: -#if 0 - - - /** - * Default constructor. Hide from clients. - */ - NSCalendar(); -#endif -public: - /*static const UnicodeString ms_asMETHODS[];*/ - - /** - * An enumeration of ITIP methods. - */ - enum METHOD{METHOD_PUBLISH = 0, METHOD_REQUEST = 1, - METHOD_REPLY = 2, METHOD_CANCEL = 3, METHOD_REFRESH = 4, - METHOD_COUNTER = 5, METHOD_DECLINECOUNTER = 6, METHOD_ADD = 7, - METHOD_LENGTH= 8, METHOD_INVALID = -1}; - - /** - * Converts ITIP method in string to the METHOD enumeration. - * @param UnicodeString & method - * - * @return static NSCalendar::METHOD - */ - static NSCalendar::METHOD stringToMethod(UnicodeString & method); - - /** - * Converts METHOD to string. A method not publish through add - * returns "". (i.e. METHOD_LENGTH, METHOD_INVALID). - * @param NSCalendar::METHOD method - * @param UnicodeString & out - * - * @return static UnicodeString - */ - static UnicodeString & methodToString(NSCalendar::METHOD method, UnicodeString & out); - - enum JOURNAL_METHOD{ - JOURNAL_METHOD_PUBLISH = METHOD_PUBLISH, - JOURNAL_METHOD_CANCEL= METHOD_CANCEL, - JOURNAL_METHOD_REFRESH = METHOD_REFRESH, - JOURNAL_METHOD_LENGTH = 3, JOURNAL_METHOD_INVALID = -1 - }; - - enum FREEBUSY_METHOD{ - - FREEBUSY_METHOD_PUBLISH = METHOD_PUBLISH, - FREEBUSY_METHOD_REQUEST = METHOD_REQUEST, - FREEBUSY_METHOD_REPLY = METHOD_REPLY, - FREEBUSY_METHOD_LENGTH = 3, FREEBUSY_METHOD_INVALID = -1 - }; - - enum SPECIAL_METHOD{ - SPECIAL_METHOD_DELEGATE = 0, - SPECIAL_METHOD_LENGTH = 1, SPECIAL_METHOD_INVALID = -1 - }; - - enum METHOD_PROPS{PROPS_METHOD = 0, PROPS_JOURNAL_METHOD = 1, - PROPS_FREEBUSY_METHOD = 2, PROPS_SPECIAL_METHOD = 3}; - - enum CALSCALE{CALSCALE_GREGORIAN = 0, - CALSCALE_LENGTH = 1, CALSCALE_INVALID = -1}; - - /* -- METHODS -- */ - - /** - * Constructor. Creates NSCalendar with initial logfile initLog. - * @param JLog * initLog = 0 - */ - NSCalendar(JLog * initLog = 0); - /*NSCalendar(User u);*/ - - /** - * Copy constructor - * @param NSCalendar & that - */ - NSCalendar(NSCalendar & that); - - /** - * Destructor - */ - ~NSCalendar(); - - /** - * Export this calendar to a file with filename. If error occurred, - * return false in status boolean. - * TODO: test it - */ - void export(const char * filename, t_bool & status); - - /** - * clone this NSCalendar - * TODO: test it - */ - NSCalendar * clone(JLog * initLog); - - /* CALSCALE */ - UnicodeString getCalScale() const; - void setCalScale(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getCalScaleProperty() const { return m_CalScale; } - - /* VERSION */ - UnicodeString getVersion() const; - void setVersion(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getVersionProperty() const { return m_Version; } - - /* PRODID */ - UnicodeString getProdid() const; - void setProdid(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getProdidProperty() const { return m_Prodid; } - -#if 0 - /* SOURCE */ - UnicodeString getSource() const; - void setSource(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getSourceProperty() const { return m_Source; } - - /* NAME */ - UnicodeString getName() const; - void setName(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getNameProperty() const { return m_Name; } -#endif - - /* METHOD: NOTE: Method is not an ICalProperty, but saved as an NSCalendar::METHOD */ - void setMethod(NSCalendar::METHOD i) { m_iMethod = i; } - NSCalendar::METHOD getMethod() const { return (NSCalendar::METHOD) m_iMethod; } - - /* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */ - void addXTokens(UnicodeString s); - JulianPtrArray * getXTokens() const { return m_XTokensVctr; } - - /** getter and setter for when events were last updated from server */ - void setEventsLastUpdatedFromServer(DateTime d) { m_EventsLastUpdatedFromServer = d; } - DateTime getEventsLastUpdatedFromServer() { return m_EventsLastUpdatedFromServer; } - - /** getter for when events span */ - DateTime getEventsSpanStart() { return m_EventsSpanStart; } - DateTime getEventsSpanEnd() { return m_EventsSpanEnd; } - - - /** - * Given an ICalReader object, parse the stream to populate this NSCalendar. - * In the process of parsing, the NSCalendar may create subcomponents - * such as VEvent, VTodo, VJournal, VTimeZone, and VFreebusy. - * If stream came from a file, store filename (NOTE: may remove later). - * - * @param brFile ICalReader stream object to parse from - * @param fileName filename of stream if stream is from a file - * @param encoding the encoding of the stream, default is 7bit. - * - */ - void parse(ICalReader * brFile, UnicodeString & fileName, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Returns the error log. - * - * @return JLog* - */ - JLog* getLog() const { return m_Log; }; - - /** - * Return the vector of nsCalLogErrors on this ICalComponent: - * Return 0 if ic is not in this calendar. - * Return 0 if ic has no error vector. - * Do not deallocate returned vector. Returns a ptr to vector, not a new vector. - * @param ICalComponent * ic - * - * @return JulianPtrArray * - */ - JulianPtrArray * getLogVector(ICalComponent * ic); - - /** - * Return the vector of nsCalLogErrors on this calendar. - * Return 0 if this calendar has no error vector. - * Do not deallocate returned vector. Returns a ptr to vector, not a new vector. - */ - JulianPtrArray * getLogVector(); - - /** - * Returns the curl associated with this nsCalendar. The - * curl points to the calendar store where components in - * this nsCalendar are to be stored. It is required - * for an nsCalendar to have an associated curl if any - * of its components will be persisted in a calendar store. - * - * @return a JulianString containing the curl - */ - JulianString getCurl() const {return m_sCurl;} - - /** - * Set the default curl for this nsCalendar. - */ - void setCurl(const char* ps) {m_sCurl = ps;} - - /** - * Set the default curl for this nsCalendar. - */ - void setCurl(const JulianString& s) {m_sCurl = s;} - - /** - * Returns calendar in a human-readable format to a string. - * - * @return UnicodeString - */ - UnicodeString toString(); - - /** - * Returns the header information of this calendar in a string reference. The header - * information is defined to be the calendar properties such as - * method, version, prodid, calscale, name, and source. - * @param UnicodeString & sResult - * - * @return UnicodeString & - */ - UnicodeString & createCalendarHeader(UnicodeString & sResult); - - /** - * Returns calendar in ICAL format to a string. - * - * @return UnicodeString - */ - UnicodeString toICALString(); - - /** - * Returns calendar in ICAL format to a string with the component pattern - * specified. - * - * @return UnicodeString - */ - UnicodeString toFilteredICALString(UnicodeString componentPattern); - - /** - * Create a VFreebusy object with the correct freebusy periods - * depending on the current VEvent vector. The start and end time - * of the VFreebusy will defined from the start and end parameters. - * Clients must delete returned object. - * @param start start time of VFreebusy - * @param end end time of VFreebusy - * - * @return new VFreebusy representing freebusy time from [start-end] - */ - VFreebusy * createVFreebusy(DateTime start, DateTime end); - - /** - * Fill in a VFreebusy object with the correct freebusy periods - * depending on the current VEvent vector. The start and end time - * of the VFreebusy will defined from the DTSTART and DTEND values - * of the VFreebusy. - * @param VFreebusy * toFillIn - */ - void calculateVFreebusy(VFreebusy * toFillIn); - - /** - * Return the first VFreebusy with a specified UID and sequence no. - * If sequence number set to -1, just search on UID. - * @param sUID target UID to look for - * @param iSeqNo target seqNo to look for - * - * @return first VFreebusy matching uid, sequence number. - */ - VFreebusy * getVFreebusy(UnicodeString sUID, t_int32 iSeqNo = -1); - /*VFreebusy * getVFreebusy(JulianPtrArray * out, DateTime start, DateTime end);*/ - - /** - * Return the first VEvent with a specified UID and sequence no. - * If sequence number set to -1, just search on UID. - * @param sUID target UID to look for - * @param iSeqNo target seqNo to look for - * - * @return first VEvent matching uid, sequence number. - */ - VEvent * getEvent(UnicodeString sUID, t_int32 iSeqNo = -1); - - /** - * Return the first VTodo with a specified UID and sequence no. - * If sequence number set to -1, just search on UID. - * @param sUID target UID to look for - * @param iSeqNo target seqNo to look for - * - * @return first VTodo matching uid, sequence number. - */ - VTodo * getTodo(UnicodeString sUID, t_int32 iSeqNo = -1); - - /** - * Return the first VJournal with a specified UID and sequence no. - * If sequence number set to -1, just search on UID. - * @param sUID target UID to look for - * @param iSeqNo target seqNo to look for - * - * @return first VJournal matching uid, sequence number. - */ - VJournal * getJournal(UnicodeString sUID, t_int32 iSeqNo = -1); - - /** - * Add the ICalComponent to the vector of Events. - * NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate - * this may change later - * NOTE: changed from VEvent * v to ICalComponent * v. - * @param v VEvent to add - */ - void addEvent(ICalComponent * v); - - /** - * Append the supplied vector of events to this NSCalendar's - * event list. Note that it does not clone the events. It simply - * adds the pointer to the events to the event list. - * @param pEventList the list of events to add... - */ - void addEventList(JulianPtrArray *pEventList); - - /** - * Add the ICalComponent to the vector of Todos. - * NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate - * this may change later - * NOTE: changed from VTodo * v to ICalComponent * v. - * @param v VTodo to add - */ - void addTodo(ICalComponent * v); - - /** - * Add the ICalComponent to the vector of Journals. - * NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate - * this may change later - * NOTE: changed from VJournal * v to ICalComponent * v. - * @param v VJournal to add - */ - void addJournal(ICalComponent * v); - - /** - * Add the ICalComponent to the vector of VFreebusy. - * NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate - * this may change later - * NOTE: changed from VFreebusy * v to ICalComponent * v. - * @param v VFreebusy to add - */ - void addVFreebusy(ICalComponent * v); - - /** - * Add the ICalComponent to the vector of VTimeZone. - * NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate - * this may change later - * NOTE: changed from VTimezone * v to ICalComponent * v. - * @param v VTimeZone to add - */ - void addTimeZone(ICalComponent * v); - - /** - * Return ptr to vector of events - * @return ptr to vector of events - */ - JulianPtrArray * getEvents() const { return m_VEventVctr; } - - /** - * XXX: Temp hack. - * This is used to remove the ownership of the vector of events - * from this calendar to nobody. It does this by returning - * the pointer to m_VEventVctr, then setting the internal value - * of m_VEventVctr to 0. Thus when this NSCalendar is destroyed - * the vector of events is not. - * The caller now owns the vector of events and must delete it - * and its VEvent contents. - * This method should be called only when moving events from - * one calendar to another. - * - * @return the pointer to the vector of events - */ - JulianPtrArray * changeEventsOwnership(); - - /** - * Return ptr to vector of vfreebusies - * @return ptr to vector of vfreebusies - */ - JulianPtrArray * getVFreebusy() const { return m_VFreebusyVctr; } - - /** - * Return ptr to vector of todos - * @return ptr to vector of todos - */ - JulianPtrArray * getTodos() const { return m_VTodoVctr; } - - /** - * Return ptr to vector of journals - * @return ptr to vector of journals - */ - JulianPtrArray * getJournals() const { return m_VJournalVctr; } - - /** - * Return ptr to vector of timezones - * @return ptr to vector of timezones - */ - JulianPtrArray * getTimeZones() const { return m_VTimeZoneVctr; } - - /** - * Given a vector of components, and the type of the component, prints - * each component in vector to its default human-readable string value - * Each string is appended to resulting string and is returned in out. - * For debugging uses. - * @param components vector of components to print - * @param sType type of component in string - * @param out resulting output string - * - * @return output string (out) - */ - static UnicodeString & debugPrintComponentVector(JulianPtrArray * components, - const UnicodeString sType, UnicodeString & out); - - /** - * Fills is the vector retUID with a list of unique uids for this component type - * client must delete contents of retUID. - * @param fillin - * - * @return void - */ - void getUniqueUIDs(JulianPtrArray * retUID, ICalComponent::ICAL_COMPONENT type); - - /** - * Fills in out with VEvents with UID equal to sUID, client must - * delete contents of events - * @param XPPtrArray * out - * @param UnicodeString & sUID - * - * @return void - */ - void getEvents(JulianPtrArray * out, UnicodeString & sUID); - - - /** - * Fetch events by (uid, rec-id, modifier). - * set rec-id to "" if no rec-id. set modifier to "" if no - * modifier. - * - * @param JulianPtrArray * out - * @param UnicodeString & sUID - * @param UnicodeString & sRecurrenceID - * @param UnicodeString & sModifier - * - * @return void - */ - void getEventsByComponentID(JulianPtrArray * out, UnicodeString & sUID, - UnicodeString & sRecurrenceID, UnicodeString & sModifier); - - /** - * Get events by date range, adds ptr to out, not clones of ptrs. - */ - void getEventsByRange(JulianPtrArray * out, DateTime start, DateTime end); - - /** - * Fills in out with VTodos with UID equal to sUID, client must - * delete contents of events - * @param XPPtrArray * out - * @param UnicodeString & sUID - * - * @return void - */ - void getTodos(JulianPtrArray * out, UnicodeString & sUID); - - /** - * Fills in out with VJournals with UID equal to sUID, client must - * delete contents of events - * @param XPPtrArray * out - * @param UnicodeString & sUID - * - * @return void - */ - void getJournals(JulianPtrArray * out, UnicodeString & sUID); - - /** - * Sorts vector of components by UID, - * passing in type to decide which vector to sort - * @param type component type of vector (VEVENT, VTODO, etc.) - */ - void sortComponentsByUID(ICalComponent::ICAL_COMPONENT type); - - /** - * Sorts vector of components by DTSTART value, - * passing in type to decide which vector to sort - * @param type component type of vector (VEVENT, VTODO, etc.) - */ - void sortComponentsByDTStart(ICalComponent::ICAL_COMPONENT type); - -protected: - - /** - * Populates property data members. Does this by taking contents of - * property value and storing in appropriate property, with - * parameters also being stored. Basically a big switch statement - * on the property name. - * @param strLine current parsed line - * @param propName property name - * @param propVal property value - * @param parameters parameters of property - * - * @return TRUE (TODO: may remove later) - */ - t_bool storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters); - - /*void selfCheck();*/ - - /** - * Helper method that expands the VEvent, VTodo, and VJournal - * vectors. - * - * @return void - */ - void expandAllComponents(); - -private: - - - - /** - * Add component with type to correct vector. For example, - * if type == ICAL_COMPONENT_VEVENT, then add to event vector. - * Return TRUE if component was updated with component already in store, - * otherwise return FALSE if component had to be added to store. - * @param ic component to add - * @param type type of component - * @return TRUE if component was updated, FALSE if component was added - */ - t_bool addComponentWithType(ICalComponent * ic, - ICalComponent::ICAL_COMPONENT type); - -#if 0 - /** - * Adds a vector of components with type to correct vector. - * Make sure all elements in components vector have - * component type equal to type. - * @param components vector of components - * @param type type of all components in vector - */ - void addComponentsWithType(JulianPtrArray * components, - ICalComponent::ICAL_COMPONENT type); -#endif - - /** - * Expand each component in vector of TimeBasedEvents - * with component type = type. - * @param v vector of TimeBasedEvents - * @param type type of all components in vector - */ - void expandTBEVector(JulianPtrArray * v, - ICalComponent::ICAL_COMPONENT type); - - - /** - * Expand a TimeBasedEvent with component type = type - * @param e TimeBasedEvent to expand - * @param type component type of TimeBasedEvent - */ - void expandComponent(TimeBasedEvent * e, - ICalComponent::ICAL_COMPONENT type); - - /** - * Helper method sorts ICalComponents by UID. - * Only applicable for VEvent, VTodo, VJournal, VFreebusy - * vectors. - * @param components vector of components to sort - * @param type type of all components in vector - */ - static void sortComponentsByUIDHelper(JulianPtrArray * components, - ICalComponent::ICAL_COMPONENT type); - - /** - * Helper method sorts ICalComponents by DTSTART. - * Only applicable for VEvent, VTodo, VJournal, VFreebusy - * vectors. - * @param components vector of components to sort - * @param type type of all components in vector - */ - static void sortComponentsByDTStartHelper(JulianPtrArray * components, - ICalComponent::ICAL_COMPONENT type); - - /** - * Fills in retUID vector with all unique UIDs found in components vector. - * Does this by sorting components vector by UID, then marching down. - * vector. O(nlogn + n). - * @param retUID fill in with all unique UIDs - * @param components vector of components to look through - * @param type type of all components in vector. - */ - static void getUniqueUIDsHelper(JulianPtrArray * retUID, - JulianPtrArray * components, ICalComponent::ICAL_COMPONENT type); -#if 0 - /** - * Fills in out vector with ICalComponents with UID = uid and - * with GetType() == type. - * @param out fill in with components with uid, type match - * @param uid target UID - * @param type target component type - */ - void getComponentsWithType(JulianPtrArray * out, UnicodeString & uid, - ICalComponent::ICAL_COMPONENT type); -#endif - /** - * Fetch components by (uid, rec-id, modifier). - * set rec-id to "" if no rec-id. set modifier to "" if no - * modifier. - * - * @param JulianPtrArray * out - * @param UnicodeString & sUID - * @param UnicodeString & sRecurrenceID - * @param UnicodeString & sModifier - * - * @return void - */ - void getTBEWithTypeByComponentID(JulianPtrArray * out, UnicodeString & sUID, - UnicodeString & sRecurrenceID, UnicodeString & sModifier, - ICalComponent::ICAL_COMPONENT type); - - /** - * Fills in out with TimeBasedEvents with the following - * if sRecurrenceID.isValid() - * { - * if sModifier == NONE, just get components that match (uid, recid) - * else if sModifier = THISANDPRIOR, get components that match (uid, recid, THISANDPRIOR) - * else if sModifier = THISANDFUTURE, get components that match (uid, recid, THISANDFUTURE) - * - * } - * else - * call getComponents(out, components, sUID); - * - * @param JulianPtrArray * out - * @param JulianPtrArray * component - * @param UnicodeString & sUID - * @param UnicodeString & sRecurrenceID - * @param UnicodeString & sModifier - * - * @return void - */ - void getTBEByComponentID(JulianPtrArray * out, - JulianPtrArray * component, UnicodeString & sUID, - UnicodeString & sRecurrenceID, UnicodeString & sModifier); - - /** - * Fills in out with ICalComponents with UID = sUID. - * NOTE: clients NOT responsible for deleting components (passing actual ptr) - * @param out fill in with components with uid = sUID - * @param components vector of components to look through - * @param sUID target UID - */ - static void getComponents(JulianPtrArray * out, JulianPtrArray * components, - UnicodeString & sUID); - - /** - * return the ICalComponent that matches the uid and sequence # - */ - - /** - * Return the ICalComponent that matches the UID and sequence number. - * If sequence number is -1, then just match on UID. - * @param vTBE vector of components to look through - * @param sUID target UID - * @param iSeqNo target sequence number - * - * @return first ICalComponent matching UID, iSeqNo. - */ - static ICalComponent * getComponent(JulianPtrArray * vTBE, - UnicodeString & sUID, t_int32 iSeqNo = -1); - - - /** - * Prints each component in components vector to ICAL export string - * and append result to out. Resulting output string contains - * all component's iCal export string. - * @param components vector of components to print in ICAL - * @param out output string - * - * @return output string (out) - */ - static UnicodeString & printComponentVector(JulianPtrArray * components, - UnicodeString & out); - - /** - * Prints each component in components vector to ICAL export string - * to file f. Resulting output string contains all component's iCal export string. - * @param components vector of components to print in ICAL - * @param f FILE to print to - * @return TRUE if written OK, FALSE otherwise. - */ - static t_bool printComponentVectorToFile(JulianPtrArray * components, FILE * f); - -public: - /** - * Prints each component in components vector to ICAL export string - * and append result to out. Resulting output string contains - * events with filtered properties depending on strFmt. - * all component's iCal export string. - * @param components vector of components to print in ICAL - * @param strFmt component formatting string to apply - * @param out output string - * - * @return output string (out) - */ - static UnicodeString & printFilteredComponentVector(JulianPtrArray * components, - UnicodeString & strFmt, UnicodeString & out); -private: - /** - * Helper method. Fills in Freebusy object f with periods representing - * free and busy time periods of this calendar from start to end time. - * Calculates periods by looking through event vector and using - * events with TRANSP = OPAQUE. - * @param f Freebusy object to fill in with periods - * @param start start of freebusy period - * @param end end of freebusy period - */ - void createVFreebusyHelper(Freebusy * f, DateTime start, DateTime end); - -public: - /** - * update the m_EventsSpanStart and m_EventsSpanEnd members - * taking into account new VEvent. - */ - void updateEventsRange(VEvent * v); - - /** - * caller of FetchEventsByRange must be able to set the known - * event range span. There may not have been any events in - * the database within a range. If ther are, the events do not - * necessarily span the full range. In any case, we need to be - * able to update known limits on the event range... - * -sman 10/12/98 - * @param DTStart Known good start time - * @param DTEnd Known good stop time - */ - void updateEventsRange(DateTime DTStart, DateTime DTEnd); - -private: - /* -- private data members -- */ - - /* parsing flags */ - static t_bool m_bLoadMultipleCalendars; - static t_bool m_bSmartLoading; - - /* vector of calendar components */ - JulianPtrArray * m_VJournalVctr; - JulianPtrArray * m_VEventVctr; - JulianPtrArray * m_VTodoVctr; - JulianPtrArray * m_VTimeZoneVctr; - JulianPtrArray * m_VFreebusyVctr; - - /* vector of x-tokens */ - JulianPtrArray * m_XTokensVctr; - - /* NSCalendar properties */ - ICalProperty * m_CalScale; - ICalProperty * m_Version; - ICalProperty * m_Prodid; -#if 0 - ICalProperty * m_Source; - ICalProperty * m_Name; -#endif - /*ICalProperty * m_Method; - UnicodeString & m_Method;*/ - - /** method is stored as int */ - t_int32 m_iMethod; - - /* log file pointer */ - JLog * m_Log; - - - /** - * the timestamp of the last time these events were updated - */ - DateTime m_EventsLastUpdatedFromServer; - - /** - * the start of end time range of events. - */ - DateTime m_EventsSpanStart; - DateTime m_EventsSpanEnd; - - JulianString m_sCurl; /* cal url to calendar store for this calendar */ -}; - -#endif /* __NSCALENDAR_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/nscalcoreicalCIID.h b/mozilla/calendar/modules/core/ical/inc/nscalcoreicalCIID.h deleted file mode 100644 index e91aed3810b..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nscalcoreicalCIID.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nscalcoreicalCIID_h__ -#define nscalcoreicalCIID_h__ - -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsRepository.h" - -// 2b502840-646e-11d2-943c-006008268c31 -#define NS_CALICALENDARVCALENDAR_CID \ - { 0x2b502840, 0x646e, 0x11d2, \ - {0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//8cda7330-646e-11d2-943c-006008268c31 -#define NS_CALICALENDARVEVENT_CID \ - { 0x8cda7330, 0x646e, 0x11d2, \ - {0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//904609a0-646e-11d2-943c-006008268c31 -#define NS_CALICALENDARVTODO_CID \ - { 0x904609a0, 0x646e, 0x11d2, \ - {0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//9101fdb0-646e-11d2-943c-006008268c31 -#define NS_CALICALENDARVJOURNAL_CID \ - { 0x9101fdb0, 0x646e, 0x11d2, \ - {0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//9177a720-646e-11d2-943c-006008268c31 -#define NS_CALICALENDARVFREEBUSY_CID \ - { 0x9177a720, 0x646e, 0x11d2, \ - {0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//91ad22b0-646e-11d2-943c-006008268c31 -#define NS_CALICALENDARVTIMEZONE_CID \ - { 0x91ad22b0, 0x646e, 0x11d2, \ - {0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//91d97320-646e-11d2-943c-006008268c31 -#define NS_CALICALENDARVALARM_CID \ - { 0x91d97320, 0x646e, 0x11d2, \ - {0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//9205c390-646e-11d2-943c-006008268c31 -#define NS_CALDATETIMEPROPERTY_CID \ - { 0x9205c390, 0x646e, 0x11d2, \ - { 0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//92352260-646e-11d2-943c-006008268c31 -#define NS_CALSTRINGPROPERTY_CID \ - { 0x92352260, 0x646e, 0x11d2, \ - { 0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//925cdd40-646e-11d2-943c-006008268c31 -#define NS_CALINTEGERPROPERTY_CID \ - { 0x925cdd40, 0x646e, 0x11d2, \ - { 0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//9287a680-646e-11d2-943c-006008268c31 -#define NS_CALICALENDARTIMEBASEDEVENT_CID \ - { 0x9287a680, 0x646e, 0x11d2, \ - {0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//92b3f6f0-646e-11d2-943c-006008268c31 -#define NS_CALATTENDEEPROPERTY_CID \ - { 0x92b3f6f0, 0x646e, 0x11d2, \ - { 0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -//92dec030-646e-11d2-943c-006008268c31 -//9329a060-646e-11d2-943c-006008268c31 - -#endif - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/nscalcoreicalexp.h b/mozilla/calendar/modules/core/ical/inc/nscalcoreicalexp.h deleted file mode 100644 index f1049c0542f..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/nscalcoreicalexp.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nscalcoreicalexp_h__ -#define nscalcoreicalexp_h__ - -#include "nscore.h" - -#ifdef _IMPL_NS_CAL_CORE_ICAL -#define NS_CAL_CORE_ICAL NS_EXPORT -#else -#define NS_CAL_CORE_ICAL NS_IMPORT -#endif - -#endif /* nscalcoreicalexp_h__ */ diff --git a/mozilla/calendar/modules/core/ical/inc/orgnzr.h b/mozilla/calendar/modules/core/ical/inc/orgnzr.h deleted file mode 100644 index a841f0c8851..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/orgnzr.h +++ /dev/null @@ -1,277 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * orgnzr.h - * John Sun - * 4/7/98 11:16:49 AM - */ - -#ifndef __NSCALORGANIZER_H_ -#define __NSCALORGANIZER_H_ - -#include "jlog.h" -#include "prprty.h" - -/** - * Encapsulates a Calendar Component's organizer. - * Similar to the Attendee property, but doesn't - * have as much state. - */ -class nsCalOrganizer : public ICalProperty -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - - /** - * the name of the nsCalOrganizer. Whatever is to the right of the colon - * the name must be a URL. Field must be filled to be valid Attendee. - */ - UnicodeString m_Name; - - /** the common name of attendee. Optional, default is "". */ - UnicodeString m_CN; - - /** the MAILTO: of a calendar user acting on behalf of the attendee. - * Optional, default is "". - */ - UnicodeString m_SentBy; - - /** the location of the Attendee's directory information. - * Optional, default is "". */ - UnicodeString m_Dir; - - /** the language of the common name of the attendee. Optional, default is "". */ - UnicodeString m_Language; - - /** ptr to log file to write errors to */ - JLog * m_Log; - - static const t_int32 ms_cnsCalOrganizerName;/* = 'N';*/ - static const t_int32 ms_cnsCalOrganizerDir; /* = 'l'; 'el'*/ - static const t_int32 ms_cnsCalOrganizerSentBy;/* = 's';*/ - static const t_int32 ms_cnsCalOrganizerCN;/* = 'C';*/ - static const t_int32 ms_cnsCalOrganizerLanguage;/* = 'm';*/ - static const t_int32 ms_cnsCalOrganizerDisplayName;/* = 'z';*/ - - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - nsCalOrganizer(nsCalOrganizer & that); - -public: - - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - nsCalOrganizer(JLog * initLog = 0); - ~nsCalOrganizer(); - - /*---------- To satisfy ICalProperty interface ----------*/ - /** - * Sets parameters. - * @param parameters vector of parameters to set - * - */ - virtual void setParameters(JulianPtrArray * parameters); - - /** - * Return value of property. Never use. Use getName(). - * - * @return value of property - */ - virtual void * getValue() const; - - /** - * Sets value of property. Never use. Use setName(). - * @param value new value of property - * - */ - virtual void setValue(void * value); - - /** - * Returns a clone of this property. - * @param initLog the log file for clone to write to - * - * @return clone of this ICalProperty object - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Checks whether this property is valid or not. Must have MAILTO: in - * front of attendee name to be valid. - * - * @return TRUE if property is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return property to human-readable string. - * @param dateFmt formatting string - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & strFmt, UnicodeString & out); - - /** - * Return property to human-readable string. - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return property to iCal property string. - * @param out output iCal string - * - * @return output iCal string (out) - */ - virtual UnicodeString & toICALString(UnicodeString & out); - - /** - * Return property to iCal property string. Inserts sProp to - * front of output string. sProp should be the property name of this - * property. - * @param sProp property name to append to insert at front of out - * @param out output iCal string with sProp in front - * - * @return output iCal string with sProp in front (out) - */ - virtual UnicodeString & toICALString(UnicodeString & sProp, UnicodeString & out); - /*----------End of ICalProperty interface----------*/ - - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - - /** - * Sets nsCalOrganizer name. - * @param sName new Attendee name - * - */ - void setName(UnicodeString sName); - - /** - * Returns nsCalOrganizer name. - * - * @return Attendee name - */ - UnicodeString getName() const { return m_Name; } - - /** - * Set CN (common-name) value - * @param new CN value - */ - void setCN(UnicodeString u) { m_CN = u; } - - /** - * Set Language value - * @param new Language value - */ - void setLanguage(UnicodeString u) { m_Language = u; } - - /** - * Set DIR (location of directory info) value - * @param new DIR value - */ - void setDir(UnicodeString u) { m_Dir = u; } - - /** - * Set SENT-BY (calendar user acting on behalf of the attendee) value - * @param new SENT-BY value - */ - void setSentBy(UnicodeString u) { m_SentBy = u; } - - /** - * Return CN (common-name) value - * - * @return CN value - */ - UnicodeString getCN() const { return m_CN; } - - /** - * Return Language value - * - * @return Language value - */ - UnicodeString getLanguage() const { return m_Language; } - - /** - * Return DIR (location of directory info) value - * - * @return DIR value - */ - UnicodeString getDir() const { return m_Dir; } - - /** - * Return SENT-BY (calendar user acting on behalf of the organizer) value - * - * @return SENT-BY value - */ - UnicodeString getSentBy() const { return m_SentBy; } - - /*----------------------------- - ** UTILITIES - **---------------------------*/ - - /** - * Given attendee name and parameters, populates Attendee - * data members. - * @param propVal attendee name - * @param parameters attendee parameters - * - */ - void parse(UnicodeString & propVal, JulianPtrArray * parameters = 0); - - /** - * Sets parameter with name paramName with value paramVal. - * For MEMBER, DELEGATED-TO, DELEGATED-FROM, DIR, SENT-BY, the - * double quotes are stripped. THE MAILTO: is not stripped. - * - * @param paramName parameter name to set - * @param paramVal new value of parameter - */ - void setParam(UnicodeString & paramName, UnicodeString & paramVal); - - /** - * convert a character to the content of a parameter in - * human-readable string format - * - * @param c a character represents a parameter - * @return parameter in a human-readable string - */ - UnicodeString toStringChar(t_int32 c); - - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - /*----------------------------- - ** OVERLOADED OPERATORS - **---------------------------*/ -}; - -#endif /* __NSCALORGANIZER_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/period.h b/mozilla/calendar/modules/core/ical/inc/period.h deleted file mode 100644 index e459f5fd99d..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/period.h +++ /dev/null @@ -1,323 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * period.h - * John Sun - * 1/29/98 11:16:33 AM - */ - -#ifndef __PERIOD_H_ -#define __PERIOD_H_ - -#include "datetime.h" -#include "duration.h" -#include "ptrarray.h" - -class Period -{ -private: - - /*----------------------------- - ** MEMBERS - **---------------------------*/ - - /** the starting time of the period */ - DateTime m_DTStart; - - /** the ending time of the period */ - DateTime m_DTEnd; - - /** the duration of the period */ - nsCalDuration m_Duration; - - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - - /** - * Parses an iCal Period string and - * populates date members. - * @param us iCal Period string - */ - void parse(UnicodeString & us); - - /** checks period's data members */ - void selfCheck(); - - /** create invalid period */ - void createInvalidPeriod(); - - - /** - * Helper method to get a part of period string. - * If bStart is TRUE, get the start string part, - * else get end string part. - * @param sPeriod period string - * @param bStart start or end - * @param out output start or end string - * - * @return output start or end string (out) - */ - static UnicodeString & getTimeString(UnicodeString & sPeriod, - t_bool bStart, UnicodeString & out); -public: - - /** - * Retuns ending time regardless if dtend is invalid. - * If DTEnd is invalid, will then add duration to start to - * get ending time. - * @param d output ending datetime - * - * @return ouptu ending datetime (d) - */ - DateTime & getEndingTime(DateTime & d); - - /** - * Constructor. Creates invalid period. - */ - Period(); - - /** - * Copy constructor. - * @param that period to copy - */ - Period(Period & that); - - /** - * Constructor. Creates period by parsing string. - * @param us string to parse - */ - Period(UnicodeString & us); - - /** - * Destructor. - */ - ~Period(); - - /** - * Return start time. - * - * @return DateTime - */ - DateTime getStart() { return m_DTStart; } - - /** - * Return dtend (may be invalid). - * - * @return DateTime - */ - DateTime getEnd() { return m_DTEnd; } - - /** - * Return duration (may be invalid). - * - * @return nsCalDuration - */ - nsCalDuration getDuration() { return m_Duration; } - - /** - * Set start time - * @param d new start value - */ - void setStart(DateTime d); - - /** - * Set end time - * @param d new end value - */ - void setEnd(DateTime d); - - /** - * Set duration - * @param d new duration value - */ - void setDuration(nsCalDuration d); - - /** - * Set period by passing string. - * @param us string to parse. - */ - void setPeriodString(UnicodeString & us); - - /* UTILITIES */ - - /** - * Return if this period is valid. A valid period must have a - * valid start datetime and a valid end datetime or a valid duration time. - * and the end time must be after the start time. - * - * @return TRUE if valid, FALSE otherwise - */ - t_bool isValid(); - - /** - * Return if this period intersects start, end range - * @param start start of target range - * @param end end of target range - * - * @return TRUE if in range, FALSE otherwise - */ - t_bool isIntersecting(DateTime & start, DateTime & end); - - /** - * Return if this period intersects period range - * @param p target range - * - * @return TRUE if in range, FALSE otherwise - */ - t_bool isIntersecting(Period & p); - - /** - * Return if this period is completely inside start, end range - * @param start start of target range - * @param end end of target range - * - * @return TRUE if completely inside range, FALSE otherwise - */ - t_bool isInside(DateTime & start, DateTime & end); - - /** - * Return if this period is completely inside period range - * @param p target range - * - * @return TRUE if in range, FALSE otherwise - */ - t_bool isInside(Period & p); - - /** - * Returns period in human readable format of "start - end". - * - * @return output string - */ - UnicodeString toString(); - - /** - * Returns period in iCal period format of "start/end", where - * start is UTC ISO8601 datetime format and end is either - * a UTC IS08601 datetime format or an iCal nsCalDuration string. - * - * @return output string - */ - UnicodeString toICALString(); - - /* STATIC METHODS */ - - /** - * Checks whether periods are connected. Connected means that the - * two periods combined form one block of time. Returns TRUE if - * p1 and p2 are connected, FALSE otherwise. - * @param p1 first period - * @param p2 second period - * - * @return TRUE if p1,p2 are connected, FALSE otherwise - */ - static t_bool IsConnectedPeriods(Period & p1, Period & p2); - - /** - * Returns the union of two periods in outPer, if possible. - * If the union of the two-periods is not possible in one period - * (i.e. inPer1, inPer2 are disjoint) then return an invalid period. - * @param inPer1 first period - * @param inPer2 second period - * @param outPer return union of inPer1, inPer2. - * Invalid if inPer1,inPer are disjoint - */ - static void Union(Period & inPer1, Period & inPer2, Period & outPer); - - /** - * Returns the intersection of this period with the range - * (start,end) into outPer if possible. If the - * intersection is null (i.e. inPer1, [start, end) are disjoint) - * then return an invalid period in outPer. - * @param iPer1 a period - * @param start start of range - * @param end end of range - * @param outPer output intersection of iPer1 with (start,end) range - * - */ - static void Intersection(Period & iPer1, DateTime & start, DateTime & end, Period & outPer); - - /** - * Fill in vector out with periods inside inPer that are outside of - * (start, end) range. This simulates logical subtraction of periods - * @param inPer a period - * @param start start of range - * @param end end of range - * @param out output vector of periods inside inPer but outside (start,end) - * - */ - static void SubtractedPeriod(Period & inPer, DateTime & start, DateTime & end, JulianPtrArray * out); - - /** - * Checks to see if u is a parseable iCal Period string. Return TRUE - * if parseable, FALSE otherwise. - * @param u target period string - * - * @return TRUE if parseable iCal Period, FALSE otherwise. - */ - static t_bool IsParseable(UnicodeString & u); - - - /** - * Gets starting time string from sPeriod. - * @param sPeriod input period string - * @param out output starting time string - * - * @return output starting time string (out) - */ - static UnicodeString & getStartTimeString(UnicodeString & sPeriod, UnicodeString & out); - - /** - * Gets ending time string from sPeriod. Ending time maybe a - * duration string or a datetime string - * @param sPeriod input period string - * @param out output ending time string - * - * @return output ending time string (out) - */ - static UnicodeString & getEndTimeString(UnicodeString & sPeriod, UnicodeString & out); - - /** - * Compares periods by their starting time. Used - * to pass into JulianPtrArray::QuickSort method. - * @param a ptr to first period - * @param b ptr to second period - * - * @return compareTo(a.start, b.start) - */ - static int ComparePeriods(const void * a, const void * b); - - /** - * Compares periods by their ending time. Used - * to pass into JulianPtrArray::QuickSort method. - * @param a ptr to first period - * @param b ptr to second period - * - * @return compareTo(a.getEndingTime(), b.getEndingTime()) - */ - static int ComparePeriodsByEndTime(const void * a, const void * b); -}; - -#endif /* __PERIOD_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/pprprty.h b/mozilla/calendar/modules/core/ical/inc/pprprty.h deleted file mode 100644 index 3aa18519898..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/pprprty.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * pprprty.h - * John Sun - * 2/12/98 4:20:47 PM - */ - -#include -#include "sdprprty.h" -#include "period.h" - -#ifndef __PERIODPROPERTY_H_ -#define __PERIODPROPERTY_H_ - -/** - * PeriodProperty is a subclass of StandardProperty. It implements the ICalProperty - * interface for ICAL properties with TYPE=PERIOD. - */ -class PeriodProperty: public StandardProperty -{ -private: - /** the Period value of the property */ - Period * m_Period; - - /** - * Default constructor - */ - PeriodProperty(); - - /** - * Copy constructor - * @param that property to copy - */ - PeriodProperty(const PeriodProperty & that); -public: - - /** - * Constructor that sets value of property to contents of value - * and makes a copy of the contents of parameters ptr. - * @param value value of property - * @param parameters parameters of property - */ - PeriodProperty(Period * value, JulianPtrArray * parameters); - - /** - * Destructor - */ - ~PeriodProperty(); - - /** - * Return the value of the property - * @return void * ptr to value of the property - */ - virtual void * getValue() const; - - /** - * Set the value of the property - * @param value the value to set property to - */ - virtual void setValue(void * value); - - /** - * Returns a clone of this property. Clients are responsible for deleting - * the returned object. - * - * @return a clone of this property. - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Return TRUE if property is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return a string in human-readable form of the property. - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return a string in human-readable form of the property. - * @param dateFmt format string options - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out); - - /** - * Return the property's string in the ICAL format. - * @param out contains output ICAL string - * - * @return the property in its ICAL string format - */ - virtual UnicodeString & toExportString(UnicodeString & out); -}; - -#endif /* __PERIODPROPERTY_H_ */ - - - - diff --git a/mozilla/calendar/modules/core/ical/inc/prprty.h b/mozilla/calendar/modules/core/ical/inc/prprty.h deleted file mode 100644 index ec7b82dc0d3..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/prprty.h +++ /dev/null @@ -1,415 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * prprty.h - * John Sun - * 2/10/98 4:03:56 PM - */ - -#include -#include "jdefines.h" -#include "ptrarray.h" -#include "icalprm.h" -#include "jatom.h" -#include "jlog.h" -#include "nscalcoreicalexp.h" - -#ifndef __ICALPROPERTY_H_ -#define __ICALPROPERTY_H_ - -/** - * The ICalProperty class defines the interface for methods that - * all iCal Calendar properties must implement. Also defines some - * static helper methods. - */ -class NS_CAL_CORE_ICAL ICalProperty -{ -public: - /** Enumeration defines ICalProperty types */ - enum PropertyTypes{TEXT, DATETIME, INTEGER, PERIOD, DURATION, BOOLEAN}; - -protected: - - /** - * Default constructor. Hide from clients. - * Only subclasses allowed to use it. - */ - ICalProperty(); - - /** - * Copy constructor. - * @param that ICalProperty to copy - */ - ICalProperty(ICalProperty & that); - -public: - - /** - * Virtual Destructor. - */ - virtual ~ICalProperty() {} - - /* -- interface of methods that subclasses must implement (pure-virtual) -- */ - - /** - * Sets parameters. - * @param parameters vector of parameters to set - * - */ - virtual void setParameters(JulianPtrArray * parameters) - { PR_ASSERT(FALSE); if (parameters) {} } - - /** - * Return value of property - * - * @return value of property - */ - virtual void * getValue() const { PR_ASSERT(FALSE); return 0;} - - /** - * Sets value of property. - * @param value new value of property - * - */ - virtual void setValue(void * value) { PR_ASSERT(FALSE); if (value != 0) {} ; } - - /** - * Returns a clone of this property. - * @param initLog the log file for clone to write to - * - * @return clone of this ICalProperty object - */ - virtual ICalProperty * clone(JLog * initLog) - { PR_ASSERT(FALSE); if (initLog) {} return 0; } - - /** - * Checks whether this property is valid or not - * - * @return TRUE if property is valid, FALSE otherwise - */ - virtual t_bool isValid() { PR_ASSERT(FALSE); return FALSE; } - - /** - * Return property to human-readable string. - * @param dateFmt formatting string - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & dateFmt, - UnicodeString & out) - { PR_ASSERT(FALSE); if (dateFmt.size() > 0) {} ; return out; } - - /** - * Return property to human-readable string. - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & out) - { PR_ASSERT(FALSE); return out; } - - - /** - * Return property to iCal property string. - * @param out output iCal string - * - * @return output iCal string (out) - */ - virtual UnicodeString & toICALString(UnicodeString & out) { PR_ASSERT(FALSE); return out; } - - /** - * Return property to iCal property string. Inserts sProp to - * front of output string. sProp should be the property name of this - * property. - * @param sProp property name to append to insert at front of out - * @param out output iCal string with sProp in front - * - * @return output iCal string with sProp in front (out) - */ - virtual UnicodeString & toICALString(UnicodeString & sProp, - UnicodeString & out) - { PR_ASSERT(FALSE); if (sProp.size() > 0) {} return out; } - -#if 0 - virtual UnicodeString & getParameterValue(UnicodeString & paramName, /* IN */ - UnicodeString & paramVal, ErrorCode & status) /* OUT, OUT */ - { - PR_ASSERT(FALSE); if (paramName.size() > 0 && paramVal.size() > 0 && - status) {} - return paramVal; - } - - virtual void setParameter(UnicodeString & paramName, UnicodeString & paramValue) - { - PR_ASSERT(FALSE); if (paramName.size() > 0 && paramValue.size() > 0) {} - } - - void parse(UnicodeString & in) { PR_ASSERT(FALSE); if (in.size() > 0) {}} -#endif - - /* -- END of interface of methods that subclasses must implement (pure-virtual) -- */ - - - /*---------------------------- - ** STATIC METHODS - **--------------------------*/ - - /** - * Given propertyName, propertyValue, and parameters, returns the following string - * - propertyName:parameters[0];parameters[1]...:propertyValue - * @param sProp the property name - * @param sVal the property value - * @param parameters the parameters - * @param retVal the output string - * @return retVal (the output string) - */ - static UnicodeString & propertyToICALString(UnicodeString & sProp, UnicodeString & sVal, - JulianPtrArray * parameters, UnicodeString & retVal); - - /** - * prints string parameters to ICAL export format - * @param sParam parameter name - * @param sVal string parameter value - * @param out output string - * - * @return output string (out) - */ - static UnicodeString & parameterToCalString(UnicodeString sParam, - UnicodeString & sVal, UnicodeString & out); - - /** - * prints string parameters to ICAL export format - * @param sParam parameter name - * @param v vector of strings parameter value - * @param out output string - * - * @return output string (out) - */ - static UnicodeString & parameterVToCalString(UnicodeString param, - JulianPtrArray * v, UnicodeString & out); - - /** - * Prints the property to ICAL format of form - * propName;property.parameters:property.value. - * A null property returns "". - * @param propName property name - * @param property ICalProperty to print - * @param retVal output string - * - * @return output string (retVal) - */ - static UnicodeString & propertyToICALString(UnicodeString & propName, - ICalProperty * property, UnicodeString & retVal); - - /** - * Prints the properties to ICAL format of form - * propName;property1.parameters:property1.value. - * propName;property2.parameters:property2.value. - * propName;property3.parameters:property3.value. - * A null property returns "". - * @param propName property name - * @param properties vector of ICalProperty's to print - * @param retVal output string - * - * @return output string (retVal) - */ - static UnicodeString & propertyVectorToICALString(UnicodeString & propName, - JulianPtrArray * properties, UnicodeString & retVal); - - /** - * Prints the strings to output. Used for printing X-Tokens - * @param strings vector of UnicodeStrings to print - * @param retVal output string - * - * @return output string (retVal) - */ - static UnicodeString & vectorToICALString(JulianPtrArray * strings, UnicodeString & retVal); - - /** - * Prints the property to human-readable format. If property is null return "". - * @param property ICalProperty to print - * @param dateFmt Formatting string to pass to property - * @param retVal output string - * - * @return output string (retVal) - */ - static UnicodeString & propertyToString(ICalProperty * property, UnicodeString & dateFmt, - UnicodeString & retVal); - - /** - * Prints the property to human-readable format. If property is null return "". - * @param property ICalProperty to print - * @param retVal Formatting string to pass to property - * - * @return output string (retVal) - */ - static UnicodeString & propertyToString(ICalProperty * property, UnicodeString & retVal); - - /** - * Prints each ICalProperty in properties to human-readable format. - * @param properties vector of ICalProperty's to print - * @param retVal output string - * - * @return output string (retVal) - */ - static UnicodeString & propertyVectorToString(JulianPtrArray * properties, - UnicodeString & retVal); - - - /** - * Prints each ICalProperty in properties to human-readable format. - * @param properties vector of ICalProperty's to print - * @param dateFmt Formatting string to pass to property - * @param retVal output string - * - * @return static UnicodeString - */ - static UnicodeString & propertyVectorToString(JulianPtrArray * properties, - UnicodeString & dateFmt, UnicodeString & retVal); - -#if 0 - /** - * Given a property name, a parameter name and parameter value, - * make sure that the parameter name is valid for the property. - * Doesn't do anything for the ATTENDEE, FREEBUSY, Recurrence-ID special - * properties. - * @param propName property name - * @param paramName parameter name - * @param paramVal parameter value - * - * @return TRUE if parameter name is valid for property, FALSE otherwise - */ - static t_bool checkParam(UnicodeString & propName, UnicodeString & paramName, - UnicodeString & paramVal); -#endif - - /** - * Given a vector of ICalParameters, an array of valid parameter names, - * and the size of array, return TRUE if all parameters are in the range, - * otherwise return FALSE. - * @param parameters vector of ICalParameter's - * @param validParamNameRange[] array of valid parameter name atoms - * @param validParamNameRangeSize size of validParamNameRange[] - * - * @return TRUE if all parameters in range, FALSE otherwise. - */ - static t_bool CheckParams(JulianPtrArray * parameters, - JAtom validParamNameRange[], - t_int32 validParamNameRangeSize); - - /** - * 7-23-98: TODO: eliminate passing in validValueRange and validValueRangeSize - * now checks for VALUE, ENCOIDNG, RELTYPE values. - * TODO: check RELATED - * given a vector of ICalParameters, an array of valid parameter names, - * and the size of array, an array of valid parameter values for the valueParamName - * type(usually VALUE, but can be RELTYPE), - * return TRUE if all parameters are in the range and the VALUE parameter value - * is in the validValueRange. Otherwise return FALSE; - * @param parameters vector of ICalParameter's - * @param validParamNameRange[] array of valid parameter name atoms - * @param validParamNameRangeSize size of validParamNameRange[] - * @param validValueRange[] array of valid parameter value atoms - * @param validValueRangeSize size of validValudRange[] - * - * @return TRUE if all parameter name and value in range, FALSE otherwise - */ - static t_bool CheckParamsWithValueRangeCheck(JulianPtrArray * parameters, - JAtom validParamNameRange[], - t_int32 validParamNameRangeSize, - JAtom validValueRange[], - t_int32 validValueRangeSize); - - /** - * Parse a line of iCal input and return output into outName, outVal, - * and fill in parameters vector with parsed parameters of line. - * @param aLine input iCal line - * @param outName output property name - * @param outVal output property value - * @param parameters fill-in vector of parameters - */ - static void parsePropertyLine(UnicodeString & aLine, - UnicodeString & outName, UnicodeString & outVal, - JulianPtrArray * parameters); - - - /** - * Trims UnicodeStrings. The UnicodeString::trim() method - * seems to only trim space-separators(ASCII 12 and ' '). - * This method also trims line-seperators(ASCII 13). - * @param string to trim. - * - * @return trimmed string in s - */ - static UnicodeString & Trim(UnicodeString & s); - - /** - * Cleanup method. Deletes each ICalParameter object in vector. - * Doesn't delete actual vector though. - * @param parameters vector of ICalParameter objects - * - */ - static void deleteICalParameterVector(JulianPtrArray * parameters); - - /** - * Cleanup method. Deletes each ICalProperty object in vector. - * Doesn't delete actual vector though. - * @param parameters vector of ICalProperty objects - * - */static void deleteICalPropertyVector(JulianPtrArray * properties); - - /** - * Cleanup method. Deletes each Period object in vector. - * Doesn't delete actual vector though. - * @param parameters vector of Period objects - * - */ - static void deletePeriodVector(JulianPtrArray * periods); - - static UnicodeString & multiLineFormat(UnicodeString & s); - static t_bool IsXToken(UnicodeString & s); - - /** - * Fills out vector with the clone of each ICalProperty in - * the propertiesToClone vector. - * @param propertiesToClone vector of properties to clone - * @param out output vector of clones - * @param initLog log file for clones to write to - * - */ - static void CloneICalPropertyVector(JulianPtrArray * propertiesToClone, JulianPtrArray * out, - JLog * initLog); - - /** - * Fills out vector with the clone of each UnicodeString in - * the stringsToClone vector. - * @param stringsToClone vector of strings to clone - * @param out output vector of clones of strings - * - */ - static void CloneUnicodeStringVector(JulianPtrArray * stringsToClone, JulianPtrArray * out); - -}; - -#endif /* __ICALPROPERTY_H_ */ diff --git a/mozilla/calendar/modules/core/ical/inc/prprtyfy.h b/mozilla/calendar/modules/core/ical/inc/prprtyfy.h deleted file mode 100644 index 09a6ff7afc2..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/prprtyfy.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * prprtyfy.h - * John Sun - * 2/12/98 5:17:48 PM - */ - -#include "prprty.h" - -#ifndef __ICALPROPERTYFACTORY_H_ -#define __ICALPROPERTYFACTORY_H_ - -/** - * ICalPropertyFactory is a factory class that creates - * ICalProperty instances. - * - * @see ICalProperty - */ -class ICalPropertyFactory -{ -private: - - /** - * Hide default constructor from use. - */ - ICalPropertyFactory(); - -public: - - /** - * Factory method that creates ICalProperty objects. - * Clients should call this method to create ICalProperty - * objects. Clients are responsible for de-allocating returned - * object. - * - * @param aType the type of ICALProperty - * @param value the initial value of the property - * @param parameters the initial parameters of the property - * - * @return ptr to the newly created ICalProperty object - * @see ICalProperty - */ - static ICalProperty * Make(ICalProperty::PropertyTypes aType, - void * value, JulianPtrArray * parameters); -}; - -#endif /* __ICALPROPERTYFACTORY_H_ */ - - - diff --git a/mozilla/calendar/modules/core/ical/inc/rcrrence.h b/mozilla/calendar/modules/core/ical/inc/rcrrence.h deleted file mode 100644 index 6edad428f1b..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/rcrrence.h +++ /dev/null @@ -1,534 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * rcrrence.h - * John Sun - * 2/2/98 10:45:13 AM - */ - -#ifndef __RECURRENCE_H_ -#define __RECURRENCE_H_ - -#include "datetime.h" -#include "duration.h" -#include "rrday.h" -#include "ptrarray.h" -#include "jutility.h" -#include "dategntr.h" -#include "bymgntr.h" -#include "byhgntr.h" -#include "bywngntr.h" -#include "byydgntr.h" -#include "bymogntr.h" -#include "bymdgntr.h" -#include "bydygntr.h" -#include "bydwgntr.h" -#include "bydmgntr.h" -#include "deftgntr.h" -#include "jlog.h" - -//#define JULIAN_DEBUGGING_RECURRENCE 1 - -class Recurrence -{ - -public: - - /* moved the Recurrence Type constants to nsCalUtility. */ -#if 0 - /** - * Creates a Recurrence object specified by the given string. - * - * @param startDate the start time of the first recurrence - * @param stopDate the end time of the first recurrence - * @param duration the time between start and stopdate - * @param ruleString the recurrence rule string to parse - */ - Recurrence(DateTime startDate, DateTime stopDate, nsCalDuration * duration, - UnicodeString & ruleString); - - /** - * Creates a Recurrence object specified by the given string. - * - * @param startDate the start time of the first recurrence - * @param duration the time between start and stopdate - * @param ruleString the recurrence rule string to parse - */ - Recurrence(DateTime startDate, nsCalDuration * duration, UnicodeString & ruleString); -#endif - /** - * Creates a Recurrence object specified by the given string. - * - * @param startDate the start time of the first recurrence - * @param ruleString the recurrence rule string to parse - */ - Recurrence(DateTime startDate, UnicodeString & ruleString); - - /** - * Destructor - */ - ~Recurrence(); - - /** - * Checks if recurrence rule is valid. Validity is checked during parsing. - * - * @return TRUE if valid rule, FALSE otherwise - */ - t_bool isValid() const; - - - /*static void toPatternOut(JulianPtrArray * srr, JulianPtrArray * ser, - JulianPtrArray * srd, JulianPtrArray * sed);*/ - - /** - * The same functionality as enforce except it works with a vector of strings. - * @param startDate start time of recurrence - * @param srr vector of RRULE strings - * @param ser vector of EXRULE strings - * @param srd vector of RDATE strings - * @param sed vector of EXDATE strings - * @param bound number of dates to be produced - * @param out vector containing generated dates - * - */ - static void stringEnforce(DateTime startDate, JulianPtrArray * srr, - JulianPtrArray * ser, JulianPtrArray * srd, JulianPtrArray * sed, - t_int32 bound, JulianPtrArray * out, JLog * log); - - - /** - * The enforce method handles two lists of recurrences which specifies rules for defining - * occurrence dates and rules for defining exclusion dates. The method appropriately - * generates all the dates and returns a list with all excluded dates removed. - * - * A fearful function that forcefully fathoms the fullness of a few recurrences. - * - * @param rr a vector of recurrence rules (Recurrence objects) - * @param er a vector of exclusion rules (Recurrence objects) - * @param rd a vector of explicit recurrence dates (DateTime objects) - * @param ed a vector of explicit exclusion dates (DateTime objects) - * @param bound number of dates to be produced - */ - static void enforce(JulianPtrArray * rr, JulianPtrArray * er, JulianPtrArray * rd, - JulianPtrArray * ed, t_int32 bound, JulianPtrArray * out, JLog * log); - - - /** - * Unzips a recurrence rule (i.e., produces a set of dates which the recurrence represents) to a certain - * number of dates inside of a given timezone. - * - * @param bound the number of dates to produce - * @param out vector containing generated dates - * @param bAddStartDate always adds first date to out vector - */ - void unzip(t_int32 bound, JulianPtrArray * out, JLog * log, t_bool - bAddStartDate = TRUE); - - - /** - * Converts iCal Recurrence Day string to Calendar::EDaysOfWeek value - * @param s recurrence day string - * @param error output if bad day value - * - * @return the Calendar::EDaysOfWeek value of s - */ - static t_int32 stringToDay(UnicodeString & s, t_bool & error); - - /* index into m_GntrVctr of appropriate generator */ - static const t_int32 ms_iByMinuteGntrIndex; - static const t_int32 ms_iByHourGntrIndex; - static const t_int32 ms_iByWeekNoGntrIndex; - static const t_int32 ms_iByYearDayGntrIndex; - static const t_int32 ms_iByMonthGntrIndex; - static const t_int32 ms_iByMonthDayGntrIndex; - static const t_int32 ms_iByDayYearlyGntrIndex; - static const t_int32 ms_iByDayMonthlyGntrIndex; - static const t_int32 ms_iByDayWeeklyGntrIndex; - static const t_int32 ms_iDefaultGntrIndex; - static const t_int32 ms_iGntrSize; - -private: - - /* Hide default constructor */ - Recurrence(); - - /* The ordering of this array represents the recursive structure through which dates - * will be determined. the first array contains tags which operate over a year, the - * second those which operate over a month, the third a week, etc. - */ - static const t_int32 * ms_aaiGenOrder[]; - - /* Generator order of each span. There are six spans. */ - static const t_int32 ms_aiGenOrderZero[]; - static const t_int32 ms_aiGenOrderOne[]; - static const t_int32 ms_aiGenOrderTwo[]; - static const t_int32 ms_aiGenOrderThree[]; - static const t_int32 ms_aiGenOrderFour[]; - static const t_int32 ms_aiGenOrderFive[]; - - /* length of each generator order array */ - static const t_int32 ms_GenOrderLen; - static const t_int32 ms_GenOrderZeroLen; - static const t_int32 ms_GenOrderOneLen; - static const t_int32 ms_GenOrderTwoLen; - static const t_int32 ms_GenOrderThreeLen; - static const t_int32 ms_GenOrderFourLen; - static const t_int32 ms_GenOrderFiveLen; - - /*----------------------------- - ** MEMBERS - **---------------------------*/ - - /** variable to specify unset value */ - static const t_int32 ms_iUNSET; - - /* Variables that correspond directly to properties defined in the spec */ - t_int32 m_iType; /* init to nsCalUtility::RT_NONE */ - nsCalDuration * m_Interval; /* init to NULL */ - t_int32 m_iCount; /* init to ms_iUNSET */ - t_int32 m_iWkSt; /* init to Calendar::MONDAY */ - DateTime m_Until; /* init to Invalid DateTime */ - - /* ByDay contains an array of day, integer pairs. days are specified from the standard Java - calendar object, IE, Calendar.MONDAY. the integer specifies the nth instance of that day - of the week. if all instances are specified (ie, BYDAY=FR), then the integer value is - left to zero. */ - RRDay * m_aaiByDay; - - /* ptr to parameters for each generator */ - t_int32 * m_aiByMinute; - t_int32 * m_aiByHour; - t_int32 * m_aiByMonthDay; - t_int32 * m_aiByYearDay; - t_int32 * m_aiBySetPos; - t_int32 * m_aiByWeekNo; - t_int32 * m_aiByMonth; - - /* the bysetpos length */ - t_int32 m_iBySetPosLen; - - /* vector of generators, order is extremely important! */ - JulianPtrArray * m_GntrVctr; - - /* Individual GENERATORS */ - ByMinuteGenerator * ms_ByMinuteGntr; - ByHourGenerator * ms_ByHourGntr; - ByWeekNoGenerator * ms_ByWeekNoGntr; - ByYearDayGenerator * ms_ByYearDayGntr; - ByMonthGenerator * ms_ByMonthGntr; - ByMonthDayGenerator * ms_ByMonthDayGntr; - ByDayYearlyGenerator * ms_ByDayYearlyGntr; - ByDayMonthlyGenerator * ms_ByDayMonthlyGntr; - ByDayWeeklyGenerator * ms_ByDayWeeklyGntr; - DefaultGenerator * ms_DefaultGntr; - - /* Number of active generators */ - t_int32 m_iActiveGenerators; /* init to 0 */ - - /* Variables for storing DTSTART, DTEND and DURATION */ - DateTime m_StartDate; - DateTime m_StopDate; - nsCalDuration * m_Duration; /* init to NULL */ - - /* cache validity */ - t_bool m_bParseValid; - - /*----------------------------- - ** METHODS - **---------------------------*/ - - /* initializes data */ - void init(); - - /** - * Helper method. Breaks recurrence rule strings into parameters - * and fills parameters vector with parameters. - * @param strLine recurrence rule string - * @param parameters vector to fill in with recurrence parameters - * - */ - void parsePropertyLine(UnicodeString & strLine, JulianPtrArray * parameters); - - /** - * Parses Recurrence rule string, populates data members, generators' - * parameters. Returns TRUE if recurrence parse went OK, FALSE - * if there was a failure. A failure sets m_bParseValid to FALSE. - * @param s recurrence rule string - * - * @return TRUE if rule is valid, FALSE otherwise - */ - t_bool parse(UnicodeString & s); - - /** - * Cleanup method takes vector of dates and make sure output number - * in less than length and start value is included. - * If bAddStartDate = TRUE, always add the start date to the out - * vector, otherwise don't add the start date to the out vector. - * @param vDatesIn input vector of dates - * @param length number of dates to be produced - * @param out output vector of dates - * @param bAddStartDate TRUE = adds first date to out vector - * - */ - void cleanup(JulianPtrArray * vDatesIn, t_int32 length, - JulianPtrArray * out, t_bool bAddStartDate); - - /** - * Sets interval to i, depending on m_iType. For example, - * if m_iType is set to nsCalUtility::RT_YEARLY and i is 2, - * then the interval is every 2 years. - * @param i value of interval w/respect to m_iType - */ - void internalSetInterval(t_int32 i); - - - /** - * Used for resetting a date value that is floating somewhere in an - * interval, to the beginning of that interval. Depends upon the - * initial date, the recurrence interval type, the week start date, and - * the state of other active generators. - * - * Example: type = MONTHLY, s = Jul 15, 1997 10:15 PM PDT - * resets to Jul 1, 1997 10:15 PM PDT - * if the BYHOUR and BYMINUTE tags are active it - * will further be clocked back to - * Jul 1, 1997 12:00 AM PDT - * @param t date value to reset - * @param type current interval type - * @param wkSt week start value - * - */ - void reset(DateTime & t, t_int32 type, t_int32 wkSt); - - /** - * Removes dates in vDates that do not follow BYSETPOS rule. - * Usually, this involves deleting almost every date except 1 - * from vDates. - * @param vDates vector of dates. - * - */ - void handleSetPos(JulianPtrArray * vDates); - - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - - /** - * Tokenizes string with delimeters and puts tokens in vectorToFillIn - * @param s string to tokenize - * @param strDelim string delimeters - * @param vectorToFillIn output vector of tokens to fill in - * - */ - static void parseDelimited(UnicodeString & s, UnicodeString & strDelim, - JulianPtrArray * vectorToFillIn); - - /** - * Verifies that each element in v is within the bounds of - * [lowerBound,upperBound) (inclusive). If bZero is TRUE, then - * 0 is NOT a valid value, otherwise 0 is a valid value. If - * there is an error, log the error message and set bParseError - * to TRUE. Each valid element is added to the output list. - * The return size of the list is retSize - * @param v vector of string element - * @param lowerBound lowerbound of valid range - * @param upperBound upperbound of valid range - * @param error log error message - * @param retSize output size of parameter list - * @param bParseError output parse error boolean - * @param bZero TRUE is 0 OK, FALSE if 0 not OK - * - * @return ptr to t_int32 (list of gntr parameter elements) - */ - static t_int32 * verifyIntList(JulianPtrArray * v, t_int32 lowerBound, - t_int32 upperBound, UnicodeString & error, t_int32 & retSize, - t_bool & bParseError, t_bool bZero = FALSE); - - /** - * Verifies that each element in v is a valid day element. - * A day element is of form (-5MO) where the last two letters - * must be a recurrence day string with a optional modifier in front. - * Depending of the type variable the modifier can be - * from -53 to 53 for type=RT_YEARLY and -5 to 5 for type=RT_MONTHLY. - * Each valid element is added to the output RRDay list. - * The return size of the list is retSize. - * @param v vector of string elements - * @param type interval type - * @param retSize output size of RRDay list - * @param bParseError output parse error boolean - * - * @return ptr to RRDay * (list of RRDay objects) - */ - static RRDay * createByDayList(JulianPtrArray * v, t_int32 type, - t_int32 & retSize, t_bool & bParseError); - - /** - * Helper method gets the day and modifier from the string in. - * @param in string to get day, modifier from - * @param day output Calendar::EDaysOfWeek - * @param modifier output day modifier - * @param bParseError output parse error boolean - * - */ - static void createByDayListHelper(UnicodeString & in, t_int32 & day, - t_int32 & modifier, t_bool & bParseError); - - /** - * Cleanup vector of UnicodeString objects. Delete each UnicodeString - * in vector. - * @param strings vector of elements to delete from - */ - static void deleteUnicodeStringVector(JulianPtrArray * strings); -public: - - /** - * Cleanup vector of DateTime objects. Delete each DateTime in vector. - * @param strings vector of elements to delete from - */ - static void deleteDateTimeVector(JulianPtrArray * datetimes); - - /** - * Cleanup vector of Recurrence objects. Delete each Recurrence - * in vector - * @param strings vector of elements to delete from - */ - static void deleteRecurrenceVector(JulianPtrArray * recurrences); -private: - - /** - * Cleanup vector of vector of DateTime objects. Delete each - * DateTime in each vector in vector - * @param strings vector of elements to delete from - */ - static void deleteDateTimeVectorVector(JulianPtrArray * vDatetimes); - - /** - * Cleanup vector of ICalParameter objects. Delete each ICalParameter - * from vector. - * @param strings vector of elements to delete from - */ - static void deleteICalParameterVector(JulianPtrArray * parameters); - -#if 0 - static void copyDateTimesInto(JulianPtrArray * from, DateTime * to); -#endif - - /** - * Converts frequency string (i.e. YEARLY, WEEKLY, DAILY, etc.) - * to Recurrence type constant. - * @param s input iCal frequency string - * @param bParseError output parse error boolean - * - * @return output recurrence type - */ - static t_int32 stringToType(UnicodeString & s, t_bool & bParseError); - - /** - * Gets the length of the Generator Order Array given an index - * to the array - * @param genOrderIndex index in to generator order array - * - * @return length of m_GntrVctr[genOrderIndex] - */ - static t_int32 getGenOrderIndexLength(t_int32 genOrderIndex); - - /** - * Concatentates a vector of vector of dates into a vector of dates. - * @param vvIn input vector of vector of dates - * @param vOut output vector of dates with vvIn's dates added in - * - */ - static void concat(JulianPtrArray * vvIn, JulianPtrArray * vOut); - - /** - * Replaces the contents of vOut with the contents of vvIn - * @param vvIn input vector of vector of dates - * @param vOut output vector of dates with vvIn's dates replacing old dates - * - * @return static void - */ - static void replace(JulianPtrArray * vvIn, JulianPtrArray * vOut); - - /** - * Removes dates in vDatesOut that are not in vDatesIn. - * @param vDatesOut output vector of dates that are also in vDatesIn - * @param vDatesIn input vector of dates - * - */ - static void intersectOutList(JulianPtrArray * vDatesOut, JulianPtrArray * vDatesIn); - - - /** - * Subtract or intersects date lists. If subtract is TRUE, then - * subtract lists vvDates[1..n] from vvDates[0]. If intersects mode - * intersect lists vvDates[0...n]. Resulting dates vector goes into - * out. - * - * @param vvDates vector of vector of dates - * @param subtract subtract = TRUE or intersect = FALSE mode - * @param out output resulting dates vector - * - */ - static void intersectDateList(JulianPtrArray * vvDates, t_bool subtract, - JulianPtrArray * out); - - /** - * Checks whether datetimes vector contains date. To contain date - * means containing a date with the same year, month, day, hour, minute and second. - * It does not have to have the same millesecond value. - * @param datetimes vector of dates to check for date - * @param date target date to look for - * - * @return TRUE if date is in datetimes, FALSE otherwise. - */ - static t_bool contains(JulianPtrArray * datetimes, DateTime * date); - - /** - * Eliminates duplicate datetime object from datetimes - * @param datetimes vector to remove duplicates from - * - */ - static void eliminateDuplicates(JulianPtrArray * datetimes); - -#if JULIAN_DEBUGGING_RECURRENCE - /** - * DEBUGGING method to print out datetime elements in a vector - * @param x datetime vector - * @param name debug name of vector - * - */ - static void TRACE_DATETIMEVECTOR(JulianPtrArray * x, char * name); - - /** - * DEBUGGING method to print out elements in a vector of vector of datetimes - * @param x vector of vector of datetimes - * @param name debug name of vector - * - */ - static void TRACE_DATETIMEVECTORVECTOR(JulianPtrArray * x, char * name); -#endif - -}; -#endif /* __RECURRENCE_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/recid.h b/mozilla/calendar/modules/core/ical/inc/recid.h deleted file mode 100644 index 4bbe1b894cf..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/recid.h +++ /dev/null @@ -1,246 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * recid.h - * John Sun - * 3/20/98 5:08:46 PM - */ - -#ifndef __RECURRENCEID_H_ -#define __RECURRENCEID_H_ - -#include -#include "datetime.h" -#include "prprty.h" -#include "jlog.h" - -/** - * nsCalRecurrenceID implements the RecurrenceID property. The RecurrenceID - * must have a DateTime value. It can optionally have a RANGE value set to - * THISANDPRIOR or THISANDFUTURE. A RecurrenceID without a RANGE has its - * range value set to NONE. - * The nsCalRecurrenceID must implement the ICalProperty interface. - * - * @see ICalProperty - */ -class nsCalRecurrenceID : public ICalProperty -{ -public: - /** an enumeration of the RANGE parameter */ - enum RANGE{RANGE_NONE = 0, RANGE_THISANDPRIOR = 1, RANGE_THISANDFUTURE = 2}; -private: - - /*----------------------------- - ** MEMBERS - **---------------------------*/ - - /** range parameter value */ - nsCalRecurrenceID::RANGE m_Range; - - /** datetime value */ - DateTime m_DateTime; - - /** log to write errors to */ - JLog * m_Log; - - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - - /** - * Sets parameter with name paramName with value paramVal. - * @param paramName parameter name to set - * @param paramVal new value of parameter - * - */ - void setParam(UnicodeString & paramName, UnicodeString & paramVal); - -#if 0 - /* hide constructor from clients */ - nsCalRecurrenceID(); -#endif - - /** - * Copy constructor. - * @param that nsCalRecurrenceID to copy - */ - nsCalRecurrenceID(nsCalRecurrenceID & that); - -public: - - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - - /** - * Constructor. Create a RecurrenceID with log set to initLog - * @param initLog log file to write errors to - */ - nsCalRecurrenceID(JLog * initLog = 0); - - /** - * Constructor. Create a RecurrenceID with log set to initLog - * @param datetime initial DateTime value - * @param initLog log file to write errors to - * @param range initial RANGE value - */ - nsCalRecurrenceID(DateTime datetime, JLog * initLog, RANGE range = RANGE_NONE); - - /** - * Destructor - */ - ~nsCalRecurrenceID(); - - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - - /** - * Returns RANGE value. - * - * @return current RANGE value - */ - nsCalRecurrenceID::RANGE getRange() const { return m_Range; } - - /** - * Sets RANGE value - * @param range new range value - * - */ - void setRange(nsCalRecurrenceID::RANGE range) { m_Range = range; } - - /** - * Sets DateTime value. - * @param d new DateTime value - * - */ - void setDateTime(DateTime d) { m_DateTime = d; } - - /** - * Returns DateTime value - * - * @return current DateTime value - */ - DateTime getDateTime() { return m_DateTime; } - - /*---------- To satisfy ICalProperty interface ----------*/ - /** - * Sets parameters. - * @param parameters vector of parameters to set - * - */ - virtual void setParameters(JulianPtrArray * parameters); - - /** - * Return value of property. Never use. Use getDateTime(). - * - * @return value of property - */ - virtual void * getValue() const; - - /** - * Sets value of property. Never use. Use setDateTime(). - * @param value new value of property - * - */ - virtual void setValue(void * value); - - /** - * Returns a clone of this property. - * @param initLog the log file for clone to write to - * - * @return clone of this ICalProperty object - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Checks whether this property is valid or not. DateTime value - * must be valid in order to be TRUE. - * - * @return TRUE if property is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return property to human-readable string. - * @param dateFmt formatting string - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & strFmt, UnicodeString & out); - - /** - * Return property to human-readable string. - * @param out output human-readable string - * - * @return output human-readable string (out) - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return property to iCal property string. - * @param out output iCal string - * - * @return output iCal string (out) - */ - virtual UnicodeString & toICALString(UnicodeString & out); - - /** - * Return property to iCal property string. Inserts sProp to - * front of output string. sProp should be the property name of this - * property. - * @param sProp property name to append to insert at front of out - * @param out output iCal string with sProp in front - * - * @return output iCal string with sProp in front (out) - */ - virtual UnicodeString & toICALString(UnicodeString & sProp, UnicodeString & out); - /*----------End of ICalProperty interface----------*/ - - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - - /** - * Converts string to RANGE enumeration. Returns NONE if error. - * @param sRange range string - * - * @return RANGE enumeration value of sRange - */ - static nsCalRecurrenceID::RANGE stringToRange(UnicodeString & sRange); - - /** - * Converts RANGE to string. Returns "" for NONE. - * @param range RANGE value - * @param out output range string - * - * @return output range string - */ - static UnicodeString & rangeToString(nsCalRecurrenceID::RANGE range, UnicodeString & out); - -}; - -#endif /* __RECURRENCEID_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/rrday.h b/mozilla/calendar/modules/core/ical/inc/rrday.h deleted file mode 100644 index 70c00f045c2..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/rrday.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * rrday.h - * John Sun - * 2/4/98 7:54:41 PM - */ - -#ifndef __RRDAY_H_ -#define __RRDAY_H_ - -#include -#include - -/** - * RRDay encapsulates a day for recurrence handling - * fields[0] is the value of the day (i.e Calendar::SUNDAY, ... - * Calendar::SATURDAY). fields[1] is the number of the day. - * Thus if this is the 1st Sunday, then fields[1] = 1; - * If this is the last Sunday, then fields[1] = -1; - */ -class RRDay -{ -public: - /** the fields */ - t_int32 fields[2]; - - /** Default constructor */ - RRDay(); - - /** Destructor */ - ~RRDay() {} - - - /** - * Constructor. Sets fields to aDay, aModifier - * @param aDay day of week value - * @param aModifier modifier - */ - RRDay(t_int32 aDay, t_int32 aModifier); - - - /** - * Return index into fields. - * @param index index of field to get - * - * @return value of fields[index] - */ - t_int32 operator[](t_int32 index) const; - - - /** - * Assignment operator. - * @param that RRDay to assign to - */ - void operator=(RRDay & that); - - - /** - * Equality operator. - * @param that RRDay to compare to - * - * @return TRUE if equal, FALSE otherwise. - */ - t_bool operator==(RRDay & that); - - /** - * Inequality operator. - * @param that RRDay to compare to - * - * @return TRUE if NOT equal, FALSE otherwise. - */ - t_bool operator!=(RRDay & that); - -}; - -#endif /* __RRDAY_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/sdprprty.h b/mozilla/calendar/modules/core/ical/inc/sdprprty.h deleted file mode 100644 index e99216d4a28..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/sdprprty.h +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * sdprprty.h - * John Sun - * 3/2/98 9:37:03 AM - */ - -#include "prprty.h" -#include "icalprm.h" -#include - -#ifndef __STANDARDPROPERTY_H_ -#define __STANDARDPROPERTY_H_ - -/** - * StandardProperty is an abstract class that encapsulates the similar state of the - * BooleanProperty, DateTimeProperty, DurationProperty, IntegerProperty, - * PeriodProperty, and StringProperty classes. - * This mainly includes holding the ICAL parameters in a JulianPtrArray. - * It also defines a few methods to set, get, print parameters. - */ -class StandardProperty: public ICalProperty -{ -protected: - /** the parameters list of the property */ - JulianPtrArray * m_vParameters; - -#if 0 - /** ptr to log. Don't delete it */ - JLog * m_Log; -#endif - - /** - * Add a parameter to the parameter list - * @param parameter parameter to add - */ - void addParameter(ICalParameter * parameter); - - /** - * Constructor. Hidden from clients. - */ - StandardProperty(); - - /** - * Constructor. Makes copy of parameters. - * @param parameters parameter array to copy - */ - StandardProperty(JulianPtrArray * parameters); -public: - - /** - * Virtual destructor deletes parameters. - */ - virtual ~StandardProperty(); - - /*---------------------------------------------------------------------*/ - /*-- ICALPROPERTY interface --*/ - - /** - * Pure virtual method. Return the value of the property - * @return void * ptr to value of the property - */ - virtual void * getValue() const { PR_ASSERT(FALSE); return 0;} - - /** - * Pure virtual method. Set the value of the property - * @param value the value to set property to - */ - virtual void setValue(void * value) { PR_ASSERT(FALSE); if (value != 0) {} ; } - - /** - * Pure virtual method. Returns a clone of this property. - * Clients are responsible for deleting the returned object. - * - * @return a clone of this property. - */ - virtual ICalProperty * clone(JLog * initLog) { PR_ASSERT(FALSE); if (initLog) {} return 0; } - - /** - * Pure virtual method. Return TRUE if property is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid() { PR_ASSERT(FALSE); return FALSE; } - - /** - * Pure virtual method. Return a string in human-readable form of the property. - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & dateFmt, - UnicodeString & out) - { PR_ASSERT(FALSE); if (dateFmt.size() > 0) {} ; return out; } - - /** - * Pure virtual method. Return a string in human-readable form of the property. - * @param dateFmt format string options - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & out) { PR_ASSERT(FALSE); return out; } - - /*-- End of ICALPROPERTY interface --*/ - /*---------------------------------------------------------------------*/ - - /** - * Pure virtual method. Return the property's string in the ICAL format. - * @param out contains output ICAL string - * - * @return the property in its ICAL string format - */ - virtual UnicodeString & toExportString(UnicodeString & out) { PR_ASSERT(FALSE); return out; } - - /** - * Given a parameter name, return the parameter value in paramVal. - * Return a status of 1 if paramName not found in parameters array. - * @param paramName input parameter name - * @param paramVal output parameter value if found - * @param status ZERO_ERROR if OK, 1 is empty parameters, 2 is not found - * - * @return output parameter value (paramVal) - */ - UnicodeString & getParameterValue(UnicodeString & paramName, /* IN */ - UnicodeString & paramVal, ErrorCode & status); /* OUT, OUT */ - - /*void setParameter(UnicodeString & paramName, UnicodeString & paramValue)*/ - - /** - * Parse a line and populate data. - * @param in line to parse. - */ - void parse(UnicodeString & in); - - /** - * Copies contents of parameters into this property's parameters - * array. - * @param parameters parameters to copy - */ - void setParameters(JulianPtrArray * parameters); - - /* - virtual void setParameter(UnicodeString & paramName, UnicodeString & paramValue) - { - PR_ASSERT(FALSE); if (paramName.size() > 0 && paramValue.size() > 0) {} - } - */ - - /** - * Returns the property's ICAL format strings, - * to output string of the form - * :value or ;param1;param2;param3(etc.):value - * ONLY: DateTimeProperty overrides this - * (This is too handle NOT printing VALUE and TZID parameters) - * - * @param out output ICAL string - * - * @return output ICAL string (out) - */ - virtual UnicodeString & toICALString(UnicodeString & out); - - /** - * Returns the property's ICAL format strings, inserting - * sProp (property name) to output string of the form - * sProp:value or sProp;param1;param2;param3(etc.):value - * ONLY: DateTimeProperty overrides this - * (This is too handle NOT printing VALUE and TZID parameters) - * - * @param sProp property name of property - * @param out output ICAL string - * - * @return output ICAL string (out) - */ - virtual UnicodeString & toICALString(UnicodeString & sProp, - UnicodeString & out); -}; - -#endif /* __STANDARDPROPERTY_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/sprprty.h b/mozilla/calendar/modules/core/ical/inc/sprprty.h deleted file mode 100644 index bd91a0bf250..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/sprprty.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * sprprty.h - * John Sun - * 2/10/98 4:53:11 PM - */ - -#include -#include "sdprprty.h" - -#ifndef __STRINGPROPERTY_H_ -#define __STRINGPROPERTY_H_ - -/** - * StringProperty is a subclass of StandardProperty. It implements the ICalProperty - * interface for ICAL properties with TYPE=TEXT. - */ -class StringProperty: public StandardProperty -{ -private: - /** the String value of the property */ - UnicodeString m_string; - - /** - * Default constructor - */ - StringProperty(); - - /** - * Copy constructor - * @param that property to copy - */ - StringProperty(const StringProperty & that); -public: - - /** - * Constructor that sets value of property to contents of value - * and makes a copy of the contents of parameters ptr. - * @param value value of property - * @param parameters parameters of property - */ - StringProperty(UnicodeString value, JulianPtrArray * parameters); - - /** - * Destructor - */ - ~StringProperty(); - - /** - * Return the value of the property - * @return void * ptr to value of the property - */ - virtual void * getValue() const; - - /** - * Set the value of the property - * @param value the value to set property to - */ - virtual void setValue(void * value); - - /** - * Returns a clone of this property. Clients are responsible for deleting - * the returned object. - * - * @return a clone of this property. - */ - virtual ICalProperty * clone(JLog * initLog); - - /** - * Return TRUE if property is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Return a string in human-readable form of the property. - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & out); - - /** - * Return a string in human-readable form of the property. - * @param dateFmt format string options - * @param out contains output human-readable string - * - * @return the property in its human-readable string format - */ - virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out); - - /** - * Return the property's string in the ICAL format. - * @param out contains output ICAL string - * - * @return the property in its ICAL string format - */ - virtual UnicodeString & toExportString(UnicodeString & out); -}; - -#endif /* __STRINGPROPERTY_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/stdafx.h b/mozilla/calendar/modules/core/ical/inc/stdafx.h deleted file mode 100644 index e7d72f485db..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/stdafx.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* This is a dummy file so that we can compile our windows -** projects with precompiled headers... -** -** It must be here, but you can just ignore it. -*/ diff --git a/mozilla/calendar/modules/core/ical/inc/tmbevent.h b/mozilla/calendar/modules/core/ical/inc/tmbevent.h deleted file mode 100644 index db1d5a5b469..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/tmbevent.h +++ /dev/null @@ -1,959 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * tmbevent.h - * John Sun - * 2/6/98 2:59:24 AM - * - * modified: 8/31/98 sman - added curl support - */ - -#ifndef __TIMEBASEDEVENT_H_ -#define __TIMEBASEDEVENT_H_ - -#include "ptrarray.h" -#include "datetime.h" -#include "attendee.h" -#include "icalredr.h" -#include "prprty.h" -#include "duration.h" -#include "jlog.h" -#include "valarm.h" -#include "julnstr.h" -#include "nscalcoreicalexp.h" - -/** - * TimeBasedEvent is the superclass of VEvent, VTodo, and VJournal. - * It encapsulates the similar state between the 3 classes. This - * includes recurrence handling, Alarm handling, as well as containing - * all properties that exist in all three properties. - * NOTE: No ownership taken anymore. (always pass by value) - */ -class NS_CAL_CORE_ICAL TimeBasedEvent : public ICalComponent -{ -protected: -#if 0 - - /** - * Default Constructor. Hide from clients. - */ - TimeBasedEvent(); -#endif - - - /** - * Copy constructor. - * @param that TimeBasedEvent to copy. - */ - TimeBasedEvent(TimeBasedEvent & that); -public: - /*TimeBasedEvent(NSCalendar parent);*/ - - /** - * Returns the curl associated with this nsCalendar. The - * curl points to the calendar store where components in - * this nsCalendar are to be stored. It is required - * for an nsCalendar to have an associated curl if any - * of its components will be persisted in a calendar store. - * - * @return a JulianString containing the curl - */ - JulianString getCurl() const {return m_sCurl;} - - /** - * Set the default curl for this nsCalendar. - */ - void setCurl(const char* ps) {m_sCurl = ps;} - - /** - * Set the default curl for this nsCalendar. - */ - void setCurl(const JulianString& s) {m_sCurl = s;} - - /** - * Constructor. Create TimeBasedEvent with initial log file set to initLog. - * @param initLog initial log file pointer - */ - TimeBasedEvent(JLog * initLog = 0); - - /** - * Destructor. - */ - virtual ~TimeBasedEvent(); - - - /** - * Pure virtual method. Calculate difference from start, end time - * For VEvent, this would be DTEnd - DTStart. - * - * @return virtual Date - */ - virtual Date difference() { PR_ASSERT(FALSE); return 0; } - - /** - * set RSVP on all attendees set to TRUE - */ - /*void rsvpAll();*/ - - /** - * Set each attendee's status parameter to needs action (except owner) - */ - /*void needsAction();*/ - - /*UnicodeString getOrganizer();*/ - /*UnicodeString getOwner();*/ - - /*UnicodeString toString(UnicodeString strFmt);*/ - - /* -- Start of ICALComponent interface -- */ - - /** - * The parse method is the standard interface for ICalComponent - * subclasses to parse from an ICalReader object - * and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.). - * The method type can be set to \"\" if there is no method to be loaded. - * Also accepts a vector of VTimeZone objects to apply to - * the DateTime properties of the component. - * 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level, - * it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for - * this. - * - * @param brFile ICalReader to load from - * @param sType name of component (i.e. VEVENT, VTODO, VTIMEZONE) - * @param parseStatus return parse error status string (normally return "OK") - * @param vTimeZones vector of VTimeZones to apply to datetimes - * @param bIgnoreBeginError TRUE = ignore first "BEGIN:VEVENT", FALSE otherwise - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parse error status string (parseStatus) - */ - virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0, - t_bool bIgnoreBeginError = FALSE, nsCalUtility::MimeEncoding encoding = - nsCalUtility::MimeEncoding_7bit) - { - PR_ASSERT(FALSE); - if (brFile != NULL && vTimeZones != NULL && sMethod.size() > 0 - && parseStatus.size() > 0 && bIgnoreBeginError && encoding > 0) - { - } - return parseStatus; - } - - /** - * Returns a clone of this object - * @param initLog log file to write errors to - * - * @return clone of this object - */ - virtual ICalComponent * clone(JLog * initLog) { PR_ASSERT(FALSE); if (initLog) {} return 0; } - - /** - * Return TRUE if component is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Print all contents of ICalComponent to iCal export format. - * - * @return string containing iCal export format of ICalComponent - */ - UnicodeString toICALString(); - - /*UnicodeString toICALString(UnicodeString sMethod);*/ - - /** - * Print all contents of ICalComponent to iCal export format, depending - * on attendee name, attendee delegated-to, and where to include recurrence-id or not - * - * @param method method name (REQUEST,PUBLISH, etc.) - * @param name attendee name to filter with - * @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid - * - * @return string containing iCal export format of ICalComponent - */ - UnicodeString toICALString(UnicodeString sMethod, - UnicodeString sName, t_bool isRecurring = FALSE); - - /** - * Depending on character passed in, returns a string that represents - * the ICAL export string of that property that the character represents, if - * other paramaters not null, then print out information is filtered in several ways - * Attendee print out can be filtered so that only attendee with certain name is printed - * also, can print out the relevant attendees in a delegation message - * (ie. owner, delegate-to, delegate-from) - * - * @param c char of what property to print - * @param sFilterAttendee name of attendee to print - * @param bDelegateRequest TRUE if a delegate request, FALSE if not - * @return ICAL export format of that property - */ - virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest = FALSE); - - /** - * convert a character to the content of a property in string - * human-readable format - * @param c a character represents a property - * @param dateFmt for formatting datetimes - * - * @return property in human-readable string - */ - virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt); - - /** - * Returns the ICAL_COMPONENT enumeration value of this ICalComponent. - * Each ICalComponent subclass must return a unique ICAL_COMPONENT value. - * - * @return ICAL_COMPONENT value of this component - */ - virtual ICAL_COMPONENT GetType() const { PR_ASSERT(FALSE); return ICAL_COMPONENT_VEVENT; } - - /* OVERRIDES ICalComponent::MatchUID_seqNO */ - /** - * check if this event matches the given UID and sequence number - * @return TRUE if this event matches the given UID and sequence number, FALSE otherwise - */ - virtual t_bool MatchUID_seqNO(UnicodeString uid, t_int32 iSeqNo); - - /* -- Start of ICALComponent interface -- */ - - /** - * Pure virtual method used as wrapper to ICalComponent::format method. - * @param strFmt iCal format string - * @param sFilterAttendee attendee to filter - * @param delegateRequest delegate request = TRUE, FALSE otherwise - * - * @return output iCal formatted export string - */ - virtual UnicodeString formatHelper(UnicodeString & strFmt, - UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE) - { - PR_ASSERT(FALSE); - if (strFmt.size() == 0 && sFilterAttendee.size() == 0 && delegateRequest) {} - return ""; - } - - /** - * Parse the TimeBasedEvent from a ICalReader object, given the component name in sType. - * Takes in a method name since, this affects whether event is valid or not. - * Also takes in vector of timezones to apply to datetimes with TZID values. - * The bIgnoreBeginError flag is used to ignore the first BEGIN:VEVENT(VTODO,VJOURNAL). - * This is useful when this method is called somewhere besides the NSCalendar::parse(). - * For example, when receiving data a from CAPI, it returns events, not calendars. - * So to parse event, the first BEGIN:VEVENT should be ignored. - * If then parse terminates correctly with an END:VEVENT(VTODO, VJOURNAL) then parseStatus - * is set to OK and returned. However is an incorrect termination of parse occurs, - * then parseStatus returns the cause of the incorrect termination. An incorrect - * termination of parse can occur if the parse reaches an "END:VCALENDAR" before and - * "END:VEVENT" for example. In this case, parseStatus would return "END:VCALENDAR". - * Other incorrect termination causes are a "BEGIN:VCALENDAR", or another "BEGIN:VEVENT" - * (TODO: finish incorrect termination handling). - * - * @param sType component name (i.e. VEVENT, VTODO, VJOURNAL) - * @param brFile ICalReader object to parse from - * @param sMethod calendar method name (PUBLISH, REQUEST, etc.) - * @param parseStatus return OK if no error, otherwise an error - * @param vTimeZones vector of timezones to apply to datetimes - * @param bIgnoreBeginError if parsing just a vevent (not from an calendar, set to TRUE) - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parseStatus (OK if no error, otherwise an error) - */ - UnicodeString & parseType(UnicodeString & sType, ICalReader * brFile, - UnicodeString & sMethod, UnicodeString & parseStatus, JulianPtrArray * vTimeZones, - t_bool bIgnoreBeginError = FALSE, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Prints properties of an CANCEL message, specifically - * - * @return a string with COMMENT, DTSTAMP, STATUS, STATUS=CANCELLED, SEQUENCE, UID properties - */ - virtual UnicodeString cancelMessage() { PR_ASSERT(FALSE); return ""; } - - /** - * Prints properties of an REQUEST message - * @return string with request message required properties - */ - virtual UnicodeString requestMessage() { PR_ASSERT(FALSE); return ""; } - - /** - * Prints properties of an REQUEST message except Recur-id - * @return string with request message required properties - */ - virtual UnicodeString requestRecurMessage() { PR_ASSERT(FALSE); return ""; } - - /** - * Prints properties of an COUNTER message - * @return string with counter message required properties - */ - virtual UnicodeString counterMessage() { PR_ASSERT(FALSE); return ""; } - - /** - * Prints properties of an DECLINECOUNTER message - * @return string with decline-counter message required properties - */ - virtual UnicodeString declineCounterMessage() { PR_ASSERT(FALSE); return ""; } - - /** - * Prints properties of an ADD message - * @return string with add message required properties - */ - virtual UnicodeString addMessage() { PR_ASSERT(FALSE); return ""; } - - /** - * Prints properties of an REFRESH message - * @param sAttendeeFilter name of requestor of refresh - * @return string with refresh message required properties - */ - virtual UnicodeString refreshMessage(UnicodeString sAttendeeFilter) - { - PR_ASSERT(FALSE); - if (sAttendeeFilter.size() > 0) {} return ""; - } - - /** - * Prints properties of an ALL PROPERTIES message (for debugging method) - * @return string with all properties - */ - virtual UnicodeString allMessage() { PR_ASSERT(FALSE); return ""; } - - /** - * Prints properties of an REPLY message - * @param sAttendeeFilter name of replier - * @return string with reply message required properties - */ - virtual UnicodeString replyMessage(UnicodeString sAttendeeFilter) - { - PR_ASSERT(FALSE); - if (sAttendeeFilter.size() > 0) {} return ""; - } - - /** - * Prints properties of an PUBLISH message - * @return string with publish message required properties - */ - virtual UnicodeString publishMessage() { PR_ASSERT(FALSE); return ""; } - - /** - * Prints properties of an PUBLISH message except recur-id - * @return string with publish message required properties - */ - virtual UnicodeString publishRecurMessage() { PR_ASSERT(FALSE); return ""; } - - /* -- delegate methods -- */ - /* - virtual UnicodeString delegateRequestMessage(UnicodeString sAttendeeFilter, - UnicodeString sDelegateTo, t_bool bRecur = FALSE); - */ -/* - { - PR_ASSERT(FALSE); - if (sAttendeeFilter.size() > 0) {return ""; } - if (sDelegateTo.size() > 0 && t_bool) {return ""; } - return ""; - } - */ -/* - virtual UnicodeString delegateRequestRecurMessage(UnicodeString sAttendeeFilter, - UnicodeString sDelegateTo, t_bool bRecur) - { - PR_ASSERT(FALSE); - if (sAttendeeFilter.size() > 0) {return ""; } - return ""; - } - */ - /* - virtual UnicodeString delegateReplyMessage(UnicodeString sAttendeeFilter, - UnicodeString sDelegateTo, t_bool bRecur = FALSE); - */ - /* - { - PR_ASSERT(FALSE); - if (sAttendeeFilter.size() > 0) {return ""; } - if (sDelegateTo.size() > 0 && t_bool) {return ""; } - return ""; - } - */ - /* - virtual UnicodeString delegateReplyRecurMessage(UnicodeString sAttendeeFilter, - UnicodeString sDelegateTo, t_bool bRecur) - { - PR_ASSERT(FALSE); - if (sAttendeeFilter.size() > 0) {return ""; } - return ""; - } - */ - -#if 0 - static void setDateTimeValue(ICalProperty ** dateTimePropertyPtr, - DateTime inVal, JulianPtrArray * inParameters); - static void getDateTimeValue(ICalProperty ** dateTimePropertyPtr, DateTime & outVal); -#endif - - /* -- Getters and Setters -- */ - - /** - * Return TRUE if event is an anniversary event, FALSE otherwise. - * An anniversary event is an event that does not represent a - * scheduled amount of time, but more of a daily reminder. - * During parsing, this is set when the VALUE=DATE is parsed - * on the DTSTART property. An anniversary event can span multiple - * days. See spec for better definition. - * - * @return TRUE if anniversary event, FALSE otherwise - */ - t_bool isAllDayEvent() { return m_bAllDayEvent; } - void setAllDayEvent(t_bool b) { m_bAllDayEvent = b; } - - /* --- Getters and Setters ---*/ - - /* LAST-MODIFIED */ - DateTime getLastModified() const; - void setLastModified(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getLastModifiedProperty() const { return m_LastModified; } - - /* CREATED */ - DateTime getCreated() const; - void setCreated(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getCreatedProperty() const { return m_Created; } - - /* DTSTAMP */ - DateTime getDTStamp() const; - void setDTStamp(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getDTStampProperty() const { return m_DTStamp; } - - /* DTSTART */ - DateTime getDTStart() const; - void setDTStart(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getDTStartProperty() const { return m_DTStart; } - - /* DESCRIPTION */ - UnicodeString getDescription() const; - void setDescription(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getDescriptionProperty() const { return m_Description; } - - /* URL */ - UnicodeString getURL() const; - void setURL(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getURLProperty() const { return m_URL; } - - /* SUMMARY */ - UnicodeString getSummary() const; - void setSummary(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getSummaryProperty() const { return m_Summary; } - - /* CLASS */ - UnicodeString getClass() const; - void setClass(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getClassProperty() const { return m_Class; } - - /* STATUS */ - UnicodeString getStatus() const; - void setStatus(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getStatusProperty() const { return m_Status; } - - /* REQUESTSTATUS */ - /* UnicodeString getRequestStatus() const; - void setRequestStatus(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getRequestStatusProperty() const { return m_RequestStatus; }*/ - void addRequestStatus(UnicodeString s, JulianPtrArray * parameters = 0); - void addRequestStatusProperty(ICalProperty * prop); - JulianPtrArray * getRequestStatus() const { return m_RequestStatusVctr; } - - /* UID */ - virtual UnicodeString getUID() const; - void setUID(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getUIDProperty() const { return m_UID; } - - /* SEQUENCE */ - virtual t_int32 getSequence() const; - void setSequence(t_int32 i, JulianPtrArray * parameters = 0); - ICalProperty * getSequenceProperty() const { return m_Sequence; } - - /* COMMENT */ - void addComment(UnicodeString s, JulianPtrArray * parameters = 0); - void addCommentProperty(ICalProperty * prop); - JulianPtrArray * getComment() const { return m_CommentVctr; } - - /* remove all previous comments, then adds new comment s */ - void setNewComments(UnicodeString s); - - /* ATTACH */ - void addAttach(UnicodeString s, JulianPtrArray * parameters = 0); - void addAttachProperty(ICalProperty * prop); - JulianPtrArray * getAttach() const { return m_AttachVctr; } - - /* RELATED-TO (not a vector anymore, now just a property) */ - void addRelatedTo(UnicodeString s, JulianPtrArray * parameters = 0); - void addRelatedToProperty(ICalProperty * prop); - JulianPtrArray * getRelatedTo() const { return m_RelatedToVctr; } - - /* CONTACT */ - void addContact(UnicodeString s, JulianPtrArray * parameters = 0); - void addContactProperty(ICalProperty * prop); - JulianPtrArray * getContact() const { return m_ContactVctr; } - - /* RDATE */ - void addRDate(UnicodeString s, JulianPtrArray * parameters = 0); - void addRDateProperty(ICalProperty * prop); - JulianPtrArray * getRDates() const { return m_RDateVctr; } - - /* EXDATE */ - void addExDate(UnicodeString s, JulianPtrArray * parameters = 0); - void addExDateProperty(ICalProperty * prop); - JulianPtrArray * getExDates() const { return m_ExDateVctr; } - - /* CATEGORIES */ - void addCategories(UnicodeString s, JulianPtrArray * parameters = 0); - void addCategoriesProperty(ICalProperty * prop); - JulianPtrArray * getCategories() const { return m_CategoriesVctr; } - void addCategoriesPropertyVector(UnicodeString & propVal, JulianPtrArray * parameters); - - /* ORGANIZER */ - UnicodeString getOrganizer() const; - void setOrganizer(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getOrganizerProperty() const { return m_Organizer; } - - /* RECURRENCEID */ - ICalProperty * getRecurrenceIDProperty() const { return m_RecurrenceID; } - void setRecurrenceID(DateTime d, JulianPtrArray * parameters = 0); - DateTime getRecurrenceID() const; - - /* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */ - void addXTokens(UnicodeString s); - JulianPtrArray * getXTokens() const { return m_XTokensVctr; } - - /* EXRULE: NOTE: a vector of strings, not a vector of ICalProperties */ - void addExRuleString(UnicodeString s); - JulianPtrArray * getExRules() const { return m_ExRuleVctr; } - - /* RRULE: NOTE: a vector of strings, not a vector of ICalProperties */ - void addRRuleString(UnicodeString s); - JulianPtrArray * getRRules() const { return m_RRuleVctr; } - - /* ATTENDEE */ - void addAttendee(Attendee * a); - JulianPtrArray * getAttendees() const { return m_AttendeesVctr ; } - - /*---------------------------------------------------------------------*/ - - /* ALARMS */ - JulianPtrArray * getAlarms() const { return m_AlarmsVctr ; } - void addAlarm(VAlarm * a); - - /* ORIGSTART */ - void setOrigStart(DateTime d) { m_origDTStart = d; } - DateTime getOrigStart() { return m_origDTStart; } - - /* MYORIGSTART */ - void setMyOrigStart(DateTime d) { m_origMyDTStart = d; } - DateTime getMyOrigStart() { return m_origMyDTStart; } - - /* METHOD */ - void setMethod(UnicodeString & s); - UnicodeString & getMethod() { return m_sMethod; } - - /* BOUND */ - t_int32 getBound() const { return ms_iBound; } - void setBound(t_int32 i) { ms_iBound = i; } - - /** - * Set DTStamp to current date time. - */ - void stamp(); - - /** - * Return the Attendee in attendee vector with name equal - * to sAttendee. Return 0 if no attendee with that name. - * @param sAttendee name of attendee - * - * @return Attendee whose name is sAttendee, 0 if not found - */ - Attendee * getAttendee(UnicodeString sAttendee); - - /** - * Checks is this component is expandable. An expandable component - * is a component that has something in the RRULE or RDATE vector - * and does NOT have a RecurrenceID. - * - * @return TRUE if is expandable component, FALSE otherwise. - */ - t_bool isExpandableEvent() const; - - /** - * Helper method. Pure virtual method. Used by subclasses to - * populate recurrence-dependent data. For example, a recurring - * VEvent needs to have DTEnd calculated from recurring - * DTStart. VEvent will overwrite method set DTEnd correctly. - * Abstract difference() method is used to calculate ldiff. - * Need to pass vector of RDate periods in case end value must - * be adjusted in RDATE is a PERIOD value. - * @param start recurrence instance starting time - * @param ldiff abstract difference value - * @param vPer vector of RDate periods - */ - virtual void populateDatesHelper(DateTime start, Date ldiff, JulianPtrArray * vPer) - { - PR_ASSERT(FALSE); if(start.getTime() > ldiff && vPer) {} - } - - - /** - * takes the vector of rrule, rdate, exrule, and exdates, dtstart, - * and bound and returns a vector of generated recurrence events in vOut. - * Does this in two parts - * The first part generates a vector of DateTimes that represent - * the dates of the recurrence. - * The second part takes these dates and creates an event with them. - * @param vOut fill-in vector with generated recurrence events - * @param vTimeZones vector of timezones - */ - void createRecurrenceEvents(JulianPtrArray * vOut, - JulianPtrArray * vTimeZones); - - /* - void addDelegate(UnicodeString & sAttendeeFilter, - UnicodeString & sDelegateTo); - */ - - /** - * Sets Attendee with the name sAttendeeFilter to status. - * If the status is Delegated, then adds each element in delegatedTo - * to the delegatedTo vector of that attendee. - * If that attendee does not exist in the attendee list, then add - * a new Attendee to the attendee list with his/her PARTSTAT set to status. - * @param sAttendeeFilter attendee to set status on - * @param status status to set - * @param delegatedTo vector of delegatedTo names to set to - */ - void setAttendeeStatus(UnicodeString & sAttendeeFilter, Attendee::STATUS status, - JulianPtrArray * delegatedTo = 0); - void setAttendeeStatusInt(UnicodeString & sAttendeeFilter, t_int32 status, - JulianPtrArray * delegatedTo = 0); - - /** - * TODO: doesn't do smart overriding for now, does simple overwrite - * Updates this component with the data from the updatedComponent. - * This method must be overridden by subclasses. - * If updatedComponent is older that current compoenent, don't update current component - * How: - * make sure (UID, RecurID) pair are same. - * if sequence number of updatedComponent if greater that this.sequence || - * if sequence numbers are equal and update.DTSTAMP > this.DTSTAMP - * update properties - * else - * do nothing. - * Return TRUE if component was changed, FALSE otherwise - * - */ - t_bool updateComponent(ICalComponent * updatedComponent); - - /** - * Helper method called by updateComponent to actually replace - * the property data-members with updatedComponent's data-members. - * @param ICalComponent * updatedComponent - * - * @return virtual void - */ - virtual void updateComponentHelper(TimeBasedEvent * updatedComponent); - - /** - * Compare TimeBasedEvents by UID. Used by JulianPtrArray::QuickSort method. - * @param a first TimeBasedEvent - * @param b second TimeBasedEvent - * - * @return a.getUID().compareTo(b.getUID()) - */ - static int CompareTimeBasedEventsByUID(const void * a, const void * b); - - /** - * Compare TimeBasedEvents by DTSTART. Used by JulianPtrArray::QuickSort method. - * @param a first TimeBasedEvent - * @param b second TimeBasedEvent - * - * @return a.getDTSTART().compareTo(b.getDTSTART()) - */ - static int CompareTimeBasedEventsByDTStart(const void * a, const void * b); - - -protected: - - /** - * store the data, depending on property name, property value - * parameter names, parameter values, and the current line. - * subclasses should overwrite this method, but call this method - * to handle most properties. If this method returns FALSE, subclass - * then should handles specific properties of that class. - * - * @param strLine current line to process - * @param propName name of property - * @param propVal value of property - * @param parameters property's parameters - * @param vTimeZones vector of timezones - * @return TRUE if line was handled, FALSE otherwise - */ - virtual t_bool storeData(UnicodeString & strLine, - UnicodeString & propName, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); -public: - typedef void (TimeBasedEvent::*SetOp) (UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - /* Clients should NOT call below methods */ - void storeAttach(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeAttendees(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeCategories(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeClass(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeComment(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeContact(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeCreated(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDescription(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDTStart(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDTStamp(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeExDate(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeExRule(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeLastModified(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeOrganizer(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeRDate(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeRRule(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeRecurrenceID(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeRelatedTo(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeRequestStatus(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeSequence(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeStatus(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeSummary(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeUID(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeURL(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - void ApplyStoreOp(void (TimeBasedEvent::*op) (UnicodeString & strLine, - UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones), - UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) - { - (this->*op)(strLine, propVal, parameters, vTimeZones); - } -protected: - /** - * Sets default data. Currently does following: - * 1) Sets Summary to first 60 characters of Description if Summary is empty. - * 2) Sets sequence number to 0 if sequence number is less than 0. - * 3) Sets CLASS to PUBLIC if Class is empty or out of range. - */ - virtual void selfCheck(); - - /* - void checkRecurrence(); - virtual void checkRange(); - void setDefaultProps(UnicodeString sPropName); - */ - -private: - - /** - * Generates vector of DateTimes representing dates of - * recurrence. Does this given starting time, vector of rrule, - * rdate, exrule, exdate and bound. Also takes optional - * timezones vector to adjust rdate, exdate and rrule, exrule - * (TODO: make rrules, exrules use timezones) - * and a log file to log recurrence errors. - * Used by createRecurrenceEvents method. - * @param vOut output vector of dates of recurrence - * @param start starting time of recurrence - * @param vRRules vector of RRULES (UnicodeString) - * @param vExRules vector of EXRULES (UnicodeString) - * @param vRDatesProp vector of RDATES (ICalProperty) - * @param vExDatesProp vector of EXDATES (ICalProperty) - * @param iBound bound value - * @param vTimeZones vector of timezones - * @param log log file - */ - static void generateDates(JulianPtrArray * vOut, DateTime start, - JulianPtrArray * vRRules, JulianPtrArray * vExRules, - JulianPtrArray * vRDatesProp, JulianPtrArray * vExDatesProp, t_int32 iBound, - JulianPtrArray * vTimeZones = 0, JLog * log = 0); - - /** - * Takes in either RDate or ExDate ICalProperty vector, and fills in vOut with - * DateTime strings from vector. Also applies TimeZone information to - * strings when necessary. A flag to check if vector is RDate or ExDate - * is necessary because RDate can have Period, Date info, while ExDate cannot. - * For example, if RDate vector contains RDATE;TZID=America/New-York:19971110T070000, - * then bIsRDate must be TRUE (caller responsible for this), and vOut contains - * the string "19971110T120000Z" (note timezones is applied). - * Used by generateDates method. - * @param vOut output vector of DateTime strings - * @param vDateProp ICalProperty vector to split. - * @param bIsRDate whether vector if RDate or EXDate - * @param vTimeZones vector of timezones - */ - static void splitDates(JulianPtrArray * vOut, - JulianPtrArray * vDateProp, t_bool bIsRDate, - JulianPtrArray * vTimeZones); - - - /* - JulianPtrArray * getPeriodDatesHelper(JulianPtrArray * vDates); - JulianPtrArray * getPeriodDates(JulianPtrArray * vTimeZones); - */ - - /** - * Takes RDate vector and returns all strings of RDates that are - * of PERIOD value. For example if RDATE;VALUE=PERIOD:19971110T112233Z/PT1H, - * return the string "19971110T112233Z/PT1H". - * @param out output vector of strings of PERIOD RDates - */ - void getPeriodRDates(JulianPtrArray * out); - - - /** - * Takes vector of recurrences dates and generates recurrence events in vOut. - * Used by createRecurrenceEvents method. - * @param vOut output vector of recurrence events - * @param dates vector of recurrence dates - * @param origStart starting time of original compressed event - * @param vTimeZones vector of timezones - */ - void populateDates(JulianPtrArray * vOut, JulianPtrArray * dates, - DateTime origStart, JulianPtrArray * vTimeZones); - - /** - * Returns TRUE if this TimeBasedEvent's ID is the same as the component's - * ID. ID is represented as the (UID, RecurrenceID) pair. - * If UID's on this and component do NOT match return FALSE; - * If there is no RecurrenceID on this TBE and component and UID matches, - * return TRUE; - * If there is a RecurrenceID on EITHER this or component, if both have - * RecurrenceID and they MATCH return TRUE. if don't match return FALSE. - * If one has RecurrenceID and other doesn't return FALSE. - * @param TimeBasedEvent * component - * - * @return t_bool - */ - t_bool isExactMatchingID(TimeBasedEvent * component); - -#if 0 - /** - * Returns TRUE if this component is more recent than component. - * Rules To define recent: - * Returns compare(Sequence Num) else if equal - * Returns compare(DTSTAMP) - * - * @param TimeBasedEvent * component - * - * @return t_bool - */ - t_bool isMoreRecent(TimeBasedEvent * component); -#endif - - /* -- DATA MEMBERS */ - -protected: - /* log file ptr */ - JLog * m_Log; - - JulianString m_sCurl; /* the calendar url of this component, identifies its cal store */ - -private: - - /* recurrence bound value */ - static t_int32 ms_iBound; - - /* method name of calendar */ - UnicodeString m_sMethod; - - /* file loaded from */ - UnicodeString m_sFileName; - - /* DTStart of first instance of a recurrence */ - DateTime m_origDTStart; - - /* DTStart of my instance of a recurrence */ - DateTime m_origMyDTStart; - - /* TRUE = Anniversary event, default is FALSE */ - t_bool m_bAllDayEvent; - - /*------------ SUBCOMPONENTS ---------------*/ - JulianPtrArray * m_AlarmsVctr; - /*------------ PROPERTIES --- (VALUE VALUE TYPES in COMMENTS) -------------------------*/ - - JulianPtrArray * m_AttachVctr; /* URL */ - JulianPtrArray * m_AttendeesVctr; /* CAL-ADDRESS */ - JulianPtrArray * m_CategoriesVctr; /* TEXT */ - ICalProperty * m_Class; /* class keyword */ - JulianPtrArray * m_CommentVctr; /* TEXT */ - JulianPtrArray * m_ContactVctr; /* TEXT OR URL */ - ICalProperty * m_Created; /* DATETIME */ - ICalProperty * m_Description; /* TEXT */ - ICalProperty * m_DTStart; /* DATETIME OR DATE */ - ICalProperty * m_DTStamp; /* DATETIME */ - JulianPtrArray * m_ExDateVctr; /* DATETIME */ - JulianPtrArray * m_ExRuleVctr; /* RECURRENCE */ - ICalProperty * m_LastModified; /* DATETIME */ - ICalProperty * m_Organizer; /* CAL-ADDRESS */ - JulianPtrArray * m_RDateVctr; /* DATETIME, DATE, OR PERIOD */ - JulianPtrArray * m_RRuleVctr; /* RECURRENCE */ - ICalProperty * m_RecurrenceID; /* DATETIME */ - JulianPtrArray * m_RelatedToVctr; /* TEXT (must be a UID) */ - /*ICalProperty * m_RequestStatus; */ - JulianPtrArray * m_RequestStatusVctr; /* 3digit number, error Description UnicodeString, optional exception text */ - ICalProperty * m_Sequence; /* INTEGER >= 0 */ - ICalProperty * m_Status; /* status keyword */ - ICalProperty * m_Summary; /* TEXT */ - ICalProperty * m_UID; /* TEXT */ - ICalProperty * m_URL; /* TEXT OR URL */ - JulianPtrArray * m_XTokensVctr; /* TEXT */ - - /*------------ END PROPERTIES ------------------------------------------*/ -}; - -#endif /* __TIMEBASEDEVENT_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/tzpart.h b/mozilla/calendar/modules/core/ical/inc/tzpart.h deleted file mode 100644 index 497c58ef451..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/tzpart.h +++ /dev/null @@ -1,397 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * tzpart.h - * John Sun - * 2/24/98 9:48:53 AM - */ - -#ifndef __TZPART_H_ -#define __TZPART_H_ - -#include -#include "icalcomp.h" -#include "datetime.h" - -/** - * Implements the standardc and daylightc parts of an iCal VTimeZone object. - */ -class TZPart: public ICalComponent -{ -private: -#if 0 - /** - * Default constructor. Hide from clients. - */ - TZPart(); -#endif -protected: - /** - * Copy constructor. - * @param that TZPart to copy - */ - TZPart(TZPart & that); - -public: - - /** - * Create TZPart, passing in a logfile. - * @param initLog log file to write errors to - */ - TZPart(JLog * initLog = 0); - - /** - * Destructor - */ - ~TZPart(); - - /* -- Start of ICALComponent interface -- */ - - /** - * The parse method is the standard interface for ICalComponent - * subclasses to parse from an ICalReader object - * and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.). - * The method type can be set to \"\" if there is no method to be loaded. - * Also accepts a vector of VTimeZone objects to apply to - * the DateTime properties of the component. - * 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level, - * it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for - * this. - * - * @param brFile ICalReader to load from - * @param sType name of component (i.e. VEVENT, VTODO, VTIMEZONE) - * @param parseStatus return parse error status string (normally return "OK") - * @param vTimeZones vector of VTimeZones to apply to datetimes - * @param bIgnoreBeginError TRUE = ignore first "BEGIN:DAYLIGHT(STANDARD)", FALSE otherwise - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parse error status string (parseStatus) - */ - virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sType, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0, - t_bool bIgnoreBeginError = FALSE, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Returns a clone of this object - * @param initLog log file to write errors to - * - * @return clone of this object - */ - virtual ICalComponent * clone(JLog * initLog); - - /** - * Return TRUE if component is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Print all contents of ICalComponent to iCal export format. - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString(); - - /** - * Print all contents of ICalComponent to iCal export format, depending - * on attendee name, attendee delegated-to, and where to include recurrence-id or not - * - * @param method method name (REQUEST,PUBLISH, etc.) - * @param name attendee name to filter with - * @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString(UnicodeString method, UnicodeString name, - t_bool isRecurring); - - /** - * Print all contents of ICalComponent to human-readable string. - * - * @return string containing human-readable format of ICalComponent - */ - virtual UnicodeString toString(); - - /** - * Depending on character passed in, returns a string that represents - * the ICAL export string of that property that the character represents, if - * other paramaters not null, then print out information is filtered in several ways - * Attendee print out can be filtered so that only attendee with certain name is printed - * also, can print out the relevant attendees in a delegation message - * (ie. owner, delegate-to, delegate-from) - * - * @param c char of what property to print - * @param sFilterAttendee name of attendee to print - * @param bDelegateRequest TRUE if a delegate request, FALSE if not - * @return ICAL export format of that property - */ - virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest = FALSE); - - /** - * convert a character to the content of a property in string - * human-readable format - * @param c a character represents a property - * @param dateFmt for formatting datetimes - * - * @return property in human-readable string - */ - virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt); - - /** - * Returns the ICAL_COMPONENT enumeration value of this ICalComponent. - * Each ICalComponent subclass must return a unique ICAL_COMPONENT value. - * - * @return ICAL_COMPONENT value of this component - */ - virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_TZPART; } - - /** - * Update the private property data-members with updatedComponent's - * property data-members. - * Usually, overwriting data-members should only occur if updatedComponent - * is more recent than the current component. - * Return TRUE if component was changed, FALSE otherwise - * @param ICalComponent * updatedComponent - * - * @return virtual t_bool - */ - virtual t_bool updateComponent(ICalComponent * updatedComponent); - - /* -- End of ICALComponent interface -- */ - - /* COMMENT */ - void addComment(UnicodeString s, JulianPtrArray * parameters = 0); - void addCommentProperty(ICalProperty * prop); - JulianPtrArray * getComment() const { return m_CommentVctr; } - - /* TZNAME */ - void addTZName(UnicodeString s, JulianPtrArray * parameters = 0); - void addTZNameProperty(ICalProperty * prop); - JulianPtrArray * getTZName() const { return m_TZNameVctr; } - - /* DTSTART */ - DateTime getDTStart() const; - void setDTStart(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getDTStartProperty() const { return m_DTStart; } - - /* RDATE */ - DateTime getRDate() const; - void setRDate(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getRDateProperty() const { return m_RDate; } - - /* RRULE */ - UnicodeString getRRule() const; - void setRRule(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getRRuleProperty() const { return m_RRule; } - - /* TZOFFSETTO */ - UnicodeString getTZOffsetTo() const; - void setTZOffsetTo(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getTZOffsetToProperty() const { return m_TZOffsetTo; } - - /* TZOFFSETFROM */ - UnicodeString getTZOffsetFrom() const; - void setTZOffsetFrom(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getTZOffsetFromProperty() const { return m_TZOffsetFrom; } - - /* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */ - void addXTokens(UnicodeString s); - JulianPtrArray * getXTokens() const { return m_XTokensVctr; } - - /* NAME (DAYLIGHT OR STANDARD) */ - UnicodeString getName() const { return m_Name; } - void setName(UnicodeString s); - - /** - * Return start month value of timezone part start time. 0-based - * - * @return start month value (0-11) - */ - t_int32 getMonth() const { return m_StartMonth; } - - /** - * Return start day of week in month value of timezone part start time. - * Usually -1 or 1. - * @return start day of week in month (-5 to 5) - */ - t_int32 getDayOfWeekInMonth() const { return m_StartWeek; } - - /** - * Return start day of timezone part start time. - * Usually Calendar::SUNDAY - * @return start day value (Calendar::SUNDAY - Calendar::SATURDAY) - * @see Calendar - */ - t_int32 getDay() const { return m_StartDay; } - - /** - * Return starting time in milliseconds of timezone part start time. - * For example, if start time is 2AM, then return 7200000. - * - * @return start time value in milliseconds - */ - t_int32 getStartTime() const { return m_StartTime; } - - /** - * Return expiration date of TimeZone part, if returned value is - * invalid, then no expiration date. - * - * @return expiration date, invalid means no expiration date - */ - DateTime getUntil() { return m_Until; } - - /* TODO: move later */ - static float UTCOffsetToFloat(UnicodeString & utcOffset); - -private: - - /** - * Helper method called by updateComponent to actually replace - * the property data-members with updatedComponent's data-members. - * @param TZPart * updatedComponent - * - * @return virtual void - */ - void updateComponentHelper(TZPart * updatedComponent); - - /** - * Selfcheck data members. Currently does nothing - */ - void selfCheck(); - - /** - * store the data, depending on property name, property value - * parameter names, parameter values, and the current line - * - * @param strLine current line to process - * @param propName name of property - * @param propVal value of property - * @param parameters property's parameters - * @param vTimeZones vector of timezones - */ - void storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters); -public: - - typedef void (TZPart::*SetOp) (UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - /* Clients should NOT call below methods */ - void storeComment(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeTZName(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDTStart(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeRDate(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeRRule(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeTZOffsetTo(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeTZOffsetFrom(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - void ApplyStoreOp(void (TZPart::*op) (UnicodeString & strLine, - UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones), - UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) - { - (this->*op)(strLine, propVal, parameters, vTimeZones); - } - -private: - - /** - * Takes RRULE value and generates startmonth, startday, startweek, starttime - * and until. Return TRUE if parse went OK, FALSE if error occurred. - * - * @return TRUE if parse went OK, FALSE if error occurred. - */ - t_bool parseRRule(); - - /** - * Takes RDATE value and generates startmonth, startday, startweek. - */ - void parseRDate(); - -#if 0 - /** - * Given data members, generates timezone critical information - * (start month,day,week,time,until). Calls either parseRRule or - * parseRDate to do this. If error in parse, return FALSE, else - * return TRUE. - * - * @return TRUE if parse went OK, FALSE if error occurred - */ - t_bool parseRule(); -#endif - - - /* -- DATA MEMBERS -- */ - - /*static UnicodeString m_strDefaultFmt; - static UnicodeString ms_sAllMessage;*/ - - /* for RRULE timezones */ - t_int32 m_StartMonth; - t_int32 m_StartDay; - t_int32 m_StartWeek; - t_int32 m_StartTime; - - /* used to print out DTStart back */ - t_int32 m_iStartYear; - t_int32 m_iStartMonth; - t_int32 m_iStartDay; - t_int32 m_iStartHour; - t_int32 m_iStartMinute; - t_int32 m_iStartSecond; - - /* used to print out RDate back */ - t_int32 m_iRDateYear; - t_int32 m_iRDateMonth; - t_int32 m_iRDateDay; - t_int32 m_iRDateHour; - t_int32 m_iRDateMinute; - t_int32 m_iRDateSecond; - - DateTime m_Until; - - UnicodeString m_Name; /* STANDARD or DAYLIGHT */ - - JulianPtrArray * m_CommentVctr; - JulianPtrArray * m_TZNameVctr; - ICalProperty * m_DTStart; - ICalProperty * m_RDate; - ICalProperty * m_RRule; - ICalProperty * m_TZOffsetTo; - ICalProperty * m_TZOffsetFrom; - JulianPtrArray * m_XTokensVctr; /* TEXT */ - - JLog * m_Log; -}; - -#endif /* __TZPART_H_ */ diff --git a/mozilla/calendar/modules/core/ical/inc/unistrto.h b/mozilla/calendar/modules/core/ical/inc/unistrto.h deleted file mode 100644 index d7ca05ad00e..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/unistrto.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * unistrto.h - * John Sun - * 2/3/98 12:07:00 PM - */ - -#ifndef __UNICODESTRINGTOKENIZER_H_ -#define __UNICODESTRINGTOKENIZER_H_ - -#include -#include "ptypes.h" - -/** - * A simple string tokenizer class for UnicodeString. - * It is modeled after the java.util.StringTokenizer class - * and uses a similar subset of Java's API. - */ -class UnicodeStringTokenizer -{ -private: - - /** current position in string */ - t_int32 m_CurrentPosition; - - /** maximum position in string */ - t_int32 m_MaxPosition; - - /** the string to tokenize */ - UnicodeString m_String; - - /** the string delimeters for seperating tokens */ - UnicodeString m_StringDelimeters; - - /** Skips delimeters. */ - void skipDelimeters(); - -public: - - /** - * Constructor. - * @param str string to tokenize - * @param delim string delimeters - */ - UnicodeStringTokenizer(UnicodeString & str, UnicodeString & delim); - -#if 0 - /** - * Constructor. Sets default delimeters to whitespace characters. - * Strongly recommend using other constructor. - * @param str string to tokenize - */ - UnicodeStringTokenizer(UnicodeString & str); -#endif - - /** - * Tests if there are more tokens available from this string - * - * @return TRUE if more tokens, FALSE otherwise - */ - t_bool hasMoreTokens(); - - - /** - * Returns next token in out if available. If no more tokens - * status is set to 1. - * @param out next available token output - * @param status status error, 1 is ran-out-of-tokens, 0 is OK - * - * @return next available token (out) - */ - UnicodeString & nextToken(UnicodeString & out, ErrorCode & status); - -#if 0 - /** - * Returns next token in out if available. If no more tokens - * status is set to 1. Also sets delimeters to delim for further tokenizing. - * @param out next available token output - * @param delim the new delimeters - * @param status status error, 1 is ran-out-of-tokens, 0 is OK - * - * @return next available token (out) - */ - UnicodeString & nextToken(UnicodeString & out, UnicodeString & sDelim, ErrorCode & status); -#endif - -}; - -#endif /* __UNICODESTRINGTOKENIZER_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/uri.h b/mozilla/calendar/modules/core/ical/inc/uri.h deleted file mode 100644 index 9bd8e28ca7a..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/uri.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * uri.h - * John Sun - * 4/3/98 11:27:52 AM - */ -#ifndef __URI_H_ -#define __URI_H_ - -#include - -/** - * URI encapsulates the ICAL URI data-type. The URI data-type - * is used to identify values that contain a uniform resource - * identifier (URI) type of reference to the property value. - */ -class URI -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - - /** URL string */ - UnicodeString m_URI; -public: - - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - - /** - * Default constructor makes string "". - */ - URI(); - - /** creates a URI with full URI */ - URI(UnicodeString fulluri); - - URI(char * fulluri); - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - - /** - * returns full uri string - * (i.e. http://host1.com/my-report.txt, mailto:a@acme.com) - * - * @return the full uri string - */ - UnicodeString getFullURI() { return m_URI; } - - /** return protocol name (i.e. Mailto:, http:, ftp:) */ - /*UnicodeString getProtocol();*/ - - /** - * return name (right side of ':' in full uri) - * (i.e. host1.com/my-report.txt, a@acme.com) - * - * @return the return name - */ - UnicodeString getName(); - - /** - * set full uri string - * @param uri new full URI string - */ - void setFullURI(UnicodeString uri) { m_URI = uri; } - - /** - * Checks whether string is a URI. - * For now just checks if a colon exists in string and - * it does not start with a colon. - * Thus: yoadfs:fdsaf is a valid URL. - * @param UnicodeString & s - * - * @return static t_bool - */ - static t_bool IsValidURI(UnicodeString & s); -}; - -#endif /* __URI_H_ */ - - diff --git a/mozilla/calendar/modules/core/ical/inc/valarm.h b/mozilla/calendar/modules/core/ical/inc/valarm.h deleted file mode 100644 index ac122e46607..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/valarm.h +++ /dev/null @@ -1,381 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * valarm.h - * John Sun - * 7/22/98 10:34:34 AM - */ - -#ifndef __VALARM_H_ -#define __VALARM_H_ - -#include -#include "datetime.h" -#include "ptrarray.h" -#include "jlog.h" -#include "icalcomp.h" -#include "attendee.h" -#include "keyword.h" -#include "nscalcoreicalexp.h" - -class NS_CAL_CORE_ICAL VAlarm: public ICalComponent -{ -public: - /** an enumeration of the ACTION parameter */ - /* default is audio */ - enum ACTION - { - ACTION_AUDIO = 0, - ACTION_DISPLAY = 1, - ACTION_EMAIL = 2, - ACTION_PROCEDURE = 3, - ACTION_INVALID = -1 - }; - -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - JLog * m_Log; - - /* -- properties in ALL action types -- */ - /*ICalProperty * m_Action;*/ - ACTION m_Action; - - /* as a duration */ - ICalProperty * m_Trigger; - - /* as a datetime */ - DateTime m_TriggerDateTime; - - /* duration and repeat are optional */ - ICalProperty * m_Duration; - ICalProperty * m_Repeat; - - JulianPtrArray * m_XTokensVctr; - - /* -- end ALL action types properties -- */ - - - /* used in more that one action type but not all */ - JulianPtrArray * m_AttachVctr; - ICalProperty * m_Description; - - /* audio props */ - /* always ONLY one attachment */ - /* NO description */ - - /* display props */ - /* NO attachments */ - /* One description */ - - /* email props */ - /* any number of attachments */ - /* One description */ - /* at least one attendee */ - JulianPtrArray * m_AttendeesVctr; - ICalProperty * m_Summary; - - /* procedure props */ - /* always ONLY one attachment */ - /* Zero or One description */ - - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - /** - * Creates NLS TimeZone from start month,day,week,time,until. - * TODO: possible bug, may need to call everytime before calling getNLSTimeZone(). - */ - void selfCheck(); - - /** - * store the data, depending on property name, property value - * parameter names, parameter values, and the current line. - * - * @param strLine current line to process - * @param propName name of property - * @param propVal value of property - * @param parameters property's parameters - * @param vTimeZones vector of timezones - * @return TRUE if line was handled, FALSE otherwise - */ - void storeData(UnicodeString & strLine, - UnicodeString & propName, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - /** - * Helper method called by updateComponent to actually replace - * the property data-members with updatedComponent's data-members. - * @param VTimeZone * updatedComponent - * - * @return virtual void - */ - void updateComponentHelper(VAlarm * updatedComponent); -public: - typedef void (VAlarm::*SetOp) (UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - /* Clients should not call these methods even though they are not public */ - - void storeAction(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeAttach(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeAttendee(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDescription(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDuration(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeRepeat(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeSummary(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeTrigger(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - void ApplyStoreOp(void (VAlarm::*op) (UnicodeString & strLine, - UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones), - UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) - { - (this->*op)(strLine, propVal, parameters, vTimeZones); - } -private: - - - -#if 0 - VAlarm(); -#endif -protected: - - VAlarm(VAlarm & that); - -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - VAlarm(JLog * initLog = 0); - - virtual ~VAlarm(); - - /* -- Start of ICALComponent interface -- */ - - /** - * The parse method is the standard interface for ICalComponent - * subclasses to parse from an ICalReader object - * and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.). - * The method type can be set to \"\" if there is no method to be loaded. - * Also accepts a vector of VTimeZone objects to apply to - * the DateTime properties of the component. - * 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level, - * it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for - * this. - * - * @param brFile ICalReader to load from - * @param sType name of component (VTIMEZONE) - * @param parseStatus return parse error status string (normally return "OK") - * @param vTimeZones vector of VTimeZones to apply to datetimes - * @param bIgnoreBeginError TRUE = ignore first "BEGIN:VTIMEZONE", FALSE otherwise - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parse error status string (parseStatus) - */ - virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sType, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0, - t_bool bIgnoreBeginError = FALSE, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Returns a clone of this object - * @param initLog log file to write errors to - * - * @return clone of this object - */ - virtual ICalComponent * clone(JLog * initLog); - - /** - * Return TRUE if component is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Print all contents of ICalComponent to iCal export format. - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString(); - - /** - * Print all contents of ICalComponent to iCal export format, depending - * on attendee name, attendee delegated-to, and where to include recurrence-id or not - * - * @param method method name (REQUEST,PUBLISH, etc.) - * @param name attendee name to filter with - * @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString(UnicodeString method, UnicodeString name, - t_bool isRecurring); - - /** - * Print all contents of ICalComponent to human-readable string. - * - * @return string containing human-readable format of ICalComponent - */ - virtual UnicodeString toString(); - - /** - * Depending on character passed in, returns a string that represents - * the ICAL export string of that property that the character represents, if - * other paramaters not null, then print out information is filtered in several ways - * Attendee print out can be filtered so that only attendee with certain name is printed - * also, can print out the relevant attendees in a delegation message - * (ie. owner, delegate-to, delegate-from) - * - * @param c char of what property to print - * @param sFilterAttendee name of attendee to print - * @param bDelegateRequest TRUE if a delegate request, FALSE if not - * @return ICAL export format of that property - */ - virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest = FALSE); - - /** - * convert a character to the content of a property in string - * human-readable format - * @param c a character represents a property - * @param dateFmt for formatting datetimes - * - * @return property in human-readable string - */ - virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt); - - /** - * Returns the ICAL_COMPONENT enumeration value of this ICalComponent. - * Each ICalComponent subclass must return a unique ICAL_COMPONENT value. - * - * @return ICAL_COMPONENT value of this component - */ - virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VALARM; } - - /** - * Update the private property data-members with updatedComponent's - * property data-members. - * Usually, overwriting data-members should only occur if updatedComponent - * is more recent than the current component. - * Return TRUE if component was changed, FALSE otherwise - * @param ICalComponent * updatedComponent - * - * @return virtual t_bool - */ - virtual t_bool updateComponent(ICalComponent * updatedComponent); - - /* -- End of ICALComponent interface -- */ - - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - VAlarm::ACTION getAction() const { return m_Action; } - void setAction(VAlarm::ACTION action) { m_Action = action; } - - /* nsCalDuration */ - nsCalDuration getDuration() const; - void setDuration(nsCalDuration s, JulianPtrArray * parameters = 0); - ICalProperty * getDurationProperty() const { return m_Duration; } - - /* Repeat */ - t_int32 getRepeat() const; - void setRepeat(t_int32 i, JulianPtrArray * parameters = 0); - ICalProperty * getRepeatProperty() const { return m_Repeat; } - - /* Trigger */ - /* can be date-time or duration */ - nsCalDuration getTriggerAsDuration() const; - void setTriggerAsDuration(nsCalDuration s, JulianPtrArray * parameters = 0); - void setTriggerAsDateTime(DateTime s); - ICalProperty * getTriggerProperty() const { return m_Trigger; } - DateTime getTriggerAsDateTime(DateTime startTime) const; - - /* Description */ - UnicodeString getDescription() const; - void setDescription(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getDescriptionProperty() const { return m_Description; } - - /* SUMMARY */ - UnicodeString getSummary() const; - void setSummary(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getSummaryProperty() const { return m_Summary; } - - /* ATTACH */ - void addAttach(UnicodeString s, JulianPtrArray * parameters = 0); - void addAttachProperty(ICalProperty * prop); - JulianPtrArray * getAttach() const { return m_AttachVctr; } - - /* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */ - void addXTokens(UnicodeString s); - JulianPtrArray * getXTokens() const { return m_XTokensVctr; } - - /* ATTENDEES */ - void addAttendee(Attendee * a); - JulianPtrArray * getAttendees() const { return m_AttendeesVctr ; } - - /* JLOG */ - JLog * getLog() const { return m_Log; } - - /*----------------------------- - ** UTILITIES - **---------------------------*/ - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - - /** - * Converts string to ACTION enumeration. Returns AUDIO if error. - * @param sAction action string - * - * @return ACTION enumeration value of sAction - */ - static VAlarm::ACTION stringToAction(UnicodeString & sAction); - - /** - * Converts ACTION to string. - * @param action action value - * @param out output action string - * - * @return output action string - */ - static UnicodeString & actionToString(VAlarm::ACTION action, UnicodeString & out); - - /*----------------------------- - ** OVERLOADED OPERATORS - **---------------------------*/ -}; - -#endif /* __VALARM_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/vevent.h b/mozilla/calendar/modules/core/ical/inc/vevent.h deleted file mode 100644 index 890674b1bf1..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/vevent.h +++ /dev/null @@ -1,338 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * vevent.h - * John Sun - * 2/9/98 10:50:22 PM - */ - -#ifndef __VEVENT_H_ -#define __VEVENT_H_ - -#include "datetime.h" -#include "duration.h" -#include "ptrarray.h" -#include "tmbevent.h" -#include "jlog.h" -#include "nscalcoreicalexp.h" - -class NS_CAL_CORE_ICAL VEvent : public TimeBasedEvent -{ -private: -#if 0 - VEvent(); -#endif -protected: - /** - * Copy constructor. - * @param that VEvent to copy. - */ - VEvent(VEvent & that); - -public: - - /** - * Constructor. Create VEvent with initial log file set to initLog. - * @param initLog initial log file pointer - */ - VEvent(JLog * initLog = 0); - - /** - * Destructor. - */ - ~VEvent(); - - /* -- Start of ICALComponent interface -- */ - - /** - * The parse method is the standard interface for ICalComponent - * subclasses to parse from an ICalReader object - * and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.). - * The method type can be set to \"\" if there is no method to be loaded. - * Also accepts a vector of VTimeZone objects to apply to - * the DateTime properties of the component. - * 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level, - * it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for - * this. - * - * @param brFile ICalReader to load from - * @param sType name of component (i.e. VEVENT, VTODO, VTIMEZONE) - * @param parseStatus return parse error status string (normally return "OK") - * @param vTimeZones vector of VTimeZones to apply to datetimes - * @param bIgnoreBeginError TRUE = ignore first "BEGIN:VEVENT", FALSE otherwise - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parse error status string (parseStatus) - */ - UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0, - t_bool bIgnoreBeginError = FALSE, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Returns a clone of this object - * @param initLog log file to write errors to - * - * @return clone of this object - */ - virtual ICalComponent * clone(JLog * initLog); - - /** - * Return TRUE if component is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - t_bool isValid(); - - /** - * Print all contents of ICalComponent to human-readable string. - * - * @return string containing human-readable format of ICalComponent - */ - virtual UnicodeString toString(); - - /** - * Depending on character passed in, returns a string that represents - * the ICAL export string of that property that the character represents, if - * other paramaters not null, then print out information is filtered in several ways - * Attendee print out can be filtered so that only attendee with certain name is printed - * also, can print out the relevant attendees in a delegation message - * (ie. owner, delegate-to, delegate-from) - * - * @param c char of what property to print - * @param sFilterAttendee name of attendee to print - * @param bDelegateRequest TRUE if a delegate request, FALSE if not - * @return ICAL export format of that property - */ - virtual UnicodeString formatChar(t_int32 c, - UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE); - - /** - * convert a character to the content of a property in string - * human-readable format - * @param c a character represents a property - * @param dateFmt for formatting datetimes - * - * @return property in human-readable string - */ - virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt); - - /** - * Returns the ICAL_COMPONENT enumeration value of this ICalComponent. - * Each ICalComponent subclass must return a unique ICAL_COMPONENT value. - * - * @return ICAL_COMPONENT value of this component - */ - virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VEVENT ; } - - /* -- End of ICALComponent interface -- */ - - /** - * Overridden virtual method used as wrapper to ICalComponent::format method. - * @param strFmt iCal format string - * @param sFilterAttendee attendee to filter - * @param delegateRequest delegate request = TRUE, FALSE otherwise - * - * @return output iCal formatted export string - */ - virtual UnicodeString formatHelper(UnicodeString & strFmt, - UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE); - - /** - * Helper method. Overriden virtual method. Used by subclasses to - * populate recurrence-dependent data. For example, a recurring - * VEvent needs to have DTEnd calculated from recurring - * DTStart. VEvent will overwrite method set DTEnd correctly. - * Abstract difference() method is used to calculate ldiff. - * Need to pass vector of RDate periods in case end value must - * be adjusted in RDATE is a PERIOD value. - * @param start recurrence instance starting time - * @param ldiff abstract difference value - * @param vPer vector of RDate periods - */ - void populateDatesHelper(DateTime start, Date ldiff, JulianPtrArray * vPer); - - - /* overridden message methods */ - virtual UnicodeString cancelMessage(); - virtual UnicodeString requestMessage(); - virtual UnicodeString requestRecurMessage(); - virtual UnicodeString counterMessage(); - virtual UnicodeString declineCounterMessage(); - virtual UnicodeString addMessage(); - virtual UnicodeString refreshMessage(UnicodeString sAttendeeFilter); - virtual UnicodeString allMessage(); - virtual UnicodeString replyMessage(UnicodeString sAttendeeFilter); - virtual UnicodeString publishMessage(); - virtual UnicodeString publishRecurMessage(); - - /** - * Overridden method. Calculate difference from start, end time - * For VEvent, this would be DTEnd - DTStart. - * For VTodo, this would be Due - DTStart. - * - * @return virtual Date - */ - Date difference(); - - /** - * Sets default human-readable event format pattern to s. - * @param s new event format pattern - */ - static void setDefaultFmt(UnicodeString s); - - /* ------------------------------------ - * SET/GET DATA MEMBER - *-------------------------------------*/ - - /* DTEND */ - DateTime getDTEnd() const; - void setDTEnd(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getDTEndProperty() const { return m_DTEnd; } - - /* DURATION */ - nsCalDuration getDuration() const; - void setDuration(nsCalDuration s, JulianPtrArray * parameters = 0); - /*ICalProperty * getDurationProperty() const { return m_Duration; }*/ - - /* GEO */ - UnicodeString getGEO() const; - void setGEO(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getGEOProperty() const { return m_GEO; } - - /* LOCATION */ - UnicodeString getLocation() const; - void setLocation(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getLocationProperty() const { return m_Location; } - - /* PRIORITY */ - t_int32 getPriority() const; - void setPriority(t_int32 i, JulianPtrArray * parameters = 0); - ICalProperty * getPriorityProperty() const { return m_Priority; } - - /* TRANSP */ - UnicodeString getTransp() const; - void setTransp(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getTranspProperty() const { return m_Transp; } - - /* RESOURCES */ - void addResources(UnicodeString s, JulianPtrArray * parameters = 0); - void addResourcesProperty(ICalProperty * prop); - JulianPtrArray * getResources() const { return m_ResourcesVctr; } - void addResourcesPropertyVector(UnicodeString & propVal, JulianPtrArray * parameters); - - /* MYORIGEND */ - void setMyOrigEnd(DateTime d) { m_origMyDTEnd = d; } - DateTime getMyOrigEnd() { return m_origMyDTEnd; } - - /* ORIGEND */ - void setOrigEnd(DateTime d) { m_origDTEnd = d; } - DateTime getOrigEnd() { return m_origDTEnd; } - - virtual void updateComponentHelper(TimeBasedEvent * updatedComponent); - -private: - - /** - * store the data, depending on property name, property value - * parameter names, parameter values, and the current line. - * If this method returns FALSE, property not valid. - * - * @param strLine current line to process - * @param propName name of property - * @param propVal value of property - * @param parameters property's parameters - * @param vTimeZones vector of timezones - * @return TRUE if property handled, FALSE otherwise - */ - t_bool storeData(UnicodeString & strLine, - UnicodeString & propName, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); -public: - - typedef void (VEvent::*SetOp) (UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - /* Clients should NOT call below methods */ - void storeDTEnd(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDuration(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeGEO(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeLocation(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storePriority(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeResources(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeTransp(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - void ApplyStoreOp(void (VEvent::*op) (UnicodeString & strLine, - UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones), - UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) - { - (this->*op)(strLine, propVal, parameters, vTimeZones); - } - -private: - - /** - * Sets default data. Currently does following: - * 1) Sets DTEnd to correct value, depending on DURATION, DTSTART - * (see spec on rules) - * 2) Sets TRANSP to TRANSPARENT if anniversary event - */ - void selfCheck(); - - - /*void setDefaultProps(UnicodeString propName);*/ - - /* -- MEMBERS -- */ - - /* DTEnd of first instance of a recurrence */ - DateTime m_origDTEnd; - - /* DTEnd of my instance of a recurrence */ - DateTime m_origMyDTEnd; - - /** used for initial parse only to calculate first DTEnd, then discarded */ - nsCalDuration * m_TempDuration; - - /*------------------------------------------------- - * DATA MEMBER (to augment TimeBasedEvent) - *------------------------------------------------*/ - - ICalProperty * m_DTEnd; /* DATETIME */ - ICalProperty * m_GEO; /* geographic position (two floats)*/ - ICalProperty * m_Location; /* TEXT */ - ICalProperty * m_Priority; /* INTEGER >= 0 */ - JulianPtrArray * m_ResourcesVctr; /* TEXT */ - ICalProperty * m_Transp; /* transparency keyword */ - -}; - -#endif /* __VEVENT_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/vfrbsy.h b/mozilla/calendar/modules/core/ical/inc/vfrbsy.h deleted file mode 100644 index eed345d0fea..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/vfrbsy.h +++ /dev/null @@ -1,553 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * vfrbsy.h - * John Sun - * 2/19/98 4:17:54 PM - */ - -#ifndef __VFREEBUSY_H_ -#define __VFREEBUSY_H_ - -#include -#include "datetime.h" -#include "duration.h" -#include "period.h" -#include "icalcomp.h" -#include "attendee.h" -#include "freebusy.h" -#include "jlog.h" - -class VFreebusy : public ICalComponent -{ -private: -#if 0 - - /** - * Default Constructor. Hide from clients. - */ - VFreebusy(); -#endif -protected: - - /** - * Checks private data members so they are valid. - * Sets default data. Currently does following: - * 1) Sets DTEnd to correct value, depending on DURATION, DTSTART - * (see spec on rules) - */ - void selfCheck(); - - /*public static VFreebusy * createVFreebusy(UnicodeString & string);*/ - - /** - * store the data, depending on property name, property value - * parameter names, parameter values, and the current line. - * If this method returns FALSE, property not valid. - * - * @param strLine current line to process - * @param propName name of property - * @param propVal value of property - * @param parameters property's parameters - * @param vTimeZones vector of timezones - * @return TRUE if property handled, FALSE otherwise - */ - t_bool storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters, - JulianPtrArray * vTimeZones); -public: - typedef void (VFreebusy::*SetOp) (UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - /* Clients should NOT call below methods */ - void storeAttendees(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeComment(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeContact(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - /* - void storeCreated(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - */ - void storeDuration(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDTEnd(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDTStart(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDTStamp(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeFreebusy(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeLastModified(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeOrganizer(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeRequestStatus(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeSequence(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeUID(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeURL(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - void ApplyStoreOp(void (VFreebusy::*op) (UnicodeString & strLine, - UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones), - UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) - { - (this->*op)(strLine, propVal, parameters, vTimeZones); - } - -protected: - UnicodeString formatHelper(UnicodeString & strFmt, - UnicodeString sFilterAttendee); - - /** - * Sorts vector of Freebusy periods by start time. - */ - void sortFreebusy(); - - /** - * Given a vector of Freebusy objects, - * combines freebusy objects that have the same params - * by calling the Freebusy::HasSameParams method. - */ - static void combineSameFreebusies(JulianPtrArray * freebusies); - - /** - * Given a vector of Freebusy objects, - * compress each Freebusy in the vector. - * By compressing, periods with overlapping times and same type - * are combined. Calls Freebusy::normalizePeriods. - */ - static void compressFreebusies(JulianPtrArray * freebusies); - - /** - * Takes freebusy vector - * Merges single-period Freebusy objects that are consecutive - * into one single-period Freebusy objects - * - * Alters the freebusy vector from - * FB1: p1, p2, p3 - * FB2: p4, p5 - * FB3: p6, p7 - * to - * FB1: p1 - * FB2: p2 - * FB3: p3 - * FB4: p4 - * FB5: p5 - * FB6: p6 - * FB7: p7 - * where FB1-7 will be sorted chronologically by start and normalized - */ - void mergeSinglePeriodFreebusies(); - - /** - * Given a vector of Freebusy objects, - * unzips each freebusy object. - * Unzipping means the following - * Given: - * FB1: pA, pB, pC - * FB2: pD, pE, pF - * FB3: pG, pH - * unzipping leads to: - * FB1: pA - * FB2: pB - * FB3: pC - * FB4: pD - * ../etc. - */ - void unzipFreebusies(); - - /** - * Adds extra FREE freebusy objects to fill periods of time - * that specify are not covered by the current freebusy objects - * in the freebusy vector. - */ - void addExtraFreePeriodFreebusies(JulianPtrArray * freebusies); - -#if 0 - /** - * Debug printing of Freebusy vector - */ - static void DEBUG_printFreebusyVector(const char * message, JulianPtrArray * freebusies); -#endif - - /** - * TODO: doesn't do smart overriding for now, does simple overwrite - * Helper method called by updateComponent to actually replace - * the property data-members with updatedComponent's data-members. - * @param VFreebusy * updatedComponent - * - * @return virtual void - */ - void updateComponentHelper(VFreebusy * updatedComponent); - -#if 0 - /** - * Returns TRUE if this component is more recent than component. - * Rules To define recent: - * Returns compare(Sequence Num) else if equal - * Returns compare(DTSTAMP) - * - * @param VFreebusy * component - * - * @return t_bool - */ - t_bool isMoreRecent(VFreebusy * component); -#endif - - /** - * Copy constructor. - * @param that VFreebusy to copy - */ - VFreebusy(VFreebusy & that); - -public: - - /** - * Constructor. Creates VFreebusy with initial log file initLog. - * @param JLog * initLog = 0 - */ - VFreebusy(JLog * initLog = 0); - - /** - * Destructor. - */ - ~VFreebusy(); - - /* -- Start of ICALComponent interface -- */ - - /** - * The parse method is the standard interface for ICalComponent - * subclasses to parse from an ICalReader object - * and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.). - * The method type can be set to \"\" if there is no method to be loaded. - * Also accepts a vector of VTimeZone objects to apply to - * the DateTime properties of the component. - * 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level, - * it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for - * this. - * - * @param brFile ICalReader to load from - * @param sType name of component (i.e. VEVENT, VTODO, VTIMEZONE) - * @param parseStatus return parse error status string (normally return "OK") - * @param vTimeZones vector of VTimeZones to apply to datetimes - * @param bIgnoreBeginError TRUE = ignore first "BEGIN:VFREEBUSY", FALSE otherwise - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parse error status string (parseStatus) - */ - virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & method, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0, - t_bool bIgnoreBeginError = FALSE, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Returns a clone of this object - * @param initLog log file to write errors to - * - * @return clone of this object - */ - virtual ICalComponent * clone(JLog * initLog); - - /** - * Return TRUE if component is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Print all contents of ICalComponent to iCal export format. - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString(); - - /** - * Print all contents of ICalComponent to iCal export format, depending - * on attendee name, attendee delegated-to, and where to include recurrence-id or not - * - * @param method method name (REQUEST,PUBLISH, etc.) - * @param name attendee name to filter with - * @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString(UnicodeString method, UnicodeString name, - t_bool isRecurring = FALSE); - - /** - * Print all contents of ICalComponent to human-readable string. - * - * @return string containing human-readable format of ICalComponent - */ - virtual UnicodeString toString(); - - /** - * Depending on character passed in, returns a string that represents - * the ICAL export string of that property that the character represents, if - * other paramaters not null, then print out information is filtered in several ways - * Attendee print out can be filtered so that only attendee with certain name is printed - * also, can print out the relevant attendees in a delegation message - * (ie. owner, delegate-to, delegate-from) - * - * @param c char of what property to print - * @param sFilterAttendee name of attendee to print - * @param bDelegateRequest TRUE if a delegate request, FALSE if not - * @return ICAL export format of that property - */ - virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest = FALSE); - - /** - * convert a character to the content of a property in string - * human-readable format - * @param c a character represents a property - * @param dateFmt for formatting datetimes - * - * @return property in human-readable string - */ - virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt); - - /** - * Returns the ICAL_COMPONENT enumeration value of this ICalComponent. - * Each ICalComponent subclass must return a unique ICAL_COMPONENT value. - * - * @return ICAL_COMPONENT value of this component - */ - virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VFREEBUSY; } - - /** - * Update the private property data-members with updatedComponent's - * property data-members. - * Usually, overwriting data-members should only occur if updatedComponent - * is more recent than the current component. - * Return TRUE if component was changed, FALSE otherwise - * @param ICalComponent * updatedComponent - * - * @return virtual t_bool - */ - virtual t_bool updateComponent(ICalComponent * updatedComponent); - - /* OVERRIDES ICalComponent::MatchUID_seqNO */ - virtual t_bool MatchUID_seqNO(UnicodeString uid, t_int32 iSeqNo); - - /* -- End of ICALComponent interface -- */ - - /* -- GETTERS AND SETTERS -- */ - - /* ATTENDEE */ - void addAttendee(Attendee * a); - JulianPtrArray * getAttendees() const { return m_AttendeesVctr ; } - - /* COMMENT */ - void addComment(UnicodeString s, JulianPtrArray * parameters = 0); - void addCommentProperty(ICalProperty * prop); - JulianPtrArray * getComment() const { return m_CommentVctr; } - - /* CREATED */ - /* - DateTime getCreated() const; - void setCreated(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getCreatedProperty() const { return m_Created; } - */ - - /* DURATION */ - nsCalDuration getDuration() const; - void setDuration(nsCalDuration s, JulianPtrArray * parameters = 0); - /* ICalProperty * getDurationProperty() const { return m_Duration; } */ - - /* DTSTART */ - DateTime getDTStart() const; - void setDTStart(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getDTStartProperty() const { return m_DTStart; } - - /* DTSTAMP */ - DateTime getDTStamp() const; - void setDTStamp(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getDTStampProperty() const { return m_DTStamp; } - - /* DTEND */ - DateTime getDTEnd() const; - void setDTEnd(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getDTEndProperty() const { return m_DTEnd; } - - /* FREEBUSY */ - void addFreebusy(Freebusy * f); - JulianPtrArray * getFreebusy() const { return m_FreebusyVctr ; } - void removeAllFreebusy(); - - /* LAST-MODIFIED */ - DateTime getLastModified() const; - void setLastModified(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getLastModifiedProperty() const { return m_LastModified; } - - /* ORGANIZER */ - UnicodeString getOrganizer() const; - void setOrganizer(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getOrganizerProperty() const { return m_Organizer; } - - /* RELATED-TO */ - /*void addRelatedTo(UnicodeString s, JulianPtrArray * parameters = 0); - void addRelatedToProperty(ICalProperty * prop); - JulianPtrArray * getRelatedTo() const { return m_RelatedToVctr; }*/ - - /* CONTACT */ - void addContact(UnicodeString s, JulianPtrArray * parameters = 0); - void addContactProperty(ICalProperty * prop); - JulianPtrArray * getContact() const { return m_ContactVctr; } - - /* REQUEST-STATUS */ - /* - UnicodeString getRequestStatus() const; - void setRequestStatus(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getRequestStatusProperty() const { return m_RequestStatus; } - */ - void addRequestStatus(UnicodeString s, JulianPtrArray * parameters = 0); - void addRequestStatusProperty(ICalProperty * prop); - JulianPtrArray * getRequestStatus() const { return m_RequestStatusVctr; } - - /* SEQUENCE */ - t_int32 getSequence() const; - void setSequence(t_int32 i, JulianPtrArray * parameters = 0); - ICalProperty * getSequenceProperty() const { return m_Sequence; } - - /* UID */ - UnicodeString getUID() const; - void setUID(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getUIDProperty() const { return m_UID; } - - /* URL */ - /*void addURL(UnicodeString s, JulianPtrArray * parameters = 0); - void addURLProperty(ICalProperty * prop); - JulianPtrArray * getURL() const { return m_URLVctr; }*/ - UnicodeString getURL() const; - void setURL(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getURLProperty() const { return m_URL; } - - /* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */ - void addXTokens(UnicodeString s); - JulianPtrArray * getXTokens() const { return m_XTokensVctr; } - - /* Method */ - void setMethod(UnicodeString & s) { m_sMethod = s; } - UnicodeString & getMethod() { return m_sMethod; } - -#if 0 - /** - * Sets Attendee with the name sAttendeeFilter to status. - * If the status is Delegated, then adds each element in delegatedTo - * to the delegatedTo vector of that attendee. - * If that attendee does not exist in the attendee list, then add - * a new Attendee to the attendee list with his/her PARTSTAT set to status. - * @param sAttendeeFilter attendee to set status on - * @param status status to set - * @param delegatedTo vector of delegatedTo names to set to - */ - void setAttendeeStatus(UnicodeString & sAttendeeFilter, Attendee::STATUS status, - JulianPtrArray * delegatedTo = 0); -#endif - - /** - * Return the Attendee in attendee vector with name equal - * to sAttendee. Return 0 if no attendee with that name. - * @param sAttendee name of attendee - * - * @return Attendee whose name is sAttendee, 0 if not found - */ - Attendee * getAttendee(UnicodeString sAttendee); - - /** - * Sets DTStamp to current time value. - */ - void stamp(); - - /*void update(VFreebusy * vfUpdated);*/ - /*t_bool IsIntersectingTimePeriod(DateTime start, DateTime end);*/ - - - /** - * Takes Freebusy vector and break it up into sorted combined freebusy periods. - */ - void normalize(); - - /** - * Compare VFreebusy by UID. Used by JulianPtrArray::QuickSort method. - * @param a first VFreebusy - * @param b second VFreebusy - * - * @return a.getUID().compareTo(b.getUID()) - */ - static int CompareVFreebusyByUID(const void * a, const void * b); - - /** - * Compare VFreebusy by DTSTART. Used by JulianPtrArray::QuickSort method. - * @param a first VFreebusy - * @param b second VFreebusy - * - * @return a.getDTSTART().compareTo(b.getDTSTART()) - */ - static int CompareVFreebusyByDTStart(const void * a, const void * b); - -private: - UnicodeString m_sMethod; - - /** used for initial parse only to calculate first DTEnd, then discarded */ - nsCalDuration * m_TempDuration; - - /* -- MEMBERS -- */ - JulianPtrArray * m_AttendeesVctr; - JulianPtrArray * m_CommentVctr; - JulianPtrArray * m_ContactVctr; /* TEXT OR URL */ - /*ICalProperty * m_Created;*/ - /*ICalProperty * m_Duration;*/ - ICalProperty * m_DTEnd; - ICalProperty * m_DTStart; - ICalProperty * m_DTStamp; - JulianPtrArray * m_FreebusyVctr; - ICalProperty * m_LastModified; - ICalProperty * m_Organizer; - /*ICalProperty * m_RequestStatus;*/ - JulianPtrArray * m_RequestStatusVctr; - /*JulianPtrArray * m_RelatedToVctr;*/ - ICalProperty * m_Sequence; - ICalProperty * m_UID; - - /*JulianPtrArray * m_URLVctr;*/ - ICalProperty * m_URL; - - JulianPtrArray * m_XTokensVctr; - /*NSCalendar m_Parent;*/ - - JLog * m_Log; - -}; - -#endif /* __VFREEBUSY_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/vjournal.h b/mozilla/calendar/modules/core/ical/inc/vjournal.h deleted file mode 100644 index 4343f9f6521..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/vjournal.h +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * vjournal.h - * John Sun - * 4/23/98 10:24:32 AM - */ -#ifndef __VJOURNAL_H_ -#define __VJOURNAL_H_ - -#include "datetime.h" -#include "ptrarray.h" -#include "tmbevent.h" -#include "jlog.h" -#include "nscalcoreicalexp.h" - -class NS_CAL_CORE_ICAL VJournal: public TimeBasedEvent -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - - /** - * store the data, depending on property name, property value - * parameter names, parameter values, and the current line. - * If this method returns FALSE, property not valid. - * - * @param strLine current line to process - * @param propName name of property - * @param propVal value of property - * @param parameters property's parameters - * @param vTimeZones vector of timezones - * @return TRUE if property handled, FALSE otherwise - */ - t_bool storeData(UnicodeString & strLine, - UnicodeString & propName, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - /** - * Sets default data. Currently does following: - * 1) Sets DTEnd to correct value, depending on DURATION, DTSTART - * (see spec on rules) - * 2) Sets TRANSP to TRANSPARENT if anniversary event - */ - void selfCheck(); - - /** - * Copy constructor. - * @param that VJournal to copy. - */ - VJournal(VJournal & that); - -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - - /** - * Constructor. Create VJournal with initial log file set to initLog. - * @param initLog initial log file pointer - */ - VJournal(JLog * initLog = 0); - - /** - * Destructor. - */ - ~VJournal(); - - /* -- Start of ICALComponent interface -- */ - - /** - * The parse method is the standard interface for ICalComponent - * subclasses to parse from an ICalReader object - * and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.). - * The method type can be set to \"\" if there is no method to be loaded. - * Also accepts a vector of VTimeZone objects to apply to - * the DateTime properties of the component. - * 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level, - * it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for - * this. - * - * @param brFile ICalReader to load from - * @param sType name of component (VJOURNAL) - * @param parseStatus return parse error status string (normally return "OK") - * @param vTimeZones vector of VTimeZones to apply to datetimes - * @param bIgnoreBeginError TRUE = ignore first "BEGIN:VJOURNAL", FALSE otherwise - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parse error status string (parseStatus) - */ - UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0, - t_bool bIgnoreBeginError = FALSE, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Returns a clone of this object - * @param initLog log file to write errors to - * - * @return clone of this object - */ - virtual ICalComponent * clone(JLog * initLog); - - /** - * Return TRUE if component is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - t_bool isValid(); - - /** - * Print all contents of ICalComponent to human-readable string. - * - * @return string containing human-readable format of ICalComponent - */ - virtual UnicodeString toString(); - - /** - * Depending on character passed in, returns a string that represents - * the ICAL export string of that property that the character represents, if - * other paramaters not null, then print out information is filtered in several ways - * Attendee print out can be filtered so that only attendee with certain name is printed - * also, can print out the relevant attendees in a delegation message - * (ie. owner, delegate-to, delegate-from) - * - * @param c char of what property to print - * @param sFilterAttendee name of attendee to print - * @param bDelegateRequest TRUE if a delegate request, FALSE if not - * @return ICAL export format of that property - */ - virtual UnicodeString formatChar(t_int32 c, - UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE); - - /** - * convert a character to the content of a property in string - * human-readable format - * @param c a character represents a property - * @param dateFmt for formatting datetimes - * - * @return property in human-readable string - */ - virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt); - - /** - * Returns the ICAL_COMPONENT enumeration value of this ICalComponent. - * Each ICalComponent subclass must return a unique ICAL_COMPONENT value. - * - * @return ICAL_COMPONENT value of this component - */ - virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VJOURNAL; } - - /* -- End of ICALComponent interface -- */ - - /** - * Overridden virtual method used as wrapper to ICalComponent::format method. - * @param strFmt iCal format string - * @param sFilterAttendee attendee to filter - * @param delegateRequest delegate request = TRUE, FALSE otherwise - * - * @return output iCal formatted export string - */ - virtual UnicodeString formatHelper(UnicodeString & strFmt, - UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE); - - /** - * Helper method. Overriden virtual method. Used by subclasses to - * populate recurrence-dependent data. For example, a recurring - * VJournal needs to have DTEnd calculated from recurring - * DTStart. VJournal will overwrite method set DTEnd correctly. - * Abstract difference() method is used to calculate ldiff. - * Need to pass vector of RDate periods in case end value must - * be adjusted in RDATE is a PERIOD value. - * @param start recurrence instance starting time - * @param ldiff abstract difference value - * @param vPer vector of RDate periods - */ - void populateDatesHelper(DateTime start, Date ldiff, JulianPtrArray * vPer); - - /* overridden message methods */ - virtual UnicodeString cancelMessage(); - virtual UnicodeString requestMessage(); - virtual UnicodeString requestRecurMessage(); - virtual UnicodeString counterMessage(); - virtual UnicodeString declineCounterMessage(); - virtual UnicodeString addMessage(); - virtual UnicodeString refreshMessage(UnicodeString sAttendeeFilter); - virtual UnicodeString allMessage(); - virtual UnicodeString replyMessage(UnicodeString sAttendeeFilter); - virtual UnicodeString publishMessage(); - virtual UnicodeString publishRecurMessage(); - - /** - * Overridden method. Calculate difference from start, end time - * For VJournal, this would 0. - * - * @return virtual Date - */ - Date difference(); - - /** - * Sets default human-readable event format pattern to s. - * @param s new event format pattern - */ - static void setDefaultFmt(UnicodeString s); - - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - /*----------------------------- - ** UTILITIES - **---------------------------*/ - - virtual void updateComponentHelper(TimeBasedEvent * updatedComponent); - - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - /*----------------------------- - ** OVERLOADED OPERATORS - **---------------------------*/ -}; - -#endif /* __VJOURNAL_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/vtimezne.h b/mozilla/calendar/modules/core/ical/inc/vtimezne.h deleted file mode 100644 index e5288700f52..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/vtimezne.h +++ /dev/null @@ -1,321 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * vtimezne.h - * John Sun - * 2/24/98 2:28:21 PM - */ - -#ifndef __VTIMEZONE_H_ -#define __VTIMEZONE_H_ - -#include -#include -#include - -#include "icalcomp.h" -#include "tzpart.h" -#include "jlog.h" - -class VTimeZone : public ICalComponent -{ -private: -#if 0 - - /** - * Default constructor. Hide from clients. - */ - VTimeZone(); -#endif -protected: - - /** - * Copy constructor. - * @param that VTimeZone to copy - */ - VTimeZone(VTimeZone & that); - -public: - - /** - * Constructor. Creates VTimeZone with initial log file initLog. - * @param initLog initial log file pointer - */ - VTimeZone(JLog * initLog = 0); - - /** - * Destructor. - */ - ~VTimeZone(); - - /* -- Start of ICALComponent interface -- */ - - /** - * The parse method is the standard interface for ICalComponent - * subclasses to parse from an ICalReader object - * and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.). - * The method type can be set to \"\" if there is no method to be loaded. - * Also accepts a vector of VTimeZone objects to apply to - * the DateTime properties of the component. - * 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level, - * it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for - * this. - * - * @param brFile ICalReader to load from - * @param sType name of component (VTIMEZONE) - * @param parseStatus return parse error status string (normally return "OK") - * @param vTimeZones vector of VTimeZones to apply to datetimes - * @param bIgnoreBeginError TRUE = ignore first "BEGIN:VTIMEZONE", FALSE otherwise - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parse error status string (parseStatus) - */ - virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sType, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0, - t_bool bIgnoreBeginError = FALSE, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Returns a clone of this object - * @param initLog log file to write errors to - * - * @return clone of this object - */ - virtual ICalComponent * clone(JLog * initLog); - - /** - * Return TRUE if component is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - virtual t_bool isValid(); - - /** - * Print all contents of ICalComponent to iCal export format. - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString(); - - /** - * Print all contents of ICalComponent to iCal export format, depending - * on attendee name, attendee delegated-to, and where to include recurrence-id or not - * - * @param method method name (REQUEST,PUBLISH, etc.) - * @param name attendee name to filter with - * @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid - * - * @return string containing iCal export format of ICalComponent - */ - virtual UnicodeString toICALString(UnicodeString method, UnicodeString name, - t_bool isRecurring); - - /** - * Print all contents of ICalComponent to human-readable string. - * - * @return string containing human-readable format of ICalComponent - */ - virtual UnicodeString toString(); - - /** - * Depending on character passed in, returns a string that represents - * the ICAL export string of that property that the character represents, if - * other paramaters not null, then print out information is filtered in several ways - * Attendee print out can be filtered so that only attendee with certain name is printed - * also, can print out the relevant attendees in a delegation message - * (ie. owner, delegate-to, delegate-from) - * - * @param c char of what property to print - * @param sFilterAttendee name of attendee to print - * @param bDelegateRequest TRUE if a delegate request, FALSE if not - * @return ICAL export format of that property - */ - virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest = FALSE); - - /** - * convert a character to the content of a property in string - * human-readable format - * @param c a character represents a property - * @param dateFmt for formatting datetimes - * - * @return property in human-readable string - */ - virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt); - - /** - * Returns the ICAL_COMPONENT enumeration value of this ICalComponent. - * Each ICalComponent subclass must return a unique ICAL_COMPONENT value. - * - * @return ICAL_COMPONENT value of this component - */ - virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VTIMEZONE; } - - /** - * Update the private property data-members with updatedComponent's - * property data-members. - * Usually, overwriting data-members should only occur if updatedComponent - * is more recent than the current component. - * Return TRUE if component was changed, FALSE otherwise - * @param ICalComponent * updatedComponent - * - * @return virtual t_bool - */ - virtual t_bool updateComponent(ICalComponent * updatedComponent); - - /* -- End of ICALComponent interface -- */ - - /* -- GETTERS AND SETTERS -- */ - - /** - * Return the STANDARD TimeZone part of this VTimeZone. - * - * @return ptr to STANDARD TZPart - */ - TZPart * getStandardPart(); - - /** - * Return the DAYLIGHT TimeZone part of this VTimeZone. - * - * @return ptr to DAYLIGHT TZPart - */ - TZPart * getDaylightPart(); - - - /** - * Return pointer to vector of TZParts - * - * @return pointer to vector of TZParts. - */ - JulianPtrArray * getTZParts() const { return m_TZPartVctr; }; - - /* TZPART */ - void addTZPart(TZPart * part); - TZPart * getPart(UnicodeString & u); - - /* TZID */ - UnicodeString getTZID() const; - void setTZID(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getTZIDProperty() const { return m_TZID; } - - /* LastModified */ - DateTime getLastModified() const; - void setLastModified(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getLastModifiedProperty() const { return m_LastModified; } - - /* TZURL */ - UnicodeString getTZURL() const; - void setTZURL(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getTZURLProperty() const { return m_TZURL; } - - /* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */ - void addXTokens(UnicodeString s); - JulianPtrArray * getXTokens() const { return m_XTokensVctr; } - - /** - * Given vector of timezones, search for VTimeZone with TZID equal to id. - * Return 0 if not found. - * @param id TZID to look for - * @param timezones vector of timezones to search through - * - * @return first matching VTimeZone in vector, 0 if not found - */ - static VTimeZone * getTimeZone(UnicodeString & id, JulianPtrArray * timezones); - - - /** - * Given a DateTime string, a vector of timezones, and a vector of - * ICalParameters, apply a timezone to the string if there is a TZID - * in the parameters vector. - * For example, if time = "19971110T112233", timezones has a EST timezone, - * and TZID = EST, then the method would return the datetime for time with - * the EST timezone applied to it. - * @param time datetime string to apply timezone to - * @param vTimeZones vector of timezones - * @param parameters parameters to search for TZID - * - * @return DateTime representing time with timezone applied to it. - */ - static DateTime DateTimeApplyTimeZone(UnicodeString & time, - JulianPtrArray * vTimeZones, JulianPtrArray * parameters); - - /** - * Return the libnls TimeZone that represents this VTimeZone object. - * @return pointer to TimeZone - */ - TimeZone * getNLSTimeZone() const { return (TimeZone *) &*m_NLSTimeZone; } - -private: - - /** - * selfcheck data-members, and calls createNLSTimeZone(). - */ - void selfCheck(); - - /** - * Creates NLS TimeZone from start month,day,week,time,until. - * TODO: possible bug, may need to call everytime before calling getNLSTimeZone(). - */ - void createNLSTimeZone(); - - /** - * store the data, depending on property name, property value - * parameter names, parameter values, and the current line. - * - * @param strLine current line to process - * @param propName name of property - * @param propVal value of property - * @param parameters property's parameters - */ - void storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters); - - /** - * Helper method called by updateComponent to actually replace - * the property data-members with updatedComponent's data-members. - * @param VTimeZone * updatedComponent - * - * @return virtual void - */ - void updateComponentHelper(VTimeZone * updatedComponent); - - /* whether VTimeZone has more that two parts, currently must - * have exactly two parts (DAYLIGHT AND STANDARD) - */ - static t_bool ms_bMORE_THAN_TWO_TZPARTS; - - /* -- MEMBERS -- */ - /*TimeZone * m_NLSTimeZone;*/ - SimpleTimeZone *m_NLSTimeZone; - - JulianPtrArray * m_TZPartVctr; - ICalProperty * m_TZID; - ICalProperty * m_LastModified; - ICalProperty * m_TZURL; - JulianPtrArray * m_XTokensVctr; /* TEXT */ - - JLog * m_Log; -}; - -#endif /* __VTIMEZONE_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/inc/vtodo.h b/mozilla/calendar/modules/core/ical/inc/vtodo.h deleted file mode 100644 index de4e84e36b1..00000000000 --- a/mozilla/calendar/modules/core/ical/inc/vtodo.h +++ /dev/null @@ -1,352 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * vtodo.h - * John Sun - * 4/22/98 3:25:47 PM - */ -#ifndef __VTODO_H_ -#define __VTODO_H_ - -#include "datetime.h" -#include "ptrarray.h" -#include "tmbevent.h" -#include "jlog.h" -#include "nscalcoreicalexp.h" - -class NS_CAL_CORE_ICAL VTodo : public TimeBasedEvent -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - - /* Due of first instance of a recurrence */ - DateTime m_origDue; - - /* Due of my instance of a recurrence */ - DateTime m_origMyDue; - - /** used for initial parse only to calculate first Due, then discarded */ - nsCalDuration * m_TempDuration; - - /*------------------------------------------------- - * DATA MEMBER (to augment TimeBasedEvent) - *------------------------------------------------*/ - - ICalProperty * m_Completed; /* DATETIME */ - ICalProperty * m_Due; /* DATETIME */ - ICalProperty * m_GEO; /* geographic position (two floats)*/ - ICalProperty * m_Location; /* TEXT */ - ICalProperty * m_PercentComplete; /* INTEGER [0-100] */ - ICalProperty * m_Priority; /* INTEGER >= 0 */ - JulianPtrArray * m_ResourcesVctr; /* TEXT */ - - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - - /** - * store the data, depending on property name, property value - * parameter names, parameter values, and the current line. - * If this method returns FALSE, property not valid. - * - * @param strLine current line to process - * @param propName name of property - * @param propVal value of property - * @param parameters property's parameters - * @param vTimeZones vector of timezones - * @return TRUE if property handled, FALSE otherwise - */ - t_bool storeData(UnicodeString & strLine, - UnicodeString & propName, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); -public: - typedef void (VTodo::*SetOp) (UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - void storeCompleted(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDue(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeDuration(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeGEO(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeLocation(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storePercentComplete(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storePriority(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - void storeResources(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones); - - void ApplyStoreOp(void (VTodo::*op) (UnicodeString & strLine, - UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones), - UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) - { - (this->*op)(strLine, propVal, parameters, vTimeZones); - } -private: - - /** - * Sets default data. Currently does following: - * 1) Sets DTEnd to correct value, depending on DURATION, DTSTART - * (see spec on rules) - * 2) Sets TRANSP to TRANSPARENT if anniversary event - */ - void selfCheck(); - - /** - * Copy constructor. - * @param that VTodo to copy. - */ - VTodo(VTodo & that); - -public: - - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - - /** - * Constructor. Create VTodo with initial log file set to initLog. - * @param initLog initial log file pointer - */ - VTodo(JLog * initLog = 0); - - /** - * Destructor. - */ - ~VTodo(); - - /* -- Start of ICALComponent interface -- */ - - /** - * The parse method is the standard interface for ICalComponent - * subclasses to parse from an ICalReader object - * and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.). - * The method type can be set to \"\" if there is no method to be loaded. - * Also accepts a vector of VTimeZone objects to apply to - * the DateTime properties of the component. - * 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level, - * it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for - * this. - * - * @param brFile ICalReader to load from - * @param sType name of component (VTODO) - * @param parseStatus return parse error status string (normally return "OK") - * @param vTimeZones vector of VTimeZones to apply to datetimes - * @param bIgnoreBeginError TRUE = ignore first "BEGIN:VTODO", FALSE otherwise - * @param encoding the encoding of the stream, default is 7bit. - * - * @return parse error status string (parseStatus) - */ - UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0, - t_bool bIgnoreBeginError = FALSE, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - - /** - * Returns a clone of this object - * @param initLog log file to write errors to - * - * @return clone of this object - */ - virtual ICalComponent * clone(JLog * initLog); - - /** - * Return TRUE if component is valid, FALSE otherwise - * - * @return TRUE if is valid, FALSE otherwise - */ - t_bool isValid(); - - /** - * Print all contents of ICalComponent to human-readable string. - * - * @return string containing human-readable format of ICalComponent - */ - virtual UnicodeString toString(); - - /** - * Depending on character passed in, returns a string that represents - * the ICAL export string of that property that the character represents, if - * other paramaters not null, then print out information is filtered in several ways - * Attendee print out can be filtered so that only attendee with certain name is printed - * also, can print out the relevant attendees in a delegation message - * (ie. owner, delegate-to, delegate-from) - * - * @param c char of what property to print - * @param sFilterAttendee name of attendee to print - * @param bDelegateRequest TRUE if a delegate request, FALSE if not - * @return ICAL export format of that property - */ - virtual UnicodeString formatChar(t_int32 c, - UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE); - - /** - * convert a character to the content of a property in string - * human-readable format - * @param c a character represents a property - * @param dateFmt for formatting datetimes - * - * @return property in human-readable string - */ - virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt); - - /** - * Returns the ICAL_COMPONENT enumeration value of this ICalComponent. - * Each ICalComponent subclass must return a unique ICAL_COMPONENT value. - * - * @return ICAL_COMPONENT value of this component - */ - virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VTODO ; } - - /* -- End of ICALComponent interface -- */ - - /** - * Overridden virtual method used as wrapper to ICalComponent::format method. - * @param strFmt iCal format string - * @param sFilterAttendee attendee to filter - * @param delegateRequest delegate request = TRUE, FALSE otherwise - * - * @return output iCal formatted export string - */ - virtual UnicodeString formatHelper(UnicodeString & strFmt, - UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE); - - /** - * Helper method. Overriden virtual method. Used by subclasses to - * populate recurrence-dependent data. For example, a recurring - * VTodo needs to have DTEnd calculated from recurring - * DTStart. VTodo will overwrite method set DTEnd correctly. - * Abstract difference() method is used to calculate ldiff. - * Need to pass vector of RDate periods in case end value must - * be adjusted in RDATE is a PERIOD value. - * @param start recurrence instance starting time - * @param ldiff abstract difference value - * @param vPer vector of RDate periods - */ - void populateDatesHelper(DateTime start, Date ldiff, JulianPtrArray * vPer); - - /* overridden message methods */ - virtual UnicodeString cancelMessage(); - virtual UnicodeString requestMessage(); - virtual UnicodeString requestRecurMessage(); - virtual UnicodeString counterMessage(); - virtual UnicodeString declineCounterMessage(); - virtual UnicodeString addMessage(); - virtual UnicodeString refreshMessage(UnicodeString sAttendeeFilter); - virtual UnicodeString allMessage(); - virtual UnicodeString replyMessage(UnicodeString sAttendeeFilter); - virtual UnicodeString publishMessage(); - virtual UnicodeString publishRecurMessage(); - - /** - * Overridden method. Calculate difference from start, end time - * For VTodo, this would be Due - DTStart. - * - * @return virtual Date - */ - Date difference(); - - /** - * Sets default human-readable event format pattern to s. - * @param s new event format pattern - */ - static void setDefaultFmt(UnicodeString s); - - - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - - /* COMPLETED */ - DateTime getCompleted() const; - void setCompleted(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getCompletedProperty() const { return m_Completed; } - - /* DUE */ - DateTime getDue() const; - void setDue(DateTime s, JulianPtrArray * parameters = 0); - ICalProperty * getDueProperty() const { return m_Due; } - - /* DURATION */ - nsCalDuration getDuration() const; - void setDuration(nsCalDuration s, JulianPtrArray * parameters = 0); - /*ICalProperty * getDurationProperty() const { return m_Duration; }*/ - - /* GEO */ - UnicodeString getGEO() const; - void setGEO(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getGEOProperty() const { return m_GEO; } - - /* LOCATION */ - UnicodeString getLocation() const; - void setLocation(UnicodeString s, JulianPtrArray * parameters = 0); - ICalProperty * getLocationProperty() const { return m_Location; } - - /* PERCENT-COMPLETE */ - virtual t_int32 getPercentComplete() const; - void setPercentComplete(t_int32 i, JulianPtrArray * parameters = 0); - ICalProperty * getPercentCompleteProperty() const { return m_PercentComplete; } - - /* PRIORITY */ - t_int32 getPriority() const; - void setPriority(t_int32 i, JulianPtrArray * parameters = 0); - ICalProperty * getPriorityProperty() const { return m_Priority; } - - /* RESOURCES */ - void addResources(UnicodeString s, JulianPtrArray * parameters = 0); - void addResourcesProperty(ICalProperty * prop); - JulianPtrArray * getResources() const { return m_ResourcesVctr; } - void addResourcesPropertyVector(UnicodeString & propVal, JulianPtrArray * parameters); - - /* MYORIGDUE */ - void setMyOrigDue(DateTime d) { m_origMyDue = d; } - DateTime getMyOrigDue() { return m_origMyDue; } - - /* ORIGDUE */ - void setOrigDue(DateTime d) { m_origDue = d; } - DateTime getOrigDue() { return m_origDue; } - - - /*----------------------------- - ** UTILITIES - **---------------------------*/ - - virtual void updateComponentHelper(TimeBasedEvent * updatedComponent); - - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - /*----------------------------- - ** OVERLOADED OPERATORS - **---------------------------*/ -}; - -#endif /* __VTODO_H_ */ - diff --git a/mozilla/calendar/modules/core/ical/manifest.mn b/mozilla/calendar/modules/core/ical/manifest.mn deleted file mode 100644 index 364aaa1bd7f..00000000000 --- a/mozilla/calendar/modules/core/ical/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/core/ical/public/Makefile b/mozilla/calendar/modules/core/ical/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/ical/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/ical/public/manifest.mn b/mozilla/calendar/modules/core/ical/public/manifest.mn deleted file mode 100644 index ed6343fabd8..00000000000 --- a/mozilla/calendar/modules/core/ical/public/manifest.mn +++ /dev/null @@ -1,29 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -EXPORTS = \ - nsICalendar.h \ - nsICalProperty.h \ - nsICalICalendarComponent.h \ - nsICalStandardProperty.h \ - nsICalICalendarContainer.h \ - nsICalTimeBasedEvent.h \ - nsICalVEvent.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor - \ No newline at end of file diff --git a/mozilla/calendar/modules/core/ical/public/nsICalICalendarComponent.h b/mozilla/calendar/modules/core/ical/public/nsICalICalendarComponent.h deleted file mode 100644 index e42413f07cd..00000000000 --- a/mozilla/calendar/modules/core/ical/public/nsICalICalendarComponent.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalICalendarComponent_h___ -#define nsICalICalendarComponent_h___ - -//21965b60-6912-11d2-943d-006008268c31 -#define NS_ICALICALENDARCOMPONENT_IID \ -{ 0x21965b60, 0x6912, 0x11d2, \ -{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } } - -#include "nsISupports.h" - -class nsICalICalendarComponent : public nsISupports -{ -public: - NS_IMETHOD Init() = 0; - NS_IMETHOD_(PRBool) IsValid() = 0; - -}; - -#endif diff --git a/mozilla/calendar/modules/core/ical/public/nsICalICalendarContainer.h b/mozilla/calendar/modules/core/ical/public/nsICalICalendarContainer.h deleted file mode 100644 index 62d1614105f..00000000000 --- a/mozilla/calendar/modules/core/ical/public/nsICalICalendarContainer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalICalendarContainer_h___ -#define nsICalICalendarContainer_h___ - -#include "nsISupports.h" -#include "nsCalICalendarTags.h" -#include "nsICalProperty.h" -#include "ptrarray.h" - -// 1ed5e9f0-6912-11d2-943d-006008268c31 -#define NS_ICALICALENDARCONTAINER_IID \ - { 0x1ed5e9f0, 0x6912, 0x11d2, \ - {0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -/* VCALENDAR, VEVENT, VTODO, VJOURNAL, VTIMEZONE, VFREEBUSY, VALARM should implement this */ -class nsICalICalendarContainer : public nsISupports -{ - -public: - - /** - * Initialize the CALICALENDARContainer - * @result The result of the initialization, NS_Ok if no errors - */ - NS_IMETHOD Init() = 0; - - // for now - NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop, - JulianPtrArray * vTimeZones) = 0; - -}; - -#endif /* nsICALICalendarContainer_h___ */ - - - - diff --git a/mozilla/calendar/modules/core/ical/public/nsICalProperty.h b/mozilla/calendar/modules/core/ical/public/nsICalProperty.h deleted file mode 100644 index 0d2576466c1..00000000000 --- a/mozilla/calendar/modules/core/ical/public/nsICalProperty.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalProperty_h___ -#define nsICalProperty_h___ - -#include "nsISupports.h" -#include "nsString.h" -#include "ptrarray.h" -#include "prprty.h" - -//1d950490-6912-11d2-943d-006008268c31 -#define NS_ICALPROPERTY_IID \ -{ 0x1d950490, 0x6912, 0x11d2, \ - { 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } } - -// todo: xpcom UnicodeString, JulianPtrArray or use something else (nsIVector, nsString) - -class nsICalProperty : public nsISupports -{ -public: - - NS_IMETHOD Init() = 0; - - NS_IMETHOD SetParameters(JulianPtrArray * parameters) = 0; - NS_IMETHOD_(JulianPtrArray *) GetParameters() = 0; - NS_IMETHOD_(void *) GetValue() const = 0; - NS_IMETHOD SetValue(void * value) = 0; - NS_IMETHOD_(nsICalProperty *) Clone() = 0; - NS_IMETHOD_(PRBool) IsValid() = 0; - NS_IMETHOD_(nsString &) ToString(nsString & out) = 0; - NS_IMETHOD_(nsString &) ToICALString(nsString & out) = 0; - NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out) = 0; - - NS_IMETHOD_(ICalProperty *) GetICalProperty() const = 0; -}; -#endif - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/public/nsICalStandardProperty.h b/mozilla/calendar/modules/core/ical/public/nsICalStandardProperty.h deleted file mode 100644 index eff7aa88cad..00000000000 --- a/mozilla/calendar/modules/core/ical/public/nsICalStandardProperty.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalStandardProperty_h___ -#define nsICalStandardProperty_h___ - -#include "nsISupports.h" -#include "nsString.h" -#include "ptrarray.h" -#include "icalprm.h" - -// 1e2012a0-6912-11d2-943d-006008268c31 -#define NS_ICALSTANDARDPROPERTY_IID \ -{ 0x1e2012a0, 0x6912, 0x11d2, \ - { 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } } - -// todo: xpcom UnicodeString, JulianPtrArray or use something else (nsIVector, nsString) - -class nsICalStandardProperty : public nsISupports -{ -public: - - NS_IMETHOD Init() = 0; - - NS_IMETHOD SetParameters(JulianPtrArray * parameters) = 0; - NS_IMETHOD AddParameter(ICalParameter * parameter) = 0; - NS_IMETHOD Parse(nsString & in) = 0; - - // no static methods for now - -}; -#endif - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/public/nsICalTimeBasedEvent.h b/mozilla/calendar/modules/core/ical/public/nsICalTimeBasedEvent.h deleted file mode 100644 index eed9ae82417..00000000000 --- a/mozilla/calendar/modules/core/ical/public/nsICalTimeBasedEvent.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalTimeBasedEvent_h___ -#define nsICalTimeBasedEvent_h___ - -#include "nsISupports.h" -#include "nsICalProperty.h" -#include "ptrarray.h" -#include "unistring.h" - -//208f8720-6912-11d2-943d-006008268c31 -#define NS_ICALTIMEBASEDEVENT_IID \ -{ 0x208f8720, 0x6912, 0x11d2, \ -{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } } - -class nsICalTimeBasedEvent : public nsISupports -{ -public: - NS_IMETHOD Init() = 0; - - // for now. - /* - NS_IMETHOD_(nsIDateTime *) GetDTStart() const = 0; - NS_IMETHOD SetDTStart(nsIDateTime * d, JulianPtrArray * parameters) = 0; - NS_IMETHOD SetDTStartProperty(nsICalDateTimeProperty * property) = 0; - */ - - NS_IMETHOD_(PRInt32) GetSequence() const = 0; - NS_IMETHOD SetSequence(PRInt32 i, JulianPtrArray * parameters) = 0; - NS_IMETHOD SetSequenceProperty(nsICalProperty * property) = 0; - - - NS_IMETHOD SelfCheck() = 0; -}; - -#endif - - - - diff --git a/mozilla/calendar/modules/core/ical/public/nsICalVEvent.h b/mozilla/calendar/modules/core/ical/public/nsICalVEvent.h deleted file mode 100644 index afc6b7009fe..00000000000 --- a/mozilla/calendar/modules/core/ical/public/nsICalVEvent.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalVEvent_h___ -#define nsICalVEvent_h___ - -#include "nsISupports.h" -#include "vevent.h" - -//20355f10-6912-11d2-943d-006008268c31 -#define NS_ICALVEVENT_IID \ -{ 0x20355f10, 0x6912, 0x11d2, \ -{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } } - -class nsICalVEvent : public nsISupports -{ -public: - - // for now. - NS_IMETHOD_(DateTime) GetDTEnd() const = 0; - NS_IMETHOD SetDTEnd(DateTime d, JulianPtrArray * parameters) = 0; - NS_IMETHOD SetDTEndProperty(nsICalProperty * property) = 0; - - NS_IMETHOD_(VEvent *) GetICalEvent() = 0; - NS_IMETHOD_(PRBool) IsValid() = 0; -}; - -#endif - - - - - diff --git a/mozilla/calendar/modules/core/ical/public/nsICalendar.h b/mozilla/calendar/modules/core/ical/public/nsICalendar.h deleted file mode 100644 index c71969f1a0b..00000000000 --- a/mozilla/calendar/modules/core/ical/public/nsICalendar.h +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalendar_h___ -#define nsICalendar_h___ - -#include "nsISupports.h" -//#include "nsString.h" -#include "unistring.h" -#include "ptrarray.h" -#include "nscal.h" -#include "nsICalProperty.h" -//#include "nsICalStringProperty.h" -#include "nsICalVEvent.h" - -//1cc84170-6912-11d2-943d-006008268c31 -#define NS_ICALENDAR_IID \ -{ 0x1cc84170, 0x6912, 0x11d2, \ -{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } } - -// todo: xpcom UnicodeString, JulianPtrArray or use something else (nsIVector, nsString) - -class nsICalendar : public nsISupports -{ -public: - - NS_IMETHOD Init() = 0; - - /* - NS_IMETHOD Export(const char * filename, t_bool & status) = 0; - NS_IMETHOD_(nsICalendar *) Clone() = 0; - */ - - NS_IMETHOD_(UnicodeString) GetCalScale() const = 0; - NS_IMETHOD SetCalScale(UnicodeString s, JulianPtrArray * parameters) = 0; - //NS_IMETHOD SetCalScaleProperty(nsICalStringProperty * property) = 0; - //NS_IMETHOD_(nsICalProperty *) GetCalScaleProperty() const = 0; - - NS_IMETHOD_(UnicodeString) GetVersion() const = 0; - NS_IMETHOD SetVersion(UnicodeString s, JulianPtrArray * parameters) = 0; - NS_IMETHOD SetVersionProperty(nsICalProperty * property) = 0; - //NS_IMETHOD_(nsICalProperty *) GetVersionProperty() const = 0; - - NS_IMETHOD_(UnicodeString) GetProdid() const = 0; - NS_IMETHOD SetProdid(UnicodeString s, JulianPtrArray * parameters) = 0; - //NS_IMETHOD_(nsICalProperty *) GetProdidProperty() const = 0; - - NS_IMETHOD SetMethod(PRInt32 i) = 0; - NS_IMETHOD_(PRInt32) GetMethod() const = 0; - - NS_IMETHOD AddEvent(nsICalVEvent * event) = 0; - - NS_IMETHOD_(NSCalendar *) GetNSCalendar() const = 0; - /* - NS_IMETHOD AddXTokens(UnicodeString s) = 0; - NS_IMETHOD_(JulianPtrArray *) GetXTokens() const = 0; - - NS_IMETHOD SetEventsLastUpdatedFromServer(nsIDateTime d) = 0; - NS_IMETHOD_(nsIDateTime) GetEventsLastUpdatedFromServer() = 0; - - NS_IMETHOD_(nsIDateTime) GetEventsSpanStart() = 0; - NS_IMETHOD_(nsIDateTime) GetEventsSpanEnd() = 0; - - // todo: xpcom JLog&& ICalComponent - //NS_IMETHOD_(nsICalLog*) GetLog() = 0; - //NS_IMETHOD_(JulianPtrArray *) GetLogVector(nsICalICalendarComponent * ic); - //NS_IMETHOD_(JulianPtrArray *) GetLogVector(); - - NS_IMETHOD_(nsString &) GetCurl() const = 0; - NS_IMETHOD SetCurl(const char* ps) = 0; - NS_IMETHOD SetCurl(const nsString& s) = 0; - - NS_IMETHOD_(UnicodeString) ToString() = 0; - NS_IMETHOD_(UnicodeString &) CreateCalendarHeader(UnicodeString & sResult); - NS_IMETHOD_(UnicodeString) ToICALString() = 0; - NS_IMETHOD_(UnicodeString) ToFilteredICALString(UnicodeString componentPattern) = 0; - - NS_IMETHOD_(nsICalVFreebusy *) CreateVFreebusy(nsIDateTime start, nsIDateTime end) = 0; - NS_IMETHOD CalculateVFreebusy(nsICalVFreebusy * toFillIn) = 0; - - NS_IMETHOD_(nsICalVFreebusy *) GetVFreebusy(UnicodeString sUID, PRInt32 iSeqNo) = 0; - NS_IMETHOD_(nsICalVFreebusy *) GetEvent(UnicodeString sUID, PRInt32 iSeqNo) = 0; - NS_IMETHOD_(nsICalVFreebusy *) GetTodo(UnicodeString sUID, PRInt32 iSeqNo) = 0; - NS_IMETHOD_(nsICalVFreebusy *) GetJournal(UnicodeString sUID, PRInt32 iSeqNo) = 0; - - NS_IMETHOD AddEvent(nsICalICalendarComponent * i) = 0; - NS_IMETHOD AddTodo(nsICalICalendarComponent * i) = 0; - NS_IMETHOD AddJournal(nsICalICalendarComponent * i) = 0; - NS_IMETHOD AddVFreebusy(nsICalICalendarComponent * i) = 0; - NS_IMETHOD AddTimeZone(nsICalICalendarComponent * i) = 0; - - NS_IMETHOD AddEventList(JulianPtrArray * v) = 0; - - NS_IMETHOD_(JulianPtrArray *) GetEvents() const = 0; - - NS_IMETHOD_(JulianPtrArray *) ChangeEventsOwnership() = 0; - - NS_IMETHOD_(JulianPtrArray *) GetTodos() const = 0; - NS_IMETHOD_(JulianPtrArray *) GetJournals() const = 0; - NS_IMETHOD_(JulianPtrArray *) GetVFreebusies() const = 0; - NS_IMETHOD_(JulianPtrArray *) GetTimeZones() const = 0; - - NS_IMETHOD GetUniqueUIDs(JulianPtrArray * retUID, PRInt32 iCalComponentType); - - NS_IMETHOD GetEvents(JulianPtrArray * out, UnicodeString & sUID) const = 0; - NS_IMETHOD GetTodos(JulianPtrArray * out, UnicodeString & sUID) const = 0; - NS_IMETHOD GetJournals(JulianPtrArray * out, UnicodeString & sUID) const = 0; - - NS_IMETHOD GetEventsByComponentID(JulianPtrArray * out, UnicodeString & sUID, - UnicodeString & sRecurrenceID, - UnicodeString & sModifier) const = 0; - NS_IMETHOD GetEventsByRange(JulianPtrArray * out, - nsIDateTime start, nsIDateTime end) const = 0; - - NS_IMETHOD SortComponentsByDTStart(PRInt32 iCalComponentType); - NS_IMETHOD SortComponentsByUID(PRInt32 iCalComponentType); - - NS_IMETHOD UpdateEventsRange(nsICalVEvent * v) = 0; - NS_IMETHOD UpdateEventsRange(nsIDateTime ds, nsIDateTime de) = 0; - */ - -}; -#endif - - - - diff --git a/mozilla/calendar/modules/core/ical/src/Makefile b/mozilla/calendar/modules/core/ical/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/core/ical/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/core/ical/src/attendee.cpp b/mozilla/calendar/modules/core/ical/src/attendee.cpp deleted file mode 100644 index 8bb2d7b3781..00000000000 --- a/mozilla/calendar/modules/core/ical/src/attendee.cpp +++ /dev/null @@ -1,1144 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// attendee.cpp -// John Sun -// 3:21 PM February 6 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "icalcomp.h" -#include "attendee.h" -#include "jutility.h" -#include "unistrto.h" -#include "jlog.h" -#include "keyword.h" -#include "uri.h" - -//-------------------------------------------------------------------- -const t_int32 Attendee::ms_iDEFAULT_ROLE = ROLE_REQ_PARTICIPANT; //ROLE_ATTENDEE; -const t_int32 Attendee::ms_iDEFAULT_TYPE= TYPE_INDIVIDUAL; //TYPE_UNKNOWN; -const t_int32 Attendee::ms_iDEFAULT_STATUS= STATUS_NEEDSACTION; -const t_int32 Attendee::ms_iDEFAULT_RSVP= RSVP_FALSE; -const t_int32 Attendee::ms_iDEFAULT_EXPECT= EXPECT_FYI; - -const t_int32 Attendee::ms_cAttendeeName = 'N'; -const t_int32 Attendee::ms_cAttendeeRole = 'R'; -const t_int32 Attendee::ms_cAttendeeStatus = 'S'; -const t_int32 Attendee::ms_cAttendeeRSVP = 'V'; -const t_int32 Attendee::ms_cAttendeeType = 'T'; -const t_int32 Attendee::ms_cAttendeeExpect = 'E'; -const t_int32 Attendee::ms_cAttendeeDelegatedTo = 'D'; -const t_int32 Attendee::ms_cAttendeeDelegatedFrom = 'd'; -const t_int32 Attendee::ms_cAttendeeMember = 'M'; -const t_int32 Attendee::ms_cAttendeeDir = 'l'; // 'el' -const t_int32 Attendee::ms_cAttendeeSentBy = 's'; -const t_int32 Attendee::ms_cAttendeeCN = 'C'; -const t_int32 Attendee::ms_cAttendeeLanguage = 'm'; -const t_int32 Attendee::ms_cAttendeeDisplayName = 'z'; -// ---- END OF STATIC DATA ---- // -//--------------------------------------------------------------------- - -t_bool Attendee::isValidStatus(ICalComponent::ICAL_COMPONENT compType, - Attendee::STATUS status) -{ - if (compType == ICalComponent::ICAL_COMPONENT_VEVENT) - { - if (status >= STATUS_NEEDSACTION && status <= STATUS_DELEGATED) - return TRUE; - else return FALSE; - } - else if (compType == ICalComponent::ICAL_COMPONENT_VTODO) - { - if (status >= STATUS_NEEDSACTION && status <= STATUS_INPROCESS) - return TRUE; - else return FALSE; - } - else - { - // for VJournal and VFreebusy - if (status >= STATUS_NEEDSACTION && status <= STATUS_DECLINED) - return TRUE; - else return FALSE; - } -} - -//--------------------------------------------------------------------- - -Attendee::Attendee() -{ - // private, NEVER use - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -Attendee::Attendee(ICalComponent::ICAL_COMPONENT componentType, JLog * initLog) -: m_vsMember(0), m_vsDelegatedTo(0), m_vsDelegatedFrom(0), - m_iRole(-1), m_iType(-1), m_iStatus(-1), m_iRSVP(-1), - m_iExpect(-1), m_Log(initLog), m_ComponentType(componentType) -{ -} - -//--------------------------------------------------------------------- - -Attendee::Attendee(Attendee & that) -: m_vsMember(0), m_vsDelegatedTo(0), m_vsDelegatedFrom(0) -{ - t_int32 i, size; - - m_iRole = that.m_iRole; - m_iType = that.m_iType; - m_iStatus = that.m_iStatus; - m_iRSVP = that.m_iRSVP; - m_iExpect = that.m_iExpect; - - m_CN = that.m_CN; - m_Language = that.m_Language; - m_SentBy = that.m_SentBy; - m_Dir = that.m_Dir; - - m_ComponentType = that.m_ComponentType; - - m_sName = that.m_sName; - - if (that.m_vsMember != 0) - { - m_vsMember = new JulianPtrArray(); PR_ASSERT(m_vsMember != 0); - if (m_vsMember != 0) - { - size = that.m_vsMember->GetSize(); - for (i = 0; i < size; i++) - { - addMember(*((UnicodeString *) that.m_vsMember->GetAt(i))); - } - } - } - - if (that.m_vsDelegatedTo != 0) - { - m_vsDelegatedTo = new JulianPtrArray(); PR_ASSERT(m_vsDelegatedTo != 0); - if (m_vsDelegatedTo != 0) - { - size = that.m_vsDelegatedTo->GetSize(); - for (i = 0; i < size; i++) - { - addDelegatedTo(*((UnicodeString *) that.m_vsDelegatedTo->GetAt(i))); - } - } - } - - if (that.m_vsDelegatedFrom != 0) - { - m_vsDelegatedFrom = new JulianPtrArray(); PR_ASSERT(m_vsDelegatedFrom != 0); - if (m_vsDelegatedFrom != 0) - { - size = that.m_vsDelegatedFrom->GetSize(); - for (i = 0; i < size; i++) - { - addDelegatedFrom(*((UnicodeString *) that.m_vsDelegatedFrom->GetAt(i))); - } - } - } - -} - -//--------------------------------------------------------------------- - -Attendee::~Attendee() -{ - if (m_vsDelegatedTo != 0) - { - ICalComponent::deleteUnicodeStringVector(m_vsDelegatedTo); - delete m_vsDelegatedTo; m_vsDelegatedTo = 0; - } - if (m_vsDelegatedFrom != 0) - { - ICalComponent::deleteUnicodeStringVector(m_vsDelegatedFrom); - delete m_vsDelegatedFrom; m_vsDelegatedFrom = 0; - } - if (m_vsMember != 0) - { - ICalComponent::deleteUnicodeStringVector(m_vsMember); - delete m_vsMember; m_vsMember = 0; - } -} - -//--------------------------------------------------------------------- - -ICalProperty * -Attendee::clone(JLog * initLog) -{ - m_Log = initLog; - return (ICalProperty *) new Attendee(*this); -} - -//--------------------------------------------------------------------- - -Attendee * Attendee::getDefault(ICalComponent::ICAL_COMPONENT compType, - JLog * initLog) -{ - Attendee * a = new Attendee(compType, initLog); PR_ASSERT(a != 0); - if (a != 0) - { - a->setRole((Attendee::ROLE) ms_iDEFAULT_ROLE); - a->setType((Attendee::TYPE) ms_iDEFAULT_TYPE); - a->setStatus((Attendee::STATUS) ms_iDEFAULT_STATUS); - a->setRSVP((Attendee::RSVP) ms_iDEFAULT_RSVP); - a->setExpect((Attendee::EXPECT) ms_iDEFAULT_EXPECT); - } - return a; -} - -//--------------------------------------------------------------------- - -void Attendee::parse(UnicodeString & propVal, - JulianPtrArray * parameters) -{ - t_int32 i; - ICalParameter * param; - UnicodeString pName, pVal; - if (propVal.size() == 0) - { - return; - } - setName(propVal); - if (parameters != 0) - { - for (i = 0; i < parameters->GetSize(); i++) - { - param = (ICalParameter *) parameters->GetAt(i); - - setParam(param->getParameterName(pName), - param->getParameterValue(pVal)); - } - } - selfCheck(); -} - -//--------------------------------------------------------------------- -void Attendee::addParamValList(UnicodeString & paramValList, t_int32 hashCode) -{ - UnicodeStringTokenizer * stMult = new UnicodeStringTokenizer(paramValList, - nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL); - PR_ASSERT(stMult != 0); - if (stMult != 0) - { - UnicodeString u; - UnicodeString uNext; - ErrorCode status = ZERO_ERROR; - while (stMult->hasMoreTokens()) - { - if (uNext.size() == 0) - u = stMult->nextToken(u, status); - else - u = uNext; - if ('\"' != u[(TextOffset) (u.size() - 1)]) - { - while (stMult->hasMoreTokens()) - { - uNext = stMult->nextToken(uNext, status); - if ('\"' != uNext[(TextOffset) 0]) - { - u += ','; - u += uNext; - uNext = ""; - } - else - break; - } - } - nsCalUtility::stripDoubleQuotes(u); // double quote property - - if (nsCalKeyword::Instance()->ms_ATOM_DELEGATED_TO == hashCode) - { - addDelegatedTo(u); - } - else if (nsCalKeyword::Instance()->ms_ATOM_DELEGATED_FROM == hashCode) - { - addDelegatedFrom(u); - } - else - { - addMember(u); - } - } - delete stMult; stMult = 0; - } -} - -//--------------------------------------------------------------------- - -void Attendee::setParam(UnicodeString & paramName, - UnicodeString & paramVal) -{ - t_int32 i; - - //if (FALSE) TRACE("(%s, %s)\r\n", paramName.toCString(""), paramVal.toCString("")); - if (paramName.size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName, - nsCalKeyword::Instance()->ms_sATTENDEE, paramName, 200); - } - else - { - t_int32 hashCode = paramName.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_ROLE == hashCode) - { - i = stringToRole(paramVal); - if (i < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, paramVal, 200); - } - else - { - if (getRole() >= 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, 100); - } - setRole((Attendee::ROLE) i); - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_CUTYPE == hashCode) - { - i = stringToType(paramVal); - if (i < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, paramVal, 200); - } - else - { - if (getType() >= 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, 100); - } - setType((Attendee::TYPE) i); - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_PARTSTAT == hashCode) - { - i = stringToStatus(paramVal); - if (i < 0 || !isValidStatus(m_ComponentType, (Attendee::STATUS) i)) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, paramVal, 200); - } - else - { - if (getStatus() >= 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, 100); - } - setStatus((Attendee::STATUS) i); - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_EXPECT == hashCode) - { - i = stringToExpect(paramVal); - if (i < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, paramVal, 200); - } - else - { - if (getExpect() >= 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, 100); - } - setExpect((Attendee::EXPECT) i); - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_RSVP == hashCode) - { - i = stringToRSVP(paramVal); - if (i < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, paramVal, 200); - } - else - { - if (getRSVP() >= 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sATTENDEE, - paramName, 100); - } - setRSVP((Attendee::RSVP) i); - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_DELEGATED_TO == hashCode) - { - addParamValList(paramVal, hashCode); - } - else if (nsCalKeyword::Instance()->ms_ATOM_DELEGATED_FROM == hashCode) - { - addParamValList(paramVal, hashCode); - } - else if (nsCalKeyword::Instance()->ms_ATOM_MEMBER == hashCode) - { - addParamValList(paramVal, hashCode); - } - - // Newer properties 3-23-98 (cn, sent-by (double-quote), dir (double-quote)) - else if (nsCalKeyword::Instance()->ms_ATOM_CN == hashCode) - { - if (getCN().size() != 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sATTENDEE, paramName, 100); - } - setCN(paramVal); - } - else if (nsCalKeyword::Instance()->ms_ATOM_LANGUAGE == hashCode) - { - if (getLanguage().size() != 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sATTENDEE, paramName, 100); - } - setLanguage(paramVal); - } - else if (nsCalKeyword::Instance()->ms_ATOM_SENTBY == hashCode) - { - if (getSentBy().size() != 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sATTENDEE, paramName, 100); - } - nsCalUtility::stripDoubleQuotes(paramVal); // double quote property - setSentBy(paramVal); - } - else if (nsCalKeyword::Instance()->ms_ATOM_DIR == hashCode) - { - if (getDir().size() != 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sATTENDEE, paramName, 100); - } - nsCalUtility::stripDoubleQuotes(paramVal); // double quote property - setDir(paramVal); - } - else if (ICalProperty::IsXToken(paramName)) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iXTokenParamIgnored, - nsCalKeyword::Instance()->ms_sATTENDEE, paramName, 100); - } - else - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName, - nsCalKeyword::Instance()->ms_sATTENDEE, paramName, 200); - } - } -} - -//--------------------------------------------------------------------- - -UnicodeString & Attendee::toICALString(UnicodeString & out) -{ - out = ""; - //UnicodeString sName = getName(); - //UnicodeString sStatus; - //sStatus = statusToString(getStatus(), sStatus); - //JulianPtrArray * vsDelegatedTo = getDelegatedTo(); - //JulianPtrArray * vsDelegatedFrom = getDelegatedFrom(); - - if (getStatus() != STATUS_NEEDSACTION) - { -#if 0 - //if (sStatus.compareIgnoreCase(nsCalKeyword::Instance()->ms_sNEEDSACTION) != 0) { - /* - if (vsDelegatedTo != NULL && vsDelegatedTo.contains(sName)) - return formatDoneDelegateFromOnly(); - else if (vsDelegatedFrom != null && vsDelegatedFrom.contains(sName)) - return formatDoneDelegateToOnly(); - else - */ -#endif - out = formatDoneAction(); - } - else - { -#if 0 - /* - if (vsDelegatedTo != null && vsDelegatedTo.contains(sName)) - return formatDelegateFromOnly(); - else if (vsDelegatedFrom != null && vsDelegatedFrom.contains(sName)) - return formatDelegateToOnly(); - else - */ -#endif - out = formatNeedsAction(); - } - return out; -} -//--------------------------------------------------------------------- - -UnicodeString & Attendee::toICALString(UnicodeString & sProp, - UnicodeString & out) -{ - // NOTE: to eliminate stupid warning - if (sProp.size() > 0) {} - return toICALString(out); -} - -//--------------------------------------------------------------------- - -UnicodeString & Attendee::toString(UnicodeString & out) -{ - out = toString(nsCalFormatString::Instance()->ms_AttendeeStrDefaultFmt, out); - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & Attendee::toString(UnicodeString & strFmt, - UnicodeString & out) -{ - if (strFmt.size() == 0 && - nsCalFormatString::Instance()->ms_AttendeeStrDefaultFmt.size() > 0) - { - // if empty format string, use default - return toString(out); - } - - UnicodeString into; - t_int32 i,j; - //if (FALSE) TRACE("strFmt = %s\r\n", strFmt.toCString("")); - out = ""; - for ( i = 0; i < strFmt.size(); ) - { - - // NOTE: changed from % to ^ for attendee - /// - /// If there's a special formatting character, - /// handle it. Otherwise, just emit the supplied - /// character. - /// - - j = strFmt.indexOf('^', i); - if ( -1 != j) - { - if (j > i) - { - out += strFmt.extractBetween(i,j,into); - } - i = j + 1; - if ( strFmt.size() > i) - { - out += toStringChar(strFmt[(TextOffset) i]); - i++; - } - } - else - { - out += strFmt.extractBetween(i, strFmt.size(),into); - break; - } - } - return out; -}// end - -//--------------------------------------------------------------------- - -UnicodeString Attendee::toStringChar(t_int32 c) -{ - - UnicodeString u; - switch ( c ) - { - case ms_cAttendeeName: - return getName(); - case ms_cAttendeeRole: - return roleToString((Attendee::ROLE) getRole(), u); - case ms_cAttendeeType: - return typeToString((Attendee::TYPE) getType(), u); - case ms_cAttendeeStatus: - return statusToString((Attendee::STATUS) getStatus(), u); - case ms_cAttendeeExpect: - return expectToString((Attendee::EXPECT) getExpect(), u); - case ms_cAttendeeRSVP: - return rsvpToString((Attendee::RSVP) getRSVP(), u); - case ms_cAttendeeDir: - return m_Dir; - case ms_cAttendeeSentBy: - return m_SentBy; - case ms_cAttendeeCN: - return m_CN; - case ms_cAttendeeLanguage: - return m_Language; - case ms_cAttendeeDisplayName: - // return CN is CN != "", else - // return the AttendeeName after the ':' - if (m_CN.size() > 0) - return m_CN; - else - { - t_int32 i = m_sName.indexOf(':'); - if (i >= 0) - { - u = getName().extractBetween(i + 1, m_sName.size(), u); - return u; - } - else - return ""; - } - default: - return ""; - } -}// end of - -//--------------------------------------------------------------------- - -t_bool Attendee::isValid() -{ - /* - UnicodeString mailto; - if (m_sName.size() < 7) - return FALSE; - // change to URL, must have "MAILTO:" in front - mailto = m_sName.extractBetween(0, 7, mailto); - if (mailto.compareIgnoreCase(nsCalKeyword::Instance()->ms_sMAILTO_COLON) != 0) - return FALSE; - else - return TRUE; - */ - return URI::IsValidURI(m_sName); -} - -//--------------------------------------------------------------------- - -void Attendee::selfCheckHelper(Attendee::PROPS prop, t_int32 param) -{ - if (prop == PROPS_ROLE && (param < 0 || param >= ROLE_LENGTH)) - setRole((Attendee::ROLE) ms_iDEFAULT_ROLE); - else if (prop == PROPS_TYPE && (param < 0 || param >= TYPE_LENGTH)) - setType((Attendee::TYPE) ms_iDEFAULT_TYPE); - else if (prop == PROPS_STATUS && (param < 0 || param >= STATUS_LENGTH)) - setStatus((Attendee::STATUS) ms_iDEFAULT_STATUS); - else if (prop == PROPS_EXPECT && (param < 0 || param >= EXPECT_LENGTH)) - setExpect((Attendee::EXPECT) ms_iDEFAULT_EXPECT); - else if (prop == PROPS_RSVP && (param < 0 || param >= RSVP_LENGTH)) - setRSVP((Attendee::RSVP) ms_iDEFAULT_RSVP); -} - -//--------------------------------------------------------------------- - -void Attendee::selfCheck() -{ - selfCheckHelper(PROPS_ROLE, (t_int32) getRole()); - selfCheckHelper(PROPS_TYPE, (t_int32) getType()); - selfCheckHelper(PROPS_STATUS, (t_int32) getStatus()); - selfCheckHelper(PROPS_EXPECT, (t_int32) getExpect()); - selfCheckHelper(PROPS_RSVP, (t_int32) getRSVP()); -} - -//--------------------------------------------------------------------- - -UnicodeString Attendee::format(UnicodeString strFmt) -{ - UnicodeString s, info; - t_int32 i,j; - s += nsCalKeyword::Instance()->ms_sATTENDEE; - - for ( i = 0; i < strFmt.size(); ) - { - - /*- - *** If there's a special formatting character, - *** handle it. Otherwise, just emit the supplied - *** character. - **/ - j = strFmt.indexOf('%', i); - if ( -1 != j) - { - if (j > i) - { - s += strFmt.extractBetween(i,j,info); - } - i = j + 1; - if (strFmt.size() > i) - { - s += formatChar(strFmt[(TextOffset) i]); - i++; - } - } - else - { - s += strFmt.extractBetween(i, strFmt.size(),info); - break; - } - } - return s; -} - -//--------------------------------------------------------------------- - -UnicodeString Attendee::formatChar(t_int32 c) -{ - UnicodeString s, u; - JulianPtrArray * xp; - switch ( c ) - { - case ms_cAttendeeName: { - // ALWAYS MUST BE LAST OF PARAMS - s = ":"; //ms_sCOLON_SYMBOL; - s += getName(); - s += nsCalKeyword::Instance()->ms_sLINEBREAK; - return s; - } - case ms_cAttendeeRole: - s = roleToString(getRole(), s); - return ICalProperty::parameterToCalString( - nsCalKeyword::Instance()->ms_sROLE, s, u); - case ms_cAttendeeStatus: - s = statusToString(getStatus(), s); - return ICalProperty::parameterToCalString( - nsCalKeyword::Instance()->ms_sPARTSTAT, s, u); - case ms_cAttendeeRSVP: - s = rsvpToString(getRSVP(), s); - return ICalProperty::parameterToCalString( - nsCalKeyword::Instance()->ms_sRSVP, s, u); - case ms_cAttendeeType: - s = typeToString(getType(), s); - return ICalProperty::parameterToCalString( - nsCalKeyword::Instance()->ms_sCUTYPE, s, u); - case ms_cAttendeeExpect: - s = expectToString(getExpect(), s); - return ICalProperty::parameterToCalString( - nsCalKeyword::Instance()->ms_sEXPECT, s, u); - case ms_cAttendeeDelegatedTo: - xp = getDelegatedTo(); - return printMailToVector( - nsCalKeyword::Instance()->ms_sDELEGATED_TO, xp, u); - case ms_cAttendeeDelegatedFrom: - xp = getDelegatedFrom(); - return printMailToVector( - nsCalKeyword::Instance()->ms_sDELEGATED_FROM, xp, u); - case ms_cAttendeeMember: - xp = getMember(); - return printMailToVector( - nsCalKeyword::Instance()->ms_sMEMBER, xp, u); - case ms_cAttendeeDir: - s = m_Dir; - s = nsCalUtility::addDoubleQuotes(s); - return ICalProperty::parameterToCalString( - nsCalKeyword::Instance()->ms_sDIR, s, u); - case ms_cAttendeeSentBy: - s = m_SentBy; - s = nsCalUtility::addDoubleQuotes(s); - return ICalProperty::parameterToCalString( - nsCalKeyword::Instance()->ms_sSENTBY, s, u); - case ms_cAttendeeCN: - return ICalProperty::parameterToCalString( - nsCalKeyword::Instance()->ms_sCN, m_CN, u); - case ms_cAttendeeLanguage: - return ICalProperty::parameterToCalString( - nsCalKeyword::Instance()->ms_sLANGUAGE, m_Language, u); - default: - return ""; - } -} - -//--------------------------------------------------------------------- - -UnicodeString & -Attendee::printMailToVector(UnicodeString & propName, JulianPtrArray * mailto, - UnicodeString & out) -{ - out = ""; - if (mailto != 0 && mailto->GetSize() > 0) - { - t_int32 i; - out += ';'; - out += propName; - out += '='; - UnicodeString aMailto; - for (i = 0; i < mailto->GetSize(); i++) - { - aMailto = *((UnicodeString *) mailto->GetAt(i)); - out += '\"'; - out += aMailto; - out += '\"'; - if (i < mailto->GetSize() - 1) - { - out += ','; - } - } - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString Attendee::formatDoneAction() -{ - return format(nsCalFormatString::Instance()->ms_sAttendeeDoneActionMessage); -} - -//--------------------------------------------------------------------- -#if 0 -UnicodeString Attendee::formatDoneDelegateToOnly() -{ - return format(nsCalFormatString::Instance()->ms_sAttendeeDoneDelegateToOnly); -} - -//--------------------------------------------------------------------- - -UnicodeString Attendee::formatDoneDelegateFromOnly() -{ - return format(nsCalFormatString::Instance()->ms_sAttendeeDoneDelegateFromOnly); -} -#endif -//--------------------------------------------------------------------- -// BELOW METHODS ALL ARE NEEDS ACTION -// no need for %S, assumed to be NEEDS-ACTION -UnicodeString Attendee::formatNeedsAction() -{ - return format(nsCalFormatString::Instance()->ms_sAttendeeNeedsActionMessage); -} - -//--------------------------------------------------------------------- -#if 0 -UnicodeString Attendee::formatDelegateToOnly() -{ - return format(nsCalFormatString::Instance()->ms_sAttendeeNeedsActionDelegateToOnly); -} - -//--------------------------------------------------------------------- - -UnicodeString Attendee::formatDelegateFromOnly() -{ - return format(nsCalFormatString::Instance()->ms_sAttendeeNeedsActionDelegateFromOnly); -} -#endif -//--------------------------------------------------------------------- - -void Attendee::setParameters(JulianPtrArray * parameters) -{ - t_int32 i; - ICalParameter * param; - UnicodeString pName, pVal; - if (parameters != 0) - { - for (i = 0; i < parameters->GetSize(); i++) - { - param = (ICalParameter *) parameters->GetAt(i); - setParam(param->getParameterName(pName), - param->getParameterValue(pVal)); - } - } -} - -//--------------------------------------------------------------------- - -void Attendee::setName(UnicodeString sName) -{ - m_sName = sName; -} - -//--------------------------------------------------------------------- - -void Attendee::addDelegatedTo(UnicodeString sDelegatedTo) -{ - if (m_vsDelegatedTo == 0) - m_vsDelegatedTo = new JulianPtrArray(); - PR_ASSERT(m_vsDelegatedTo != 0); - if (m_vsDelegatedTo != 0) - { - m_vsDelegatedTo->Add(new UnicodeString(sDelegatedTo)); - } -} - -//--------------------------------------------------------------------- - -void Attendee::addDelegatedFrom(UnicodeString sDelegatedFrom) -{ - if (m_vsDelegatedFrom == 0) - m_vsDelegatedFrom = new JulianPtrArray(); - PR_ASSERT(m_vsDelegatedFrom != 0); - if (m_vsDelegatedFrom != 0) - { - m_vsDelegatedFrom->Add(new UnicodeString(sDelegatedFrom)); - } -} - -//--------------------------------------------------------------------- - -void Attendee::addMember(UnicodeString sMember) -{ - if (m_vsMember == 0) - m_vsMember = new JulianPtrArray(); - PR_ASSERT(m_vsMember != 0); - if (m_vsMember != 0) - { - m_vsMember->Add(new UnicodeString(sMember)); - } -} -//--------------------------------------------------------------------- - -Attendee * Attendee::getAttendee(JulianPtrArray * vAttendees, UnicodeString sAttendee) -{ - Attendee * att; - t_int32 i; - if (vAttendees != 0 && vAttendees->GetSize() > 0) - { - for (i = 0; i < vAttendees->GetSize(); i++) - { - att = (Attendee *) vAttendees->GetAt(i); - if ((att->getName()).compareIgnoreCase(sAttendee) == 0) - { - return att; - } - } - } - return 0; -} - -//--------------------------------------------------------------------- - -Attendee::ROLE -Attendee::stringToRole(UnicodeString & sRole) -{ - sRole.toUpper(); - t_int32 hashCode = sRole.hashCode(); - -#if 0 - /* Old keywords */ - if (nsCalKeyword::Instance()->ms_ATOM_ATTENDEE == hashCode) return ROLE_ATTENDEE; - else if (nsCalKeyword::Instance()->ms_ATOM_ORGANIZER == hashCode) return ROLE_ORGANIZER; - else if (nsCalKeyword::Instance()->ms_ATOM_OWNER == hashCode) return ROLE_OWNER; - else if (nsCalKeyword::Instance()->ms_ATOM_DELEGATE == hashCode) return ROLE_DELEGATE; -#endif - - if (nsCalKeyword::Instance()->ms_ATOM_CHAIR == hashCode) return ROLE_CHAIR; - else if (nsCalKeyword::Instance()->ms_ATOM_REQ_PARTICIPANT == hashCode) return ROLE_REQ_PARTICIPANT; - else if (nsCalKeyword::Instance()->ms_ATOM_OPT_PARTICIPANT == hashCode) return ROLE_OPT_PARTICIPANT; - else if (nsCalKeyword::Instance()->ms_ATOM_NON_PARTICIPANT == hashCode) return ROLE_NON_PARTICIPANT; - else if (ICalProperty::IsXToken(sRole)) return ROLE_XPARAMVAL; - else return ROLE_INVALID; -} - -//--------------------------------------------------------------------- - -Attendee::TYPE -Attendee::stringToType(UnicodeString & sType) -{ - sType.toUpper(); - t_int32 hashCode = sType.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_INDIVIDUAL == hashCode) return TYPE_INDIVIDUAL; - else if (nsCalKeyword::Instance()->ms_ATOM_GROUP == hashCode) return TYPE_GROUP; - else if (nsCalKeyword::Instance()->ms_ATOM_RESOURCE == hashCode) return TYPE_RESOURCE; - else if (nsCalKeyword::Instance()->ms_ATOM_ROOM == hashCode) return TYPE_ROOM; - else if (nsCalKeyword::Instance()->ms_ATOM_UNKNOWN == hashCode) return TYPE_UNKNOWN; - else if (ICalProperty::IsXToken(sType)) return TYPE_XPARAMVAL; - else return TYPE_INVALID; -} - -//--------------------------------------------------------------------- - -Attendee::STATUS -Attendee::stringToStatus(UnicodeString & sStatus) -{ - sStatus.toUpper(); - t_int32 hashCode = sStatus.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_NEEDSACTION == hashCode) return STATUS_NEEDSACTION; - else if (nsCalKeyword::Instance()->ms_ATOM_VCALNEEDSACTION == hashCode) return STATUS_NEEDSACTION; - - else if (nsCalKeyword::Instance()->ms_ATOM_ACCEPTED == hashCode) return STATUS_ACCEPTED; - else if (nsCalKeyword::Instance()->ms_ATOM_DECLINED == hashCode) return STATUS_DECLINED; - else if (nsCalKeyword::Instance()->ms_ATOM_TENTATIVE == hashCode) return STATUS_TENTATIVE; - else if (nsCalKeyword::Instance()->ms_ATOM_COMPLETED == hashCode) return STATUS_COMPLETED; - else if (nsCalKeyword::Instance()->ms_ATOM_INPROCESS == hashCode) return STATUS_INPROCESS; - else if (nsCalKeyword::Instance()->ms_ATOM_DELEGATED == hashCode) return STATUS_DELEGATED; - else if (ICalProperty::IsXToken(sStatus)) return STATUS_XPARAMVAL; - else return STATUS_INVALID; -} - -//--------------------------------------------------------------------- - -Attendee::RSVP -Attendee::stringToRSVP(UnicodeString & sRSVP) -{ - sRSVP.toUpper(); - t_int32 hashCode = sRSVP.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_FALSE == hashCode) return RSVP_FALSE; - else if (nsCalKeyword::Instance()->ms_ATOM_TRUE == hashCode) return RSVP_TRUE; - else return RSVP_INVALID; -} - -//--------------------------------------------------------------------- - -Attendee::EXPECT -Attendee::stringToExpect(UnicodeString & sExpect) -{ - sExpect.toUpper(); - t_int32 hashCode = sExpect.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_FYI == hashCode) return EXPECT_FYI; - else if (nsCalKeyword::Instance()->ms_ATOM_REQUIRE == hashCode) return EXPECT_REQUIRE; - else if (nsCalKeyword::Instance()->ms_ATOM_REQUEST == hashCode) return EXPECT_REQUEST; - else return EXPECT_INVALID; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Attendee::roleToString(Attendee::ROLE role, UnicodeString & out) -{ - switch(role) - { - -#if 0 - /* Old Keywords */ - case ROLE_ATTENDEE: out = nsCalKeyword::Instance()->ms_sATTENDEE; break; - case ROLE_ORGANIZER: out = nsCalKeyword::Instance()->ms_sORGANIZER; break; - case ROLE_OWNER: out = nsCalKeyword::Instance()->ms_sOWNER; break; - case ROLE_DELEGATE: out = nsCalKeyword::Instance()->ms_sDELEGATE; break; -#endif - - case ROLE_CHAIR: out = nsCalKeyword::Instance()->ms_sCHAIR; break; - case ROLE_REQ_PARTICIPANT: out = nsCalKeyword::Instance()->ms_sREQ_PARTICIPANT; break; - case ROLE_OPT_PARTICIPANT: out = nsCalKeyword::Instance()->ms_sOPT_PARTICIPANT; break; - case ROLE_NON_PARTICIPANT: out = nsCalKeyword::Instance()->ms_sNON_PARTICIPANT; break; - case ROLE_XPARAMVAL: out = nsCalKeyword::Instance()->ms_sXPARAMVAL; break; - default: - // default return req participant - out = nsCalKeyword::Instance()->ms_sREQ_PARTICIPANT; - break; - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Attendee::typeToString(Attendee::TYPE type, UnicodeString & out) -{ - switch(type) - { - case TYPE_INDIVIDUAL: out = nsCalKeyword::Instance()->ms_sINDIVIDUAL; break; - case TYPE_GROUP: out = nsCalKeyword::Instance()->ms_sGROUP; break; - case TYPE_RESOURCE: out = nsCalKeyword::Instance()->ms_sRESOURCE; break; - case TYPE_ROOM: out = nsCalKeyword::Instance()->ms_sROOM; break; - case TYPE_UNKNOWN: out = nsCalKeyword::Instance()->ms_sUNKNOWN; break; - case TYPE_XPARAMVAL: out = nsCalKeyword::Instance()->ms_sXPARAMVAL; break; - default: - // default return individual - out = nsCalKeyword::Instance()->ms_sINDIVIDUAL; - break; - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Attendee::statusToString(Attendee::STATUS status, UnicodeString & out) -{ - switch(status) - { - case STATUS_NEEDSACTION: out = nsCalKeyword::Instance()->ms_sNEEDSACTION; break; - case STATUS_ACCEPTED: out = nsCalKeyword::Instance()->ms_sACCEPTED; break; - case STATUS_DECLINED: out = nsCalKeyword::Instance()->ms_sDECLINED; break; - case STATUS_TENTATIVE: out = nsCalKeyword::Instance()->ms_sTENTATIVE; break; - case STATUS_COMPLETED: out = nsCalKeyword::Instance()->ms_sCOMPLETED; break; - case STATUS_DELEGATED: out = nsCalKeyword::Instance()->ms_sDELEGATED; break; - case STATUS_INPROCESS: out = nsCalKeyword::Instance()->ms_sINPROCESS; break; - case STATUS_XPARAMVAL: out = nsCalKeyword::Instance()->ms_sXPARAMVAL; break; - default: - // default return needs-action - out = nsCalKeyword::Instance()->ms_sNEEDSACTION; - break; - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Attendee::rsvpToString(Attendee::RSVP rsvp, UnicodeString & out) -{ - switch(rsvp) - { - case RSVP_FALSE: out = nsCalKeyword::Instance()->ms_sFALSE; break; - case RSVP_TRUE: out = nsCalKeyword::Instance()->ms_sTRUE; break; - default: - // default return false - out = nsCalKeyword::Instance()->ms_sFALSE; - break; - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Attendee::expectToString(Attendee::EXPECT expect, UnicodeString & out) -{ - switch(expect) - { - case EXPECT_FYI: out = nsCalKeyword::Instance()->ms_sFYI; break; - case EXPECT_REQUIRE: out = nsCalKeyword::Instance()->ms_sREQUIRE; break; - case EXPECT_REQUEST: out = nsCalKeyword::Instance()->ms_sREQUEST; break; - default: - // default return fyi - out = nsCalKeyword::Instance()->ms_sFYI; - break; - } - return out; -} - -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/bprprty.cpp b/mozilla/calendar/modules/core/ical/src/bprprty.cpp deleted file mode 100644 index 46b77cbfea6..00000000000 --- a/mozilla/calendar/modules/core/ical/src/bprprty.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// bprprty.cpp -// John Sun -// 3:34 PM February 12 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "bprprty.h" -#include "prprty.h" - -//--------------------------------------------------------------------- - -// private never use -BooleanProperty::BooleanProperty() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -BooleanProperty::BooleanProperty(const BooleanProperty & that) -{ - m_Boolean = that.m_Boolean; - setParameters(that.m_vParameters); -} - -//--------------------------------------------------------------------- - -BooleanProperty::BooleanProperty(t_bool value, JulianPtrArray * parameters) -: StandardProperty(parameters) -{ - m_Boolean = value; -} - -//--------------------------------------------------------------------- - -BooleanProperty::~BooleanProperty() -{ -} - -//--------------------------------------------------------------------- - -void * BooleanProperty::getValue() const -{ - return (void *) &m_Boolean; -} - -//--------------------------------------------------------------------- - -void BooleanProperty::setValue(void * value) -{ - PR_ASSERT(value != 0); - if (value != 0) - { - m_Boolean = *((t_bool *) value); - } -} - -//--------------------------------------------------------------------- - -ICalProperty * BooleanProperty::clone(JLog * initLog) -{ - if (initLog) {} // NOTE: Remove later to avoid warnings - return new BooleanProperty(*this); -} - -//--------------------------------------------------------------------- - -t_bool BooleanProperty::isValid() -{ - return TRUE; -} - -//--------------------------------------------------------------------- - -UnicodeString & BooleanProperty::toString(UnicodeString & out) -{ - - if (m_Boolean) - out = "TRUE"; - else - out = "FALSE"; - return out; -} -//--------------------------------------------------------------------- -UnicodeString & -BooleanProperty::toString(UnicodeString & dateFmt, UnicodeString & out) -{ - // NOTE: remove it later, gets rid of compiler warning - if (dateFmt.size() > 0) {} - return toString(out); -} -//--------------------------------------------------------------------- - -UnicodeString & BooleanProperty::toExportString(UnicodeString & out) -{ - return toString(out); -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/bydmgntr.cpp b/mozilla/calendar/modules/core/ical/src/bydmgntr.cpp deleted file mode 100644 index 0b09b4d076b..00000000000 --- a/mozilla/calendar/modules/core/ical/src/bydmgntr.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// bydmgntr.cpp -// John Sun -// 4:08 PM February 3 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include -#include "bydmgntr.h" -#include "jutility.h" -#include "calendar.h" - - -ByDayMonthlyGenerator::ByDayMonthlyGenerator() -: DateGenerator(nsCalUtility::RT_MONTHLY, 0), - m_aiParams(0), - m_iWkSt((t_int32) Calendar::SUNDAY) -{} - -//--------------------------------------------------------------------- - -t_int32 -ByDayMonthlyGenerator::getInterval() const { return nsCalUtility::RT_DAILY; } - -//--------------------------------------------------------------------- -// TODO: crash proof it -t_bool -ByDayMonthlyGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - DateTime * t, * nextWkSt; - t_int32 i, iMonth = 0, iMonth2 = 0; - t_bool bOldWkSt; - t_int32 temp; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - // bulletproof code - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - // if (FALSE) TRACE("start = %s\r\n", start->toString().toCString("")); - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - // bulletproof code - if (t == 0) - { - return FALSE; - } - nextWkSt = new DateTime(start->getTime()); PR_ASSERT(nextWkSt != 0); - // bulletproof code - if (nextWkSt == 0) - { - if (t != 0) { delete t; t = 0; } - return FALSE; - } - - for (i = 0; i < m_iParamsLen; i++) - { - t->setTime(start->getTime()); - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - //if (FALSE) TRACE("nextWkSt = %s\r\n", nextWkSt->toString().toCString("")); - - if (m_aiParams[i][1] >= 0) - { - t->add(Calendar::DATE, -(t->get(Calendar::DATE)) + 1); - } - else - { - t->findLastDayOfMonth(); - } - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - iMonth = t->get(Calendar::MONTH); - - if (m_aiParams[i][1] != 0) - { - while (t->get(Calendar::DAY_OF_WEEK) != m_aiParams[i][0]) - t->add(Calendar::DATE, (m_aiParams[i][1] > 0) ? 1 : -1); - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - // NOTE: so not to call abs (to fix HPUX-compiling problem), replaces below commented out code - temp = m_aiParams[i][1]; - if (temp < 0) - temp = 0 - temp; - - t->add(Calendar::DAY_OF_YEAR, (temp - 1) * - (m_aiParams[i][1] > 0 ? 1 : -1) * 7); - - /// replacing this code with above - //t->add(Calendar::DAY_OF_YEAR, (abs(m_aiParams[i][1]) - 1) * - // (m_aiParams[i][1] > 0 ? 1 : -1) * 7); - - - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - if (until != 0 && until->isValid() && t->after(until)) - { - delete t; t = 0; - delete nextWkSt; nextWkSt = 0; - return TRUE; - } - else - { - // check also still in same month! - // prevents bug if asking 5MO, but no 5th monday in this month - if ((t->after(start) || t->equals(start)) && - (t->get(Calendar::MONTH) == iMonth) - ) - { - dateVector.Add(new DateTime(t->getTime())); - } - } - } - else - { - nextWkSt->setTime(t->getTime()); - nextWkSt->moveTo(m_iWkSt, 1, TRUE); - - while (t->get(Calendar::MONTH) == iMonth) - { - - //if (FALSE) TRACE("nextWkSt = %s\r\n", nextWkSt->toString().toCString("")); - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - bOldWkSt = TRUE; - if (until != 0 && until->isValid() && t->after(until)) - { - delete t; t = 0; - delete nextWkSt; nextWkSt = 0; - return TRUE; - } - else if (t->get(Calendar::DAY_OF_WEEK) == m_aiParams[i][0] && - (t->after(start) || t->equals(start)) && - !(t->after(nextWkSt))) - { - dateVector.Add(new DateTime(t->getTime())); - nextWkSt->setTime(t->getTime()); - nextWkSt->moveTo(m_iWkSt, 1, TRUE); - } - else if (t->after(nextWkSt)) - { - nextWkSt->setTime(t->getTime()); - nextWkSt->moveTo(m_iWkSt, 1, TRUE); - bOldWkSt = FALSE; - } - if ((bOldWkSt) && (!(t->after(nextWkSt)))) - { - iMonth2 = t->get(Calendar::DAY_OF_MONTH); - t->add(Calendar::DATE, 1); - if (iMonth2 == t->get(Calendar::DAY_OF_MONTH)) - t->add(Calendar::DATE, -1); - } - } - } - } - delete t; t = 0; - delete nextWkSt; nextWkSt = 0; - return FALSE; -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/bydwgntr.cpp b/mozilla/calendar/modules/core/ical/src/bydwgntr.cpp deleted file mode 100644 index 1c52759303b..00000000000 --- a/mozilla/calendar/modules/core/ical/src/bydwgntr.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// bydwgntr.cpp -// John Sun -// 4:10 PM February 3 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "bydwgntr.h" -#include "jutility.h" - -ByDayWeeklyGenerator::ByDayWeeklyGenerator() -: - DateGenerator(nsCalUtility::RT_WEEKLY, 0), - m_aiParams(0), - m_iWkSt((t_int32) Calendar::SUNDAY) -{} - -//--------------------------------------------------------------------- - -t_int32 -ByDayWeeklyGenerator::getInterval() const { return nsCalUtility::RT_DAILY; } - -//--------------------------------------------------------------------- - -t_bool -ByDayWeeklyGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - DateTime * t, * nextWkSt; - t_int32 i; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - nextWkSt = new DateTime(t->getTime()); PR_ASSERT(nextWkSt != 0); - - nextWkSt->moveTo(m_iWkSt, 1, TRUE); - - for (i = 0; i < m_iParamsLen; i++) - { - t->setTime(start->getTime()); - t->moveTo(m_aiParams[i][0], 1, FALSE); - - if (until != 0 && until->isValid() && t->after(until)) - { - delete t; t = 0; - delete nextWkSt; nextWkSt = 0; - return TRUE; - } - if ((t->after(start) || t->equals(start)) && t->before(nextWkSt)) - { - dateVector.Add(new DateTime(t->getTime())); - } - } - delete t; t = 0; - delete nextWkSt; nextWkSt = 0; - return FALSE; -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/bydygntr.cpp b/mozilla/calendar/modules/core/ical/src/bydygntr.cpp deleted file mode 100644 index 97c93f94955..00000000000 --- a/mozilla/calendar/modules/core/ical/src/bydygntr.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// bydygntr.cpp -// John Sun -// 4:11 PM February 3 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include -#include "bydygntr.h" -#include "jutility.h" - -ByDayYearlyGenerator::ByDayYearlyGenerator() -: - DateGenerator(nsCalUtility::RT_YEARLY, 0), - m_aiParams(0), - m_iWkSt((t_int32) Calendar::SUNDAY) -{} - - -//--------------------------------------------------------------------- - -t_int32 -ByDayYearlyGenerator::getInterval() const { return nsCalUtility::RT_DAILY; } - -//--------------------------------------------------------------------- -// TODO: crash proof -t_bool -ByDayYearlyGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - DateTime * t, * nextWkSt; - t_int32 i, k, iYear = 0, iDayOfYear = 0; - t_int32 iAbsMod = -1; - t_bool bOldWkSt = FALSE; - t_int32 temp = 0; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - // bulletproof code - if (t == 0) - { - return FALSE; - } - nextWkSt = new DateTime(start->getTime()); PR_ASSERT(nextWkSt != 0); - // bulletproof code - if (nextWkSt == 0) - { - if (t != 0) { delete t; t = 0; } - return FALSE; - } - - for (i = 0; i < m_iParamsLen; i++) - { - k = 0; - t->setTime(start->getTime()); - - if (m_aiParams[i][1] >= 0) - t->add(Calendar::DAY_OF_YEAR, - -(t->get(Calendar::DAY_OF_YEAR)) + 1); - else - t->findLastDayOfYear(); - - iYear = t->get(Calendar::YEAR); - - if (m_aiParams[i][1] != 0) - { - // NOTE: avoid using abs to fix HPUX compiling problems - temp = m_aiParams[i][1]; - if (temp < 0) - temp = 0 - temp; - iAbsMod = temp - 1; - - // replacing below code with above - //iAbsMod = abs(m_aiParams[i][1]) - 1; - - - while ((k != iAbsMod) || - (t->get(Calendar::DAY_OF_WEEK) != m_aiParams[i][0])) - { - if (t->get(Calendar::DAY_OF_WEEK) == m_aiParams[i][0]) - k++; - - if (m_aiParams[i][1] > 0) - t->add(Calendar::DAY_OF_YEAR, 1); - else - t->add(Calendar::DAY_OF_YEAR, -1); - - if (until != 0 && until->isValid() && t->after(until)) - { - delete t; t = 0; - delete nextWkSt; nextWkSt = 0; - return TRUE; - } - } - - // check also still in same year! - // prevents bug if asking 53MO, but no 53th monday in this year - if ((t->after(start) || t->equals(start)) && - (t->get(Calendar::YEAR) == iYear)) - { - dateVector.Add(new DateTime(t->getTime())); - } - } - else - { - nextWkSt->setTime(start->getTime()); - nextWkSt->moveTo(m_iWkSt, 1, TRUE); - - while (t->get(Calendar::YEAR) == iYear) - { - bOldWkSt = TRUE; - if (until != 0 && until->isValid() && t->after(until)) - { - delete t; t = 0; - delete nextWkSt; nextWkSt = 0; - return TRUE; - } - else if (t->get(Calendar::DAY_OF_WEEK) == m_aiParams[i][0] && - (t->after(start) || t->equals(start)) && - !(t->after(nextWkSt))) - { - dateVector.Add(new DateTime(t->getTime())); - nextWkSt->setTime(t->getTime()); - nextWkSt->moveTo(m_iWkSt, 1, TRUE); - } - else if (t->after(nextWkSt)) - { - nextWkSt->setTime(t->getTime()); - nextWkSt->moveTo(m_iWkSt, 1, TRUE); - bOldWkSt = FALSE; - } - if ((bOldWkSt) && (!t->after(nextWkSt))) - { - iDayOfYear = t->get(Calendar::DAY_OF_YEAR); - t->add(Calendar::DATE, 1); - if (iDayOfYear == t->get(Calendar::DAY_OF_YEAR)) - t->add(Calendar::DAY_OF_YEAR, -1); - } - } - } - } - delete t; t = 0; - delete nextWkSt; nextWkSt = 0; - return FALSE; -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/byhgntr.cpp b/mozilla/calendar/modules/core/ical/src/byhgntr.cpp deleted file mode 100644 index 7a48a6611a3..00000000000 --- a/mozilla/calendar/modules/core/ical/src/byhgntr.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// byhgntr.cpp -// John Sun -// 4:18 PM February 3 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "byhgntr.h" -#include "jutility.h" -#include "calendar.h" - -ByHourGenerator::ByHourGenerator() -: - DateGenerator(nsCalUtility::RT_DAILY, 0), - m_aiParams(0) -{} - -//--------------------------------------------------------------------- - -t_int32 -ByHourGenerator::getInterval() const { return nsCalUtility::RT_HOURLY; } - -//--------------------------------------------------------------------- - -t_bool -ByHourGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - DateTime * t; - t_int32 i; - - DateTime dt; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - - for (i = 0; i < m_iParamsLen; i++) - { - t->setTime(start->getTime()); - - while (start->get((Calendar::EDateFields) m_iSpan) == - t->get((Calendar::EDateFields) m_iSpan)) - { - // only allow 0-23, no negatives allowed, using hour_of_day - // instead of hour since hour does seem to update immediately - t->set(Calendar::HOUR_OF_DAY, m_aiParams[i]); - - /* - // allow negatives (not in spec anymore, so commented out) - - if (m_aiParams[i] > 0) - t->set(Calendar::HOUR_OF_DAY, m_aiParams[i]); - else - t->set(Calendar::HOUR_OF_DAY, 24 + m_aiParams[i]); - */ - - if (until != 0 && until->isValid() && t->after(until)) - { - delete t; t = 0; - return TRUE; - } - else if (t->after(start) || t->equals(start)) - { - //dt = *t; - //dateVector.Add(t); - //delete t; - dateVector.Add(new DateTime(t->getTime())); - } - - t->add(Calendar::DAY_OF_YEAR, 1); - } - } - delete t; t = 0; - return FALSE; -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/bymdgntr.cpp b/mozilla/calendar/modules/core/ical/src/bymdgntr.cpp deleted file mode 100644 index 926c99a5c86..00000000000 --- a/mozilla/calendar/modules/core/ical/src/bymdgntr.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// bymdgntr.cpp -// John Sun -// 4:08 PM February 3 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "bymdgntr.h" -#include "jutility.h" - -ByMonthDayGenerator::ByMonthDayGenerator() -: - DateGenerator(nsCalUtility::RT_MONTHLY, 0), - m_aiParams(0) - {} - -//--------------------------------------------------------------------- - -t_int32 -ByMonthDayGenerator::getInterval() const { return nsCalUtility::RT_DAILY; } - -//--------------------------------------------------------------------- - -t_bool -ByMonthDayGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - DateTime * t; - t_int32 i, iMonth = 0; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - for (i = 0; i < m_iParamsLen; i++) - { - t->setTime(start->getTime()); - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - if (m_aiParams[i] > 0) - t->add(Calendar::DATE, - (t->get(Calendar::DATE)) + 1); - else - t->findLastDayOfMonth(); - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - iMonth = t->get(Calendar::MONTH); - - t->add(Calendar::DATE, - (m_aiParams[i] > 0) ? m_aiParams[i] - 1 : m_aiParams[i] + 1); - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - if (until != 0 && until->isValid() && t->after(until)) - { - delete t; t = 0; - return TRUE; - } - - // make sure in same month - if ((t->after(start) || t->equals(start)) && - (t->get(Calendar::MONTH) == iMonth)) - { - dateVector.Add(new DateTime(t->getTime())); - } - } - delete t; t = 0; - return FALSE; -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/bymgntr.cpp b/mozilla/calendar/modules/core/ical/src/bymgntr.cpp deleted file mode 100644 index 4316c954bf7..00000000000 --- a/mozilla/calendar/modules/core/ical/src/bymgntr.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// bymgntr.cpp -// John Sun -// 12:16 PM February 4 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "bymgntr.h" -#include "jutility.h" -#include "calendar.h" - -ByMinuteGenerator::ByMinuteGenerator() -: - DateGenerator(nsCalUtility::RT_HOURLY, 0), - m_aiParams(0) -{} - -//--------------------------------------------------------------------- - -t_int32 -ByMinuteGenerator::getInterval() const { return nsCalUtility::RT_MINUTELY; } - -//--------------------------------------------------------------------- - -t_bool -ByMinuteGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - DateTime * t; - t_int32 i; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - - for (i = 0; i < m_iParamsLen; i++) - { - t->setTime(start->getTime()); - - while (start->get((Calendar::EDateFields) m_iSpan) == - t->get((Calendar::EDateFields) m_iSpan)) - { - // only allow 0-59, no negatives allowed - - t->set(Calendar::MINUTE, m_aiParams[i]); - - /* - // allow negatives (not in spec anymore, so commented out) - if (m_aiParams[i] >= 0) - t->set(Calendar::MINUTE, m_aiParams[i]); - else - t->set(Calendar::MINUTE, 60 + m_aiParams[i]); - */ - - if (until != 0 && until->isValid() && t->after(until)) - { - delete t; t = 0; - return TRUE; - } - else if (t->after(start) || t->equals(start)) - { - dateVector.Add(new DateTime(t->getTime())); - } - - t->add(Calendar::HOUR, 1); - } - } - delete t; t = 0; - return FALSE; -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/bymogntr.cpp b/mozilla/calendar/modules/core/ical/src/bymogntr.cpp deleted file mode 100644 index d5d7bd6c29e..00000000000 --- a/mozilla/calendar/modules/core/ical/src/bymogntr.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// bymogntr.cpp -// John Sun -// 4:21 PM February 3 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "bymogntr.h" -#include "jutility.h" - -ByMonthGenerator::ByMonthGenerator() -: - DateGenerator(nsCalUtility::RT_YEARLY, 0), - m_aiParams(0) - {} - -//--------------------------------------------------------------------- - -t_int32 -ByMonthGenerator::getInterval() const { return nsCalUtility::RT_MONTHLY; } - -//--------------------------------------------------------------------- - -t_bool -ByMonthGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - t_int32 i, iMonth = 0; - DateTime * t; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - - for (i = 0; i < m_iParamsLen; i++) - { - t->setTime(start->getTime()); - - // negative month don't exist, only [1-12] - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - t->add(Calendar::MONTH, m_aiParams[i] - t->get(Calendar::MONTH) - 1); - t->add(Calendar::DATE, - t->get(Calendar::DATE) + 1); - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - iMonth = t->get(Calendar::MONTH); - - while (t->get(Calendar::MONTH) == iMonth) - { - if (until != 0 && until->isValid() & t->after(until)) - { - delete t; t = 0; - return TRUE; - } - if (t->after(start) || t->equals(start)) - dateVector.Add(new DateTime(t->getTime())); - - t->add(Calendar::DATE, 1); - } - } - delete t; t = 0; - return FALSE; -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/bywngntr.cpp b/mozilla/calendar/modules/core/ical/src/bywngntr.cpp deleted file mode 100644 index ad03c59e7ad..00000000000 --- a/mozilla/calendar/modules/core/ical/src/bywngntr.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// bywngntr.cpp -// John Sun -// 4:23 PM February 3 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "bywngntr.h" -#include "jutility.h" - -ByWeekNoGenerator::ByWeekNoGenerator() -: - DateGenerator(nsCalUtility::RT_YEARLY, 0), - m_aiParams(0) - {} - -//--------------------------------------------------------------------- - -t_int32 -ByWeekNoGenerator::getInterval() const { return nsCalUtility::RT_WEEKLY; } - -//--------------------------------------------------------------------- - -t_bool -ByWeekNoGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - DateTime * t; - t_int32 i, k; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - - for (i = 0; i < m_iParamsLen; i++) - { - t->setTime(start->getTime()); - - t->setByISOWeek(m_aiParams[i]); - - for (k = 0; k < 7; k++) - { - if (until != 0 && until->isValid() && t->after(until) && i == m_iParamsLen - 1) - { - delete t; t = 0; - return TRUE; - } - else if (until != 0 && until->isValid() && t->after(until)) - { - //delete t; - break; - } - if (t->after(start) || t->equals(start)) - dateVector.Add(new DateTime(t->getTime())); - - t->add(Calendar::DAY_OF_YEAR, 1); - - } - } - delete t; t = 0; - return FALSE; -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/byydgntr.cpp b/mozilla/calendar/modules/core/ical/src/byydgntr.cpp deleted file mode 100644 index 203242702a6..00000000000 --- a/mozilla/calendar/modules/core/ical/src/byydgntr.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// byydgntr.cpp -// John Sun -// 4:25 PM February 3 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "byydgntr.h" -#include "jutility.h" - -ByYearDayGenerator::ByYearDayGenerator() -: - DateGenerator(nsCalUtility::RT_YEARLY, 0), - m_aiParams(0) - {} - -//--------------------------------------------------------------------- - -t_int32 -ByYearDayGenerator::getInterval() const { return nsCalUtility::RT_DAILY; } - -//--------------------------------------------------------------------- - -t_bool -ByYearDayGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - DateTime * t; - t_int32 i, iYear = 0; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - for (i = 0; i < m_iParamsLen; i++) - { - t->setTime(start->getTime()); - - if (m_aiParams[i] > 0) - { - t->add(Calendar::DAY_OF_YEAR, - - (t->get(Calendar::DAY_OF_YEAR)) + 1); - } - else - { - t->findLastDayOfYear(); - } - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - iYear = t->get(Calendar::YEAR); - - t->add(Calendar::DAY_OF_YEAR, - (m_aiParams[i] > 0) ? m_aiParams[i] - 1 : m_aiParams[i] + 1); - - //if (FALSE) TRACE("t = %s\r\n", t->toString().toCString("")); - - if (until != 0 && until->isValid() & t->after(until)) - { - delete t; t = 0; - return TRUE; - } - - // make sure in same year - if ((t->after(start) || t->equals(start)) && - (t->get(Calendar::YEAR) == iYear)) - { - dateVector.Add(new DateTime(t->getTime())); - } - } - delete t; t = 0; - return FALSE; -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/capiredr.cpp b/mozilla/calendar/modules/core/ical/src/capiredr.cpp deleted file mode 100644 index c94a8b38af4..00000000000 --- a/mozilla/calendar/modules/core/ical/src/capiredr.cpp +++ /dev/null @@ -1,544 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * capiredr.cpp - * John Sun - * 4/16/98 3:42:19 PM - */ - -#include "stdafx.h" -#include "capiredr.h" -#include "nspr.h" -//#include "xp_mcom.h" - -const t_int32 ICalCAPIReader::m_MAXBUFFERSIZE = 1024; -const t_int32 ICalCAPIReader::m_NOMORECHUNKS = 404; -//--------------------------------------------------------------------- - -ICalCAPIReader::ICalCAPIReader() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -void -ICalCAPIReader::AddChunk(UnicodeString * u) -{ - if (m_Chunks == 0) - m_Chunks = new JulianPtrArray(); - PR_ASSERT(m_Chunks != 0); - if (m_Chunks != 0) - { - m_Chunks->Add(u); - } -} - -//--------------------------------------------------------------------- - -ICalCAPIReader::ICalCAPIReader(PRMonitor * monitor, - nsCalUtility::MimeEncoding encoding) -{ - m_Monitor = monitor; - m_bFinished = FALSE; - - m_ChunkIndex = 0; - m_Chunks = 0; - m_Init = TRUE; - m_Pos = 0; - m_Mark = 0; - m_ChunkMark = 0; - m_Encoding = encoding; -} - -//--------------------------------------------------------------------- - -void ICalCAPIReader::deleteUnicodeStringVector(JulianPtrArray * stringVector) -{ - t_int32 i; - if (stringVector != 0) - { - for (i = stringVector->GetSize() - 1; i >= 0; i--) - { - delete ((UnicodeString *) stringVector->GetAt(i)); - } - } -} - -//--------------------------------------------------------------------- - -ICalCAPIReader::~ICalCAPIReader() -{ - if (m_Chunks != 0) - { - deleteUnicodeStringVector(m_Chunks); - delete m_Chunks; m_Chunks = 0; - } - //if (m_Buffer != 0) { delete [] m_Buffer; m_Buffer = 0; } - //PR_Exit(); -} - -//--------------------------------------------------------------------- -/* -void ICalCAPIReader::setBuffer(const char * capiChunk) -{ - if (m_Init) - { - strcpy(m_Buffer, capiChunk); - m_BufferSize = strlen(m_Buffer); - m_Init = FALSE; - } - else - { - strcat(m_Buffer + m_BufferSize, capiChunk); - m_BufferSize += strlen(capiChunk); - } -} -*/ -//--------------------------------------------------------------------- - -t_int8 ICalCAPIReader::read(ErrorCode & status) -{ - t_int32 i = 0; - - while (TRUE) - { - if (m_Chunks == 0 || m_Chunks->GetSize() == 0 || - m_ChunkIndex >= m_Chunks->GetSize()) - { - status = m_NOMORECHUNKS; // no more chunks, should block - return -1; - // block? - } - else - { - // read from linked list of UnicodeString's - // delete front string when finished reading from it - - UnicodeString string = *((UnicodeString *) m_Chunks->GetAt(m_ChunkIndex)); - if (m_Pos < string.size()) - { - // return index of this - status = ZERO_ERROR; - - if (m_Encoding == nsCalUtility::MimeEncoding_QuotedPrintable) - { - if ((string)[(TextOffset) m_Pos] == '=') - { - if (string.size() >= m_Pos + 3) - { - if (ICalReader::isHex(string[(TextOffset)(m_Pos + 1)]) && - ICalReader::isHex(string[(TextOffset)(m_Pos + 2)])) - { - t_int8 c; - c = ICalReader::convertHex(string[(TextOffset) (m_Pos + 1)], - string[(TextOffset) (m_Pos + 2)]); - // replace the contents of string - //string/removeBetween(m_Pos, 3); - //char sBuf[1]; - //sBuf[0] = c; - //string->insert(m_Pos, sBuf); - m_Pos += 3; - //m_Pos++; - return c; - } - else - { - return (t_int8) (string)[(TextOffset) m_Pos++]; - } - } - else - { - t_int32 lenDiff = string.size() - m_Pos; - char fToken; - char sToken; - t_bool bSetFToken = FALSE; - t_int32 tempIndex = m_ChunkIndex; - UnicodeString token; - - while (TRUE) - { - - // lenDiff = 1, 2 always - // the =XX spans different chunks - // if last chunk, return out of chunks status - if (tempIndex == m_Chunks->GetSize() - 1) - { - status = m_NOMORECHUNKS; - return -1; - } - else - { - UnicodeString nextstring = *((UnicodeString *) m_Chunks->GetAt(tempIndex + 1)); - tempIndex++; - - if (nextstring.size() >= 2) - { - t_int8 c; - if (lenDiff == 2) - { - - fToken = string[(TextOffset) (string.size() - 1)]; - sToken = nextstring[(TextOffset) 0]; - - if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken)) - { - c = ICalReader::convertHex(fToken, sToken); - - m_Pos = 1; - m_ChunkIndex = tempIndex; - bSetFToken = FALSE; - return c; - } - else - { - return (t_int8) (string)[(TextOffset) m_Pos++]; - } - } - else - { - // lenDiff = 1 - - if (bSetFToken) - { - sToken = nextstring[(TextOffset) 0]; - } - else - { - fToken = nextstring[(TextOffset) 0]; - sToken = nextstring[(TextOffset) 1]; - } - - if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken)) - { - c = ICalReader::convertHex(fToken, sToken); - - m_Pos = 2; - m_ChunkIndex = tempIndex; - bSetFToken = FALSE; - return c; - } - else - { - return (t_int8) (string)[(TextOffset) m_Pos++]; - } - } - } - else - { - if (nextstring.size() > 0) - { - if (!bSetFToken) - { - fToken = nextstring[(TextOffset) 0]; - bSetFToken = TRUE; - - } - else - { - sToken = nextstring[(TextOffset) 0]; - - if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken)) - { - char c; - c = ICalReader::convertHex(fToken, sToken); - - m_Pos = 1; - m_ChunkIndex = tempIndex; - bSetFToken = FALSE; - return c; - } - else - { - return (t_int8) (string)[(TextOffset) m_Pos++]; - } - } - } - } - } - } - - } - } - else - { - return (t_int8) (string)[(TextOffset) m_Pos++]; - } - - } - else - { - return (t_int8) (string)[(TextOffset) m_Pos++]; - } - } - else - { - // delete front string from list, try reading from next chunk - m_Pos = 0; - m_ChunkIndex++; - - //delete ((UnicodeString *) m_Chunks->GetAt(i)); - //m_Chunks->RemoveAt(i); - } - } - } - status = 1; - return -1; - /* - if (m_BufferSize > 0) - { - if (m_Pos >= m_BufferSize) - { - status = 1; - return -1; - } - else - { - status = ZERO_ERROR; - return m_Buffer[m_Pos++]; - } - } - else - { - status = 2; - return -1; - } - */ -} - -//--------------------------------------------------------------------- -UnicodeString & -ICalCAPIReader::createLine(t_int32 oldPos, t_int32 oldChunkIndex, - t_int32 newPos, t_int32 newChunkIndex, - UnicodeString & aLine) -{ - PR_ASSERT(oldChunkIndex <= newChunkIndex); - UnicodeString u; - if (oldChunkIndex == newChunkIndex) - { - u = *((UnicodeString *) m_Chunks->GetAt(oldChunkIndex)); - u.extractBetween(oldPos, newPos, aLine); - return aLine; - } - else { - //(oldChunkIndex < newChunkIndex) - - t_int32 i; - UnicodeString v, temp; - u = *((UnicodeString *) m_Chunks->GetAt(oldChunkIndex)); - u.extractBetween(oldPos, u.size(), aLine); - v = *((UnicodeString *) m_Chunks->GetAt(newChunkIndex)); - v.extractBetween(0, newPos, temp); - i = oldChunkIndex + 1; - while (i < newChunkIndex) - { - v = *((UnicodeString *) m_Chunks->GetAt(i)); - aLine += v; - i++; - } - aLine += temp; - return aLine; - } -} - -//--------------------------------------------------------------------- - -UnicodeString & -ICalCAPIReader::readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 iTemp) -{ - status = ZERO_ERROR; - t_int32 i; - -#if TESTING_ITIPRIG - if (FALSE) TRACE("ICalCAPIReader: waiting to enter monitor\r\n"); -#endif - - PR_EnterMonitor(m_Monitor); - -#if TESTING_ITIPRIG - if (FALSE) TRACE("ICalCAPIReader: in monitor\r\n"); -#endif - - t_int32 oldpos = m_Pos; - t_int32 oldChunkIndex = m_ChunkIndex; - - readLine(aLine, status); - if (status == m_NOMORECHUNKS) - { - // maybe block on monitor here - //PR_Notify(m_Monitor); -#if CAPI_READY - //PR_Yield(); - if (m_bFinished) - { - // do nothing. - } - else - { -#if TESTING_ITIPRIG - if (FALSE) TRACE("ICalCAPIReader: (1) waiting for writeTOCAPIReader to add more chunks\r\n"); -#endif - PR_Wait(m_Monitor, LL_MAXINT); - //PR_Yield(); - } -#else - return aLine; -#endif - } - UnicodeString aSubLine; - while (TRUE) - { - mark(); - i = read(status); - if (status == m_NOMORECHUNKS) - { - // block()? reset()?; - //PR_Notify(m_Monitor); - //PR_ExitMonitor(m_Monitor); -#if CAPI_READY - if (m_bFinished) - { - // do nothing - break; - } - else - { -#if TESTING_ITIPRIG - if (FALSE) TRACE("ICalCAPIReader: (2) waiting for writeTOCAPIReader to add more chunks\r\n"); -#endif - PR_Wait(m_Monitor, LL_MAXINT); - //PR_Yield(); - } -#else - return aLine; -#endif - } - else if (i == ' ') - { -#if TESTING_ITIPRIG - if (FALSE) TRACE("ICalCAPIReader: recursivecall\r\n"); -#endif - aLine += readLine(aSubLine, status); - //PR_Notify(m_Monitor); - //if (FALSE) TRACE("rfl(2) %s\r\n", aLine.toCString("")); - } - else - { -#if TESTING_ITIPRIG - if (FALSE) TRACE("ICalCAPIReader: reset() break out of loop\r\n"); -#endif - reset(); - break; - } - } -#if TESTING_ITIPRIG - if (FALSE) TRACE("readFullLine returned: ---%s---\r\n", aLine.toCString("")); -#endif -#if TESTING_ITIPRIG - TRACE("ICalCAPIReader: leaving monitor\r\n"); -#endif - PR_ExitMonitor(m_Monitor); - - return aLine; -} - -//--------------------------------------------------------------------- - -UnicodeString & -ICalCAPIReader::readLine(UnicodeString & aLine, ErrorCode & status) -{ - status = ZERO_ERROR; - t_int8 c = 0; - t_int32 oldPos = m_Pos; - t_int32 oldChunkIndex = m_ChunkIndex; - - aLine = ""; - - //PR_EnterMonitor(m_Monitor); - - c = read(status); - while (!(FAILURE(status))) - { - if (status == m_NOMORECHUNKS) - { - // block - break; - } - /* Break on '\n', '\r\n', and '\r' */ - else if (c == '\n') - { - break; - } - else if (c == '\r') - { - mark(); - c = read(status); - if (FAILURE(status)) - { - // block(), reset()? - break; - } - else if (c == '\n') - { - break; - } - else - { - reset(); - break; - } - } -#if 1 - aLine += c; - //if (FALSE) TRACE("aLine = %s: -%c,%d-\r\n", aLine.toCString(""), c, c); -#endif - c = read(status); - - } -#if 0 - createLine(oldPos, oldChunkIndex, m_Pos, m_ChunkIndex, aLine); -#endif - - /* - if (FAILURE(status)) - { - PR_Notify(m_Monitor); - PR_ExitMonitor(m_Monitor); - } - */ - - //if (FALSE) TRACE("\treadLine returned %s\r\n", aLine.toCString("")); - return aLine; - - /* - t_int32 lineSize = m_Pos - oldpos; - char * theLine = new char[lineSize]; - PR_ASSERT(theLine != 0); - strncpy(theLine, m_Buffer + oldpos, lineSize); - aLine = theLine; - return aLine; - */ -} - -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/config.mk b/mozilla/calendar/modules/core/ical/src/config.mk deleted file mode 100644 index bc61d195a55..00000000000 --- a/mozilla/calendar/modules/core/ical/src/config.mk +++ /dev/null @@ -1,35 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CAL_CORE_ICAL -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include -I$(GDEPTH)/htmlparser/src - -ifeq ($(OS_ARCH), WINNT) -CFLAGS += /Zm1000 -endif - -LD_LIBS += \ - raptorbase \ - raptorhtmlpars \ - xpcom$(MOZ_BITS) \ - $(NATIVE_RAPTOR_WIDGET) \ - calcapi10 \ - util10 \ - xpcom$(MOZ_BITS) \ - $(NATIVE_LIBNLS_LIBS) \ - $(XP_REG_LIB) - - -EXTRA_LIBS += $(NSPR_LIBS) diff --git a/mozilla/calendar/modules/core/ical/src/dategntr.cpp b/mozilla/calendar/modules/core/ical/src/dategntr.cpp deleted file mode 100644 index f72f9796356..00000000000 --- a/mozilla/calendar/modules/core/ical/src/dategntr.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// dategntr.cpp -// John Sun -// 12:30 PM February 4 1998 - - -#include "stdafx.h" -#include "jdefines.h" -#include - -//#include -#include "dategntr.h" -//#include "calendar.h" - -//--------------------------------------------------------------------- - -DateGenerator::DateGenerator() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -DateGenerator::DateGenerator(t_int32 span, t_int32 paramsLen) -: m_iSpan(span), m_iParamsLen(paramsLen) -{ -} - -//--------------------------------------------------------------------- diff --git a/mozilla/calendar/modules/core/ical/src/deftgntr.cpp b/mozilla/calendar/modules/core/ical/src/deftgntr.cpp deleted file mode 100644 index c342cb965fd..00000000000 --- a/mozilla/calendar/modules/core/ical/src/deftgntr.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// deftgntr.cpp -// John Sun -// 4:01 PM Febrary 3 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "deftgntr.h" -#include "jutility.h" -#include "duration.h" - -//t_int32 DefaultGenerator::m_iParamsLen = 3; - -DefaultGenerator::DefaultGenerator() -: DateGenerator(nsCalUtility::RT_MONTHLY, 3), - isActive(FALSE) -{} - -//--------------------------------------------------------------------- - -t_int32 -DefaultGenerator::getInterval() const { return nsCalUtility::RT_MONTHLY; } - -//--------------------------------------------------------------------- - -t_bool -DefaultGenerator::generate(DateTime * start, JulianPtrArray & dateVector, - DateTime * until) -{ - t_int32 i; - DateTime * t; - nsCalDuration * d; - - PR_ASSERT(start != 0); - PR_ASSERT(m_aiParams != 0); - - if (start == 0 || m_aiParams == 0) - { - return FALSE; - } - - t = new DateTime(start->getTime()); PR_ASSERT(t != 0); - d = new nsCalDuration(m_aiParams[0], m_aiParams[1]); PR_ASSERT(d != 0); - - dateVector.Add(new DateTime(t->getTime())); - - for (i = 0; i < m_aiParams[2] - 1; i++) - { - t->add(*d); - if (until != 0 && until->isValid() && t->after(until)) - { - //t = NULL; - delete t; t = 0;// replaced above line - delete d; d = 0; - return TRUE; - } - dateVector.Add(new DateTime(t->getTime())); - } - delete t; t = 0; - delete d; d = 0; - return FALSE; -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/dprprty.cpp b/mozilla/calendar/modules/core/ical/src/dprprty.cpp deleted file mode 100644 index 00078d1027c..00000000000 --- a/mozilla/calendar/modules/core/ical/src/dprprty.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// dprprty.cpp -// John Sun -// 3:15 PM February 12 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "dprprty.h" -#include "datetime.h" -#include "prprty.h" -#include "keyword.h" - -//--------------------------------------------------------------------- -// private never use - -DateTimeProperty::DateTimeProperty(): -m_DateTime(-1) -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -DateTimeProperty::DateTimeProperty(const DateTimeProperty & that) -{ - setParameters(that.m_vParameters); - m_DateTime = that.m_DateTime; -} - -//--------------------------------------------------------------------- - -DateTimeProperty::DateTimeProperty(DateTime value, JulianPtrArray * parameters) -: StandardProperty(parameters) -{ - //PR_ASSERT(value != 0); - //m_string = *((UnicodeString *) value); - m_DateTime = value; -} -//--------------------------------------------------------------------- - -DateTimeProperty::~DateTimeProperty() -{ - //delete m_DateTime; - //deleteICalParameterVector(m_vParameters); - //delete m_vParameters; m_vParameters = 0; -} - -//--------------------------------------------------------------------- - -void * DateTimeProperty::getValue() const -{ - return (void *) &m_DateTime; -} - -//--------------------------------------------------------------------- - -void DateTimeProperty::setValue(void * value) -{ - PR_ASSERT(value != 0); - if (value != 0) - { - m_DateTime = *((DateTime *) value); - } -} - -//--------------------------------------------------------------------- - -ICalProperty * DateTimeProperty::clone(JLog * initLog) -{ - if (initLog) {} // NOTE: Remove later to avoid warnings - return new DateTimeProperty(*this); -} - -//--------------------------------------------------------------------- - -t_bool DateTimeProperty::isValid() -{ - //if (m_DateTime == 0) - // return FALSE; - //return m_DateTime->isValid(); - return m_DateTime.isValid(); -} - -//--------------------------------------------------------------------- - -UnicodeString & DateTimeProperty::toString(UnicodeString & out) -{ - - //PR_ASSERT(m_DateTime != 0); - - //if (m_DateTime->isValid() - out = m_DateTime.toString(); - //else - // out = "NULL"; - return out; -} -//--------------------------------------------------------------------- - -UnicodeString & -DateTimeProperty::toString(UnicodeString & dateFmt, UnicodeString & out) -{ - out = m_DateTime.strftime(dateFmt); - if (out.size() > 0) - return out; - else - return toString(out); -} - -//--------------------------------------------------------------------- - -UnicodeString & DateTimeProperty::toExportString(UnicodeString & out) -{ - //PR_ASSERT(m_DateTime != 0); - out = m_DateTime.toISO8601(); - return out; -} -//--------------------------------------------------------------------- - -UnicodeString & -DateTimeProperty::toICALString(UnicodeString & out) -{ - UnicodeString name; - return toICALString(name, out); -} - -//--------------------------------------------------------------------- - -UnicodeString & -DateTimeProperty::toICALString(UnicodeString & sProp, - UnicodeString & out) -{ - ICalParameter * aName; - UnicodeString sVal; - sVal = toExportString(sVal); - - out = ""; - t_int32 size = 0; - t_int32 i; - - if (m_vParameters != 0) - size = m_vParameters->GetSize(); - if (sVal.size() > 0) - { - UnicodeString u; - out = sProp; - for (i = 0; i < size; i++) - { - aName = (ICalParameter *) m_vParameters->GetAt(i); - u = aName->getParameterName(u); - - // don't print the TZID and VALUE parameters - // thus it will only print in Z time and VALUE assumed to be DATETIME - if ((u.compareIgnoreCase(nsCalKeyword::Instance()->ms_sTZID) != 0) && - (u.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVALUE) != 0)) - out += aName->toICALString(u); - - } - out += ':'; out += sVal; out += nsCalKeyword::Instance()->ms_sLINEBREAK; - } - //if (FALSE) TRACE("out = %s\r\n", out.toCString("")); - return out; -} - -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/duprprty.cpp b/mozilla/calendar/modules/core/ical/src/duprprty.cpp deleted file mode 100644 index e3b9435b0c2..00000000000 --- a/mozilla/calendar/modules/core/ical/src/duprprty.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// duprprty.cpp -// John Sun -// 3:15 PM February 12 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "duprprty.h" -#include "duration.h" -#include "prprty.h" - -//--------------------------------------------------------------------- - -// private never use -DurationProperty::DurationProperty() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -DurationProperty::DurationProperty(const DurationProperty & that) -{ - setParameters(that.m_vParameters); - m_Duration = that.m_Duration; -} - -//--------------------------------------------------------------------- - -DurationProperty::DurationProperty(nsCalDuration value, JulianPtrArray * parameters) -: StandardProperty(parameters) -{ - //PR_ASSERT(value != 0); - //m_string = *((UnicodeString *) value); - m_Duration = value; -} -//--------------------------------------------------------------------- - -DurationProperty::~DurationProperty() -{ - //delete m_Duration; - //deleteICalParameterVector(m_vParameters); - //delete m_vParameters; m_vParameters = 0; -} - -//--------------------------------------------------------------------- - -void * DurationProperty::getValue() const -{ - return (void *) &m_Duration; -} - -//--------------------------------------------------------------------- - -void DurationProperty::setValue(void * value) -{ - PR_ASSERT(value != 0); - if (value != 0) - { - m_Duration = *((nsCalDuration *) value); - } -} - -//--------------------------------------------------------------------- - -ICalProperty * DurationProperty::clone(JLog * initLog) -{ - if (initLog) {} // NOTE: Remove later to avoid warnings - return new DurationProperty(*this); -} - -//--------------------------------------------------------------------- - -t_bool DurationProperty::isValid() -{ - //if (m_Duration == 0) - // return FALSE; - //return m_Duration->isValid(); - return m_Duration.isValid(); -} - -//--------------------------------------------------------------------- - -UnicodeString & DurationProperty::toString(UnicodeString & out) -{ - - //PR_ASSERT(m_Duration != 0); - - //if (m_Duration->isValid() - out = m_Duration.toString(); - //else - // out = "NULL"; - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -DurationProperty::toString(UnicodeString & dateFmt, UnicodeString & out) -{ - // NOTE: remove it later, gets rid of compiler warning - if (dateFmt.size() > 0) {} - return toString(out); -} -//--------------------------------------------------------------------- - -UnicodeString & DurationProperty::toExportString(UnicodeString & out) -{ - //PR_ASSERT(m_Duration != 0); - out = m_Duration.toICALString(); - return out; -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/freebusy.cpp b/mozilla/calendar/modules/core/ical/src/freebusy.cpp deleted file mode 100644 index dcf7dea77eb..00000000000 --- a/mozilla/calendar/modules/core/ical/src/freebusy.cpp +++ /dev/null @@ -1,761 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// freebusy.cpp -// John Sun -// 6:35 PM Febuary 18 1998 - -#include "stdafx.h" -#include "jdefines.h" -#include "freebusy.h" -#include "icalcomp.h" -#include "unistrto.h" -#include "jlog.h" -#include "jutility.h" -#include "keyword.h" -//--------------------------------------------------------------------- -const t_int32 Freebusy::ms_cFreebusyType = 'T'; -const t_int32 Freebusy::ms_cFreebusyPeriod = 'P'; -const t_int32 Freebusy::ms_iDEFAULT_TYPE= FB_TYPE_BUSY; - -#if 0 -const t_int32 Freebusy::ms_cFreebusyStatus = 'S'; -const t_int32 Freebusy::ms_iDEFAULT_STATUS= FB_STATUS_BUSY; -#endif - -//UnicodeString Freebusy::m_strDefaultFmt = "\tTYPE= ^T STATUS = ^S ^P\r\n"; -//const UnicodeString Freebusy::nsCalKeyword::Instance()->ms_sDEFAULT_TYPE = nsCalKeyword::Instance()->ms_sBUSY; -//const UnicodeString Freebusy::nsCalKeyword::Instance()->ms_sDEFAULT_STATUS = nsCalKeyword::Instance()->ms_sBUSY; -//static UnicodeString s_sComma = nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL; - -//--------------------------------------------------------------------- - -Freebusy::FB_TYPE -Freebusy::stringToType(UnicodeString & sType) -{ - t_int32 hashCode = sType.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_BUSY == hashCode) return FB_TYPE_BUSY; - else if (nsCalKeyword::Instance()->ms_ATOM_FREE == hashCode) return FB_TYPE_FREE; - // added 4-28-98 - else if (nsCalKeyword::Instance()->ms_ATOM_BUSY_UNAVAILABLE == hashCode) - return FB_TYPE_BUSY_UNAVAILABLE; - else if (nsCalKeyword::Instance()->ms_ATOM_BUSY_TENTATIVE == hashCode) - return FB_TYPE_BUSY_TENTATIVE; - else if (ICalProperty::IsXToken(sType)) - return FB_TYPE_XPARAMVAL; - else return FB_TYPE_INVALID; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Freebusy::typeToString(Freebusy::FB_TYPE type, UnicodeString & out) -{ - switch(type) - { - case FB_TYPE_BUSY: out = nsCalKeyword::Instance()->ms_sBUSY; break; - case FB_TYPE_FREE: out = nsCalKeyword::Instance()->ms_sFREE; break; - // added 4-28-98 - case FB_TYPE_BUSY_UNAVAILABLE: out = nsCalKeyword::Instance()->ms_sBUSY_UNAVAILABLE; break; - case FB_TYPE_BUSY_TENTATIVE: out = nsCalKeyword::Instance()->ms_sBUSY_TENTATIVE; break; - case FB_TYPE_XPARAMVAL: out = nsCalKeyword::Instance()->ms_sXPARAMVAL; break; - default: - // return default BUSY - out = nsCalKeyword::Instance()->ms_sBUSY; - break; - } - return out; -} - -//--------------------------------------------------------------------- -#if 0 -Freebusy::FB_STATUS -Freebusy::stringToStatus(UnicodeString & sStatus) -{ - t_int32 hashCode = sStatus.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_BUSY == hashCode) return FB_STATUS_BUSY; - else if (nsCalKeyword::Instance()->ms_ATOM_UNAVAILABLE == hashCode) return FB_STATUS_UNAVAILABLE; - else if (nsCalKeyword::Instance()->ms_ATOM_TENTATIVE == hashCode) return FB_STATUS_TENTATIVE; - else return FB_STATUS_INVALID; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Freebusy::statusToString(Freebusy::FB_STATUS status, UnicodeString & out) -{ - switch(status) - { - case FB_STATUS_BUSY: out = nsCalKeyword::Instance()->ms_sBUSY; break; - case FB_STATUS_UNAVAILABLE: out = nsCalKeyword::Instance()->ms_sUNAVAILABLE; break; - case FB_STATUS_TENTATIVE: out = nsCalKeyword::Instance()->ms_sTENTATIVE; break; - default: - // return default BUSY - out = nsCalKeyword::Instance()->ms_sBUSY; - break; - } - return out; -} -#endif -//--------------------------------------------------------------------- -// TODO: Finish -void Freebusy::parsePeriod(UnicodeString & s, JulianPtrArray * vTimeZones) -{ - UnicodeStringTokenizer * stMult; - //UnicodeString delim = ","; - UnicodeString sPeriod; - //UnicodeString sPeriodStart; - //UnicodeString sPeriodEnd; - Period * p; - ErrorCode status = ZERO_ERROR; - - if (vTimeZones) - { - } - stMult = new UnicodeStringTokenizer(s, - nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL); - PR_ASSERT(stMult != 0); - if (stMult != 0) - { - while (stMult->hasMoreTokens()) - { - sPeriod = stMult->nextToken(sPeriod, status); - sPeriod.trim(); - //if (FALSE) TRACE("sPeriod = %s\r\n", sPeriod.toCString("")); - // TODO: check that period start/end always uses UTC - - p = new Period(sPeriod); - PR_ASSERT(p != 0); - if (p != 0) - { - if (!p->isValid()) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iFreebusyPeriodInvalid, - nsCalKeyword::Instance()->ms_sFREEBUSY, sPeriod, 200); - } - else - { - //sPeriodStart = Period::getStartTimeString(sPeriod, sPeriodStart); - //sPeriodEnd = Period::getEndTimeString(sPeriod, sPeriodEnd); - addPeriod(p); - } - delete p; p = 0; - } - } - delete stMult; stMult = 0; - } -} -//--------------------------------------------------------------------- -void Freebusy::setParam(UnicodeString & paramName, UnicodeString & paramVal) -{ - t_int32 i; - if (paramName.size() == 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName, - nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 200); - } - else - { - t_int32 hashCode = paramName.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_FBTYPE == hashCode) - { - i = Freebusy::stringToType(paramVal); - if (i < 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue, - nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, paramVal, 200); - } - else - { - if (getType() >= 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 100); - } - setType((Freebusy::FB_TYPE) i); - } - - } -#if 0 - else if (nsCalKeyword::Instance()->ms_ATOM_BSTAT == hashCode) - { - i = Freebusy::stringToStatus(paramVal); - if (i < 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue, - nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, paramVal, 200); - } - else - { - if (getStatus() >= 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 100); - } - setStatus((Freebusy::FB_STATUS) i); - } - } -#endif - else if (ICalProperty::IsXToken(paramName)) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iXTokenParamIgnored, - nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 100); - } - else - { - // NOTE: what about optional parameters?? THERE ARE NONE. - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName, - nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 200); - } - } -} -//--------------------------------------------------------------------- -void Freebusy::selfCheck() -{ - if (getType() < 0 || getType() > FB_TYPE_LENGTH) - setDefaultProps(FB_PROPS_TYPE); -#if 0 - else if (getStatus() < 0 || getStatus() > FB_STATUS_LENGTH) - setDefaultProps(FB_PROPS_STATUS); -#endif - // NOTE: selfcheck each period???, no need since addPeriod auto checks?? -} -//--------------------------------------------------------------------- -void Freebusy::setDefaultProps(Freebusy::FB_PROPS prop) -{ - switch (prop) - { - case FB_PROPS_TYPE: setType((Freebusy::FB_TYPE) ms_iDEFAULT_TYPE); return; -#if 0 - case FB_PROPS_STATUS: setStatus((Freebusy::FB_STATUS) ms_iDEFAULT_STATUS); return; -#endif - default: return; - } -} -//--------------------------------------------------------------------- -void Freebusy::sortPeriods() -{ - if (m_vPeriod != 0) - m_vPeriod->QuickSort(Period::ComparePeriods); -} -//--------------------------------------------------------------------- -void Freebusy::sortPeriodsByEndTime() -{ - if (m_vPeriod != 0) - m_vPeriod->QuickSort(Period::ComparePeriodsByEndTime); -} -//--------------------------------------------------------------------- - -// private never use -#if 0 -Freebusy::Freebusy() -{ - PR_ASSERT(FALSE); -} -#endif - -//--------------------------------------------------------------------- - -Freebusy::Freebusy(JLog * initLog) -: m_Type(ms_iDEFAULT_TYPE), -#if 0 - m_Status(ms_iDEFAULT_STATUS), -#endif - m_vPeriod(0), m_Log(initLog) -{ - //PR_ASSERT(initLog != 0); -} - -//--------------------------------------------------------------------- -Freebusy::Freebusy(Freebusy & that) -: m_vPeriod(0) -{ - t_int32 i; - - m_Type = that.m_Type; -#if 0 - m_Status = that.m_Status; -#endif - if (that.m_vPeriod != 0) - { - m_vPeriod = new JulianPtrArray(); - PR_ASSERT(m_vPeriod != 0); - if (m_vPeriod != 0) - { - for (i = 0; i < that.m_vPeriod->GetSize(); i++) - { - Period * p = (Period *) (that.m_vPeriod->GetAt(i)); - PR_ASSERT(p != 0); - if (p != 0) - { - addPeriod(p); - } - } - } - } -} -//--------------------------------------------------------------------- -Freebusy::~Freebusy() -{ - if (m_vPeriod != 0) - { - ICalProperty::deletePeriodVector(m_vPeriod); - delete m_vPeriod; m_vPeriod = 0; - } -} - -//--------------------------------------------------------------------- -ICalProperty * -Freebusy::clone(JLog * initLog) -{ - m_Log = initLog; - //PR_ASSERT(m_Log != 0); - return new Freebusy(*this); -} -//--------------------------------------------------------------------- - -void Freebusy::addPeriod(Period * p) -{ - PR_ASSERT(p != 0); - if (m_vPeriod == 0) - m_vPeriod = new JulianPtrArray(); - PR_ASSERT(m_vPeriod != 0); - if (m_vPeriod != 0 && p != 0) - { - m_vPeriod->Add(new Period(*p)); - } -} - -//--------------------------------------------------------------------- -DateTime Freebusy::startOfFreebusyPeriod() -{ - t_int32 i; - DateTime d(-1); - if (m_vPeriod != 0) - { - i = m_vPeriod->GetSize(); - - if (i > 0) - { - sortPeriods(); - Period * p = (Period *) m_vPeriod->GetAt(0); - d = p->getStart(); - return d; - } - else - { - // NOTE: No periods in vector, so returning invalid datetime - return d; - } - } - else - { - // NOTE: No periods in vector, so returning invalid datetime - return d; - } -} -//--------------------------------------------------------------------- -DateTime Freebusy::endOfFreebusyPeriod() -{ - t_int32 i; - DateTime d(-1); - nsCalDuration du(-1, -1, -1, -1, -1, -1, -1); - if (m_vPeriod != 0) - { - i = m_vPeriod->GetSize(); - if (i > 0) - { - sortPeriodsByEndTime(); - Period * p = (Period *) m_vPeriod->GetAt(i - 1); - if (p->getEnd().isValid()) - { - d = p->getEnd(); - return d; - } - else - { - d = p->getStart(); - du = p->getDuration(); - d.add(du); - return d; - } - //return p->getEndingTime(d); - } - else - { - // NOTE: No periods in vector, so returning invalid datetime - return d; - } - } - else - { - // NOTE: No periods in vector, so returning invalid datetime - return d; - } -} -//--------------------------------------------------------------------- -void Freebusy::parse(UnicodeString & in) -{ - UnicodeString propName; - UnicodeString propVal; - JulianPtrArray * parameters = new JulianPtrArray(); - PR_ASSERT(parameters != 0); - if (parameters != 0) - { - ICalProperty::parsePropertyLine(in, propName, propVal, parameters); - - parse(propVal, parameters); - - ICalProperty::deleteICalParameterVector(parameters); - delete parameters; parameters = 0; - } -} -//--------------------------------------------------------------------- -void Freebusy::parse(UnicodeString & sPeriods, JulianPtrArray * parameters, - JulianPtrArray * vTimeZones) -{ - t_int32 i; - ICalParameter * ip; - UnicodeString pName; - UnicodeString pVal; - if (sPeriods.size() == 0) - { - } - else - { - parsePeriod(sPeriods, vTimeZones); - if (parameters != 0) - { - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - setParam(ip->getParameterName(pName), ip->getParameterValue(pVal)); - } - } - } - - sortPeriods(); - selfCheck(); -} -//--------------------------------------------------------------------- -void Freebusy::normalizePeriods() -{ - sortPeriodsByEndTime(); - t_int32 size = 0; - t_int32 i; - Period * p1; - Period * p2; - Period * pUnion; - - if (m_vPeriod != 0) - { - size = m_vPeriod->GetSize(); - for (i = size -1; i >= 0; i--) - { - p1 = (Period *) m_vPeriod->GetAt(i); PR_ASSERT(p1 != 0); - if (i - 1 >= 0) - { - p2 = (Period *) m_vPeriod->GetAt(i - 1); PR_ASSERT(p2 != 0); - if (Period::IsConnectedPeriods(*p1, *p2)) - { - pUnion = new Period(); PR_ASSERT(pUnion != 0); - if (pUnion != 0) - { - Period::Union(*p1, *p2, *pUnion); - delete p1; p1 = 0; - m_vPeriod->RemoveAt(i); // remove p1 - delete p2; p2 = 0; - m_vPeriod->RemoveAt(i - 1); // remove p2 - //removePeriod(p1); p1 = 0; - //removePeriod(p2); p2 = 0; - m_vPeriod->InsertAt(i -1, pUnion); - } - } - } - } - } -} - -//--------------------------------------------------------------------- - -t_bool Freebusy::isValid() -{ - if (m_vPeriod == 0 || m_vPeriod->GetSize() == 0) - return FALSE; - return TRUE; -} - -//--------------------------------------------------------------------- - -UnicodeString & Freebusy::toString(UnicodeString & out) -{ - out = toString(nsCalFormatString::Instance()->ms_FreebusyStrDefaultFmt, out); - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Freebusy::toString(UnicodeString & strFmt, UnicodeString & out) -{ - if (strFmt.size() == 0 && nsCalFormatString::Instance()->ms_FreebusyStrDefaultFmt.size() > 0) - { - // if empty string, use default - return toString(out); - } - - UnicodeString into; - t_int32 i,j; - //char * c = strFmt.toCString(""); - out = ""; - for ( i = 0; i < strFmt.size(); ) - { - - // NOTE: changed from % to ^ for freebusy - /// - /// If there's a special formatting character, - /// handle it. Otherwise, just emit the supplied - /// character. - /// - into = ""; - j = strFmt.indexOf('^', i); - if ( -1 != j) - { - if (j > i) - { - out += strFmt.extractBetween(i,j,into); - } - i = j + 1; - if (strFmt.size() > i) - { - out += toStringChar(strFmt[(TextOffset) i], into); - i++; - } - } - else - { - out += strFmt.extractBetween(i, strFmt.size(),into); - break; - } - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Freebusy::toStringChar(t_int32 c, UnicodeString & out) -{ - switch ( c ) - { - case ms_cFreebusyType: - return typeToString(getType(), out); -#if 0 - case ms_cFreebusyStatus: - return statusToString(getStatus(), out); -#endif - case ms_cFreebusyPeriod: - if (m_vPeriod != 0) - { - Period * p; - t_int32 i; - for (i = 0; i < m_vPeriod->GetSize(); i++) - { - p = (Period *) m_vPeriod->GetAt(i); - if (i < m_vPeriod->GetSize() -1) - { - out += p->toString(); - out += ','; - } - else - out += p->toString(); - } - } - return out; - default: - return out; - } -}// end of -//--------------------------------------------------------------------- - -UnicodeString & -Freebusy::toICALString(UnicodeString & sProp, UnicodeString & out) -{ - // NOTE: Remove later, to avoid warning - if (sProp.size() > 0) {} - return toICALString(out); -} - -//--------------------------------------------------------------------- -UnicodeString & Freebusy::toICALString(UnicodeString & out) -{ - UnicodeString s, u; - t_int32 i; - - out = nsCalKeyword::Instance()->ms_sFREEBUSY; - s = typeToString(getType(), s); - out += ICalProperty::parameterToCalString(nsCalKeyword::Instance()->ms_sFBTYPE, s, u); -#if 0 - s = statusToString(getStatus(), s); - out += ICalProperty::parameterToCalString(nsCalKeyword::Instance()->ms_sBSTAT, s, u); -#endif - out += ":"; - if (m_vPeriod != 0) - { - for (i = 0; i < m_vPeriod->GetSize(); i++) - { - Period * p = (Period *) m_vPeriod->GetAt(i); - - if (i < m_vPeriod->GetSize() -1) - { - out += p->toICALString(); - out += nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL; - } - else - out += p->toICALString(); - } - } - out += nsCalKeyword::Instance()->ms_sLINEBREAK; - out = ICalProperty::multiLineFormat(out); - return out; -} -//--------------------------------------------------------------------- -void Freebusy::setParameters(JulianPtrArray * parameters) -{ - t_int32 i; - ICalParameter * ip; - UnicodeString pName; - UnicodeString pVal; - if (parameters != 0) - { - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - setParam(ip->getParameterName(pName), ip->getParameterValue(pVal)); - } - } -} -//--------------------------------------------------------------------- -// NOTE: assumes normalized periods -// TODO: verify it works -/* -t_bool Freebusy::IsInside(DateTime start, DateTime end) -{ - PR_ASSERT(m_vPeriod != 0); - t_int32 i; - Period * p; - if (m_vPeriod != 0) - { - for (i = 0; i < m_vPeriod->GetSize(); i++) - { - p = (Period *) m_vPeriod->GetAt(i); - if (!p->isInside(start, end)) - return FALSE; - } - } - return TRUE; -} -*/ -//--------------------------------------------------------------------- -// TODO: update method -//void update() -//--------------------------------------------------------------------- -// TODO: verify it works -/* -void Freebusy::clipOutOfBounds(DateTime start, DateTime end) -{ - PR_ASSERT(!start.afterDateTime(end)); - Period * p; - Period * pShrunk; - t_int32 i; - - if (m_vPeriod != 0) - { - for (i = m_vPeriod->GetSize() - 1; i >= 0; i--) - { - p = (Period *) m_vPeriod->GetAt(i); - if (!p->isInside(start, end)) - { - if (p->isIntersecting(start, end)) - { - pShrunk = new Period(); PR_ASSERT(pShrunk != 0); - Period::Intersection(*p, start, end, *pShrunk); - addPeriod(pShrunk); - } - removePeriod(p); p = 0; - } - } - } -} -*/ -//--------------------------------------------------------------------- -int Freebusy::CompareFreebusy(const void * a, const void * b) -{ - Freebusy * fa = *(Freebusy **) a; - Freebusy * fb = *(Freebusy **) b; - - PR_ASSERT(fa->isValid() && fb->isValid()); - Period * pA = (Period *) fa->getPeriod()->GetAt(0); - Period * pB = (Period *) fb->getPeriod()->GetAt(0); - return Period::ComparePeriods(&pA, &pB); -} -//--------------------------------------------------------------------- - -t_bool -Freebusy::HasSameParams(Freebusy * f1, Freebusy * f2) -{ - PR_ASSERT(f1 != 0 && f2 != 0); - if (f1 == 0 || f2 == 0) - { - // BOTH null returns FALSE - return FALSE; - } -#if 0 - return ((f1->getType() == f2->getType()) && - (f1->getStatus() == f2->getStatus())); -#else - return (f1->getType() == f2->getType()); -#endif -} - -//--------------------------------------------------------------------- - -void -Freebusy::addAllPeriods(JulianPtrArray * periods) -{ - Period * p; - t_int32 i; - if (periods != 0) - { - for (i = 0; i < periods->GetSize(); i++) - { - p = (Period *) periods->GetAt(i); - addPeriod(p); - } - } -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/functbl.cpp b/mozilla/calendar/modules/core/ical/src/functbl.cpp deleted file mode 100644 index 98d7e9248c6..00000000000 --- a/mozilla/calendar/modules/core/ical/src/functbl.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * functbl.cpp - * John Sun - * 7/27/98 1:59:53 PM - */ - -#include "stdafx.h" -#include "jdefines.h" - -#include "keyword.h" -#include "functbl.h" -#include "valarm.h" - -//--------------------------------------------------------------------- - -JulianFunctionTable * JulianFunctionTable::m_Instance = 0; - -//--------------------------------------------------------------------- - -JulianFunctionTable::JulianFunctionTable() -{ - - alarmStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_ACTION.hashCode(), &VAlarm::storeAction); - alarmStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_ACTION.hashCode(), &VAlarm::storeAction); - alarmStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_ATTACH.hashCode(), &VAlarm::storeAttach); - alarmStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_ATTENDEE.hashCode(), &VAlarm::storeAttendee); - alarmStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_DESCRIPTION.hashCode(), &VAlarm::storeDescription); - alarmStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_DURATION.hashCode(), &VAlarm::storeDuration); - alarmStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_REPEAT.hashCode(), &VAlarm::storeRepeat); - alarmStoreTable[7].set(nsCalKeyword::Instance()->ms_ATOM_SUMMARY.hashCode(), &VAlarm::storeSummary); - alarmStoreTable[8].set(nsCalKeyword::Instance()->ms_ATOM_TRIGGER.hashCode(), &VAlarm::storeTrigger); - alarmStoreTable[9].set(0,0); - - tbeStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_ATTACH.hashCode(), &TimeBasedEvent::storeAttach); - tbeStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_ATTENDEE.hashCode(), &TimeBasedEvent::storeAttendees); - tbeStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_CATEGORIES.hashCode(), &TimeBasedEvent::storeCategories); - tbeStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_CLASS.hashCode(), &TimeBasedEvent::storeClass); - tbeStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_COMMENT.hashCode(), &TimeBasedEvent::storeComment); - tbeStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_CONTACT.hashCode(), &TimeBasedEvent::storeContact); - tbeStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_CREATED.hashCode(), &TimeBasedEvent::storeCreated); - tbeStoreTable[7].set(nsCalKeyword::Instance()->ms_ATOM_DESCRIPTION.hashCode(), &TimeBasedEvent::storeDescription); - tbeStoreTable[8].set(nsCalKeyword::Instance()->ms_ATOM_DTSTART.hashCode(), &TimeBasedEvent::storeDTStart); - tbeStoreTable[9].set(nsCalKeyword::Instance()->ms_ATOM_DTSTAMP.hashCode(), &TimeBasedEvent::storeDTStamp); - tbeStoreTable[10].set(nsCalKeyword::Instance()->ms_ATOM_EXDATE.hashCode(), &TimeBasedEvent::storeExDate); - tbeStoreTable[11].set(nsCalKeyword::Instance()->ms_ATOM_EXRULE.hashCode(), &TimeBasedEvent::storeExRule); - tbeStoreTable[12].set(nsCalKeyword::Instance()->ms_ATOM_LASTMODIFIED.hashCode(), &TimeBasedEvent::storeLastModified); - tbeStoreTable[13].set(nsCalKeyword::Instance()->ms_ATOM_ORGANIZER.hashCode(), &TimeBasedEvent::storeOrganizer); - tbeStoreTable[14].set(nsCalKeyword::Instance()->ms_ATOM_RDATE.hashCode(), &TimeBasedEvent::storeRDate); - tbeStoreTable[15].set(nsCalKeyword::Instance()->ms_ATOM_RRULE.hashCode(), &TimeBasedEvent::storeRRule); - tbeStoreTable[16].set(nsCalKeyword::Instance()->ms_ATOM_RECURRENCEID.hashCode(), &TimeBasedEvent::storeRecurrenceID); - tbeStoreTable[17].set(nsCalKeyword::Instance()->ms_ATOM_RELATEDTO.hashCode(), &TimeBasedEvent::storeRelatedTo); - tbeStoreTable[18].set(nsCalKeyword::Instance()->ms_ATOM_REQUESTSTATUS.hashCode(), &TimeBasedEvent::storeRequestStatus); - tbeStoreTable[19].set(nsCalKeyword::Instance()->ms_ATOM_SEQUENCE.hashCode(), &TimeBasedEvent::storeSequence); - tbeStoreTable[20].set(nsCalKeyword::Instance()->ms_ATOM_STATUS.hashCode(), &TimeBasedEvent::storeStatus); - tbeStoreTable[21].set(nsCalKeyword::Instance()->ms_ATOM_SUMMARY.hashCode(), &TimeBasedEvent::storeSummary); - tbeStoreTable[22].set(nsCalKeyword::Instance()->ms_ATOM_UID.hashCode(), &TimeBasedEvent::storeUID); - tbeStoreTable[23].set(nsCalKeyword::Instance()->ms_ATOM_URL.hashCode(), &TimeBasedEvent::storeURL); - tbeStoreTable[24].set(0,0); - - tzStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_COMMENT.hashCode(), &TZPart::storeComment); - tzStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_DTSTART.hashCode(), &TZPart::storeDTStart); - tzStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_RDATE.hashCode(), &TZPart::storeRDate); - tzStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_RRULE.hashCode(), &TZPart::storeRRule); - tzStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_TZNAME.hashCode(), &TZPart::storeTZName); - tzStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_TZOFFSETTO.hashCode(), &TZPart::storeTZOffsetTo); - tzStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_TZOFFSETFROM.hashCode(), &TZPart::storeTZOffsetFrom); - tzStoreTable[7].set(0,0); - - veStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_DTEND.hashCode(), &VEvent::storeDTEnd); - veStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_DURATION.hashCode(), &VEvent::storeDuration); - veStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_GEO.hashCode(), &VEvent::storeGEO); - veStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_LOCATION.hashCode(), &VEvent::storeLocation); - veStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_PRIORITY.hashCode(), &VEvent::storePriority); - veStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_RESOURCES.hashCode(), &VEvent::storeResources); - veStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_TRANSP.hashCode(), &VEvent::storeTransp); - veStoreTable[7].set(0,0); - - vfStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_ATTENDEE.hashCode(), &VFreebusy::storeAttendees); - vfStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_COMMENT.hashCode(), &VFreebusy::storeComment); - vfStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_CONTACT.hashCode(), &VFreebusy::storeContact); - /*vfStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_CREATED.hashCode(), &VFreebusy::storeCreated);*/ - vfStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_DURATION.hashCode(), &VFreebusy::storeDuration); - vfStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_DTEND.hashCode(), &VFreebusy::storeDTEnd); - vfStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_DTSTART.hashCode(), &VFreebusy::storeDTStart); - vfStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_DTSTAMP.hashCode(), &VFreebusy::storeDTStamp); - vfStoreTable[7].set(nsCalKeyword::Instance()->ms_ATOM_FREEBUSY.hashCode(), &VFreebusy::storeFreebusy); - vfStoreTable[8].set(nsCalKeyword::Instance()->ms_ATOM_LASTMODIFIED.hashCode(), &VFreebusy::storeLastModified); - vfStoreTable[9].set(nsCalKeyword::Instance()->ms_ATOM_ORGANIZER.hashCode(), &VFreebusy::storeOrganizer); - vfStoreTable[10].set(nsCalKeyword::Instance()->ms_ATOM_REQUESTSTATUS.hashCode(), &VFreebusy::storeRequestStatus); - vfStoreTable[11].set(nsCalKeyword::Instance()->ms_ATOM_SEQUENCE.hashCode(), &VFreebusy::storeSequence); - vfStoreTable[12].set(nsCalKeyword::Instance()->ms_ATOM_UID.hashCode(), &VFreebusy::storeUID); - vfStoreTable[13].set(nsCalKeyword::Instance()->ms_ATOM_URL.hashCode(), &VFreebusy::storeURL); - vfStoreTable[14].set(0,0); - - vtStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_COMPLETED.hashCode(), &VTodo::storeCompleted); - vtStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_DUE.hashCode(), &VTodo::storeDue); - vtStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_DURATION.hashCode(), &VTodo::storeDuration); - vtStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_GEO.hashCode(), &VTodo::storeGEO); - vtStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_LOCATION.hashCode(), &VTodo::storeLocation); - vtStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_PERCENTCOMPLETE.hashCode(), &VTodo::storePercentComplete); - vtStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_PRIORITY.hashCode(), &VTodo::storePriority); - vtStoreTable[7].set(nsCalKeyword::Instance()->ms_ATOM_RESOURCES.hashCode(), &VTodo::storeResources); - vtStoreTable[8].set(0,0); -} - -//--------------------------------------------------------------------- - -JulianFunctionTable * JulianFunctionTable::Instance() -{ - if (m_Instance == 0) - m_Instance = new JulianFunctionTable(); - PR_ASSERT(m_Instance != 0); - return m_Instance; -} - -//--------------------------------------------------------------------- - - - diff --git a/mozilla/calendar/modules/core/ical/src/icalcomp.cpp b/mozilla/calendar/modules/core/ical/src/icalcomp.cpp deleted file mode 100644 index 44e1c513e50..00000000000 --- a/mozilla/calendar/modules/core/ical/src/icalcomp.cpp +++ /dev/null @@ -1,644 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// icalcomp.cpp -// John Sun -// 10:41 AM February 9 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "jutility.h" -#include "icalcomp.h" -#include "ptrarray.h" -#include "datetime.h" -#include "prprty.h" -#include "prprtyfy.h" -#include "keyword.h" - -//--------------------------------------------------------------------- - -ICalComponent::ICalComponent() {} - -//--------------------------------------------------------------------- - -ICalComponent::~ICalComponent() {} - -//--------------------------------------------------------------------- - -UnicodeString -ICalComponent::toStringFmt(UnicodeString & strFmt) -{ - UnicodeString s, into, dateFmt; - t_int32 i,j; - t_int32 k, l, m; - //if (FALSE) TRACE("strFmt = -%s-\r\n", strFmt.toCString("")); - - for ( i = 0; i < strFmt.size(); ) - { - - //- - /// If there's a special formatting character, - /// handle it. Otherwise, just emit the supplied - /// character. - /// - j = strFmt.indexOf('%', i); - if ( -1 != j) - { - dateFmt = ""; - if (j > i) - { - s += strFmt.extractBetween(i,j,into); - } - i = j + 1; - if ( strFmt.size() > i) - { - - // BELOW is to handle this - // %(MMMM dddd yyyy)B - //k = l = j; - k = strFmt.indexOf("(", i); l = strFmt.indexOf(")", i); - m = strFmt.indexOf("%", i); - if (k != -1 && l != -1 && - (k < m || m == -1) && k > j && - (l < m || m == -1) && l > j) - { - - if (l > k + 1) - dateFmt = strFmt.extractBetween(k + 1, l, dateFmt); - - i = l + 1; - } - //if (FALSE) TRACE("dateFmt = -%s-\r\n", dateFmt.toCString("")); - - s += toStringChar(strFmt[(TextOffset) i], dateFmt); - i++; - } - //if (FALSE) TRACE("s = -%s-\r\n", s.toCString("")); - } - else - { - s += strFmt.extractBetween(i, strFmt.size(),into); - break; - } - } - return s; -}// end -//--------------------------------------------------------------------- - -UnicodeString -ICalComponent::format(UnicodeString & sComponentName, - UnicodeString & strFmt, - UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString s, into; - s = nsCalKeyword::Instance()->ms_sBEGIN_WITH_COLON; - s += sComponentName; - s += nsCalKeyword::Instance()->ms_sLINEBREAK; - - - t_int32 i,j; - //char * c = strFmt.toCString(""); - //if (FALSE) TRACE("%s sComponentName, %s strFmt, %s sFilterAttendee, %d delegateRequest\r\n", sComponentName.toCString(""), strFmt.toCString(""), sFilterAttendee.toCString(""), delegateRequest); - - for ( i = 0; i < strFmt.size(); ) - { - - /*- - *** If there's a special formatting character, - *** handle it. Otherwise, just emit the supplied - *** character. - **/ - j = strFmt.indexOf('%', i); - if ( -1 != j) - { - if (j > i) - { - s += strFmt.extractBetween(i,j,into); - } - i = j + 1; - if (strFmt.size() > i) - { - if (delegateRequest) - { - s += formatChar(strFmt[(TextOffset) i], "", delegateRequest); - } - else if (sFilterAttendee.size() > 0) - { - s += formatChar(strFmt[(TextOffset) i], sFilterAttendee, FALSE); - } - else - { - s += formatChar(strFmt[(TextOffset) i], "", FALSE); - } - i++; - } - } - else - { - s += strFmt.extractBetween(i, strFmt.size(),into); - break; - } - } - s += nsCalKeyword::Instance()->ms_sEND_WITH_COLON; - s += sComponentName; - s += nsCalKeyword::Instance()->ms_sLINEBREAK; - return s; -}// end - -//--------------------------------------------------------------------- - -UnicodeString -ICalComponent::componentToString(ICAL_COMPONENT ic) -{ - switch (ic) - { - case ICAL_COMPONENT_VEVENT: return nsCalKeyword::Instance()->ms_sVEVENT; - case ICAL_COMPONENT_VTODO: return nsCalKeyword::Instance()->ms_sVTODO; - case ICAL_COMPONENT_VJOURNAL: return nsCalKeyword::Instance()->ms_sVJOURNAL; - case ICAL_COMPONENT_VFREEBUSY: return nsCalKeyword::Instance()->ms_sVFREEBUSY; - case ICAL_COMPONENT_VTIMEZONE: return nsCalKeyword::Instance()->ms_sVTIMEZONE; - case ICAL_COMPONENT_VALARM: return nsCalKeyword::Instance()->ms_sVALARM; - case ICAL_COMPONENT_TZPART: return nsCalKeyword::Instance()->ms_sTZPART; - default: - return ""; - } -} - -//--------------------------------------------------------------------- - -ICalComponent::ICAL_COMPONENT -ICalComponent::stringToComponent(UnicodeString & s, t_bool & error) -{ - s.toUpper(); - t_int32 hashCode = s.hashCode(); - error = FALSE; - - if (nsCalKeyword::Instance()->ms_ATOM_VEVENT == hashCode) return ICAL_COMPONENT_VEVENT; - else if (nsCalKeyword::Instance()->ms_ATOM_VTODO == hashCode) return ICAL_COMPONENT_VTODO; - else if (nsCalKeyword::Instance()->ms_ATOM_VJOURNAL == hashCode) return ICAL_COMPONENT_VJOURNAL; - else if (nsCalKeyword::Instance()->ms_ATOM_VFREEBUSY == hashCode) return ICAL_COMPONENT_VFREEBUSY; - else if (nsCalKeyword::Instance()->ms_ATOM_VTIMEZONE == hashCode) return ICAL_COMPONENT_VTIMEZONE; - else if (nsCalKeyword::Instance()->ms_ATOM_VALARM == hashCode) return ICAL_COMPONENT_VALARM; - else if (nsCalKeyword::Instance()->ms_ATOM_TZPART == hashCode) return ICAL_COMPONENT_TZPART; - else - { - error = TRUE; - return ICAL_COMPONENT_TZPART; - } -} - -//--------------------------------------------------------------------- - -t_bool ICalComponent::propertyNameToKeyLetter(UnicodeString & propertyName, - t_int32 & outLetter) -{ - propertyName.toUpper(); - t_int32 hashCode = propertyName.hashCode(); - t_bool retStatus = TRUE; - outLetter = ' '; - - if (nsCalKeyword::Instance()->ms_ATOM_ATTENDEE == hashCode) outLetter = ms_cAttendees; - else if (nsCalKeyword::Instance()->ms_ATOM_ATTACH == hashCode) outLetter = ms_cAttach; - else if (nsCalKeyword::Instance()->ms_ATOM_CATEGORIES == hashCode) outLetter = ms_cCategories; - else if (nsCalKeyword::Instance()->ms_ATOM_CLASS == hashCode) outLetter = ms_cClass; - else if (nsCalKeyword::Instance()->ms_ATOM_COMMENT == hashCode) outLetter = ms_cComment; - else if (nsCalKeyword::Instance()->ms_ATOM_COMPLETED == hashCode) outLetter = ms_cCompleted; - else if (nsCalKeyword::Instance()->ms_ATOM_CONTACT == hashCode) outLetter = ms_cContact; - else if (nsCalKeyword::Instance()->ms_ATOM_CREATED == hashCode) outLetter = ms_cCreated; - else if (nsCalKeyword::Instance()->ms_ATOM_DTEND == hashCode) outLetter = ms_cDTEnd; - else if (nsCalKeyword::Instance()->ms_ATOM_DTSTART == hashCode) outLetter = ms_cDTStart; - else if (nsCalKeyword::Instance()->ms_ATOM_DTSTAMP == hashCode) outLetter = ms_cDTStamp; - else if (nsCalKeyword::Instance()->ms_ATOM_DESCRIPTION == hashCode) outLetter = ms_cDescription; - else if (nsCalKeyword::Instance()->ms_ATOM_DUE == hashCode) outLetter = ms_cDue; - else if (nsCalKeyword::Instance()->ms_ATOM_DURATION == hashCode) outLetter = ms_cDuration; - else if (nsCalKeyword::Instance()->ms_ATOM_EXDATE == hashCode) outLetter = ms_cExDate; - else if (nsCalKeyword::Instance()->ms_ATOM_EXRULE == hashCode) outLetter = ms_cExRule; - else if (nsCalKeyword::Instance()->ms_ATOM_FREEBUSY == hashCode) outLetter = ms_cFreebusy; - else if (nsCalKeyword::Instance()->ms_ATOM_GEO == hashCode) outLetter = ms_cGEO; - else if (nsCalKeyword::Instance()->ms_ATOM_LASTMODIFIED == hashCode) outLetter = ms_cLastModified; - else if (nsCalKeyword::Instance()->ms_ATOM_LOCATION == hashCode) outLetter = ms_cLocation; - else if (nsCalKeyword::Instance()->ms_ATOM_ORGANIZER == hashCode) outLetter = ms_cOrganizer; - else if (nsCalKeyword::Instance()->ms_ATOM_PERCENTCOMPLETE == hashCode) outLetter = ms_cPercentComplete; - else if (nsCalKeyword::Instance()->ms_ATOM_PRIORITY == hashCode) outLetter = ms_cPriority; - else if (nsCalKeyword::Instance()->ms_ATOM_RDATE == hashCode) outLetter = ms_cRDate; - else if (nsCalKeyword::Instance()->ms_ATOM_RRULE == hashCode) outLetter = ms_cRRule; - else if (nsCalKeyword::Instance()->ms_ATOM_RECURRENCEID == hashCode) outLetter = ms_cRecurrenceID; - else if (nsCalKeyword::Instance()->ms_ATOM_RELATEDTO == hashCode) outLetter = ms_cRelatedTo; - else if (nsCalKeyword::Instance()->ms_ATOM_REPEAT == hashCode) outLetter = ms_cRepeat; - else if (nsCalKeyword::Instance()->ms_ATOM_REQUESTSTATUS == hashCode) outLetter = ms_cRequestStatus; - else if (nsCalKeyword::Instance()->ms_ATOM_RESOURCES == hashCode) outLetter = ms_cResources; - else if (nsCalKeyword::Instance()->ms_ATOM_SEQUENCE == hashCode) outLetter = ms_cSequence; - else if (nsCalKeyword::Instance()->ms_ATOM_STATUS == hashCode) outLetter = ms_cStatus; - else if (nsCalKeyword::Instance()->ms_ATOM_SUMMARY == hashCode) outLetter = ms_cSummary; - else if (nsCalKeyword::Instance()->ms_ATOM_TRANSP == hashCode) outLetter = ms_cTransp; - //else if (nsCalKeyword::Instance()->ms_ATOM_TRIGGER == hashCode) outLetter = ms_cTrigger; - else if (nsCalKeyword::Instance()->ms_ATOM_UID == hashCode) outLetter = ms_cUID; - else if (nsCalKeyword::Instance()->ms_ATOM_URL == hashCode) outLetter = ms_cURL; - //else if (nsCalKeyword::Instance()->ms_ATOM_TZOFFSET == hashCode) outLetter = ms_cTZOffset; - else if (nsCalKeyword::Instance()->ms_ATOM_TZOFFSETTO == hashCode) outLetter = ms_cTZOffsetTo; - else if (nsCalKeyword::Instance()->ms_ATOM_TZOFFSETFROM == hashCode) outLetter = ms_cTZOffsetFrom; - else if (nsCalKeyword::Instance()->ms_ATOM_TZNAME == hashCode) outLetter = ms_cTZName; - //else if (nsCalKeyword::Instance()->ms_ATOM_DAYLIGHT == hashCode) outLetter = ms_cDayLight; - //else if (nsCalKeyword::Instance()->ms_ATOM_STANDARD == hashCode) outLetter = ms_cStandard; - else if (nsCalKeyword::Instance()->ms_ATOM_TZURL == hashCode) outLetter = ms_cTZURL; - else if (nsCalKeyword::Instance()->ms_ATOM_TZID == hashCode) outLetter = ms_cTZID; - else - { - retStatus = FALSE; - } - return retStatus; -} -//--------------------------------------------------------------------- - -UnicodeString & -ICalComponent::makeFormatString(char ** ppsPropList, t_int32 iPropCount, - UnicodeString & out) -{ - // TODO: figure out what to do if no properties? - t_int32 i = 0; - t_int32 keyLetter = ' '; - t_bool bFoundProperty = FALSE; - char *cProp = 0; - UnicodeString u; - UnicodeString usProp; - - out = ""; - if (iPropCount > 0 && ppsPropList != 0) - { - for (i = 0; i < iPropCount; i++) - { - cProp = ppsPropList[i]; - usProp = cProp; - bFoundProperty = ICalComponent::propertyNameToKeyLetter(usProp, keyLetter); - if (bFoundProperty) - { - out += "%"; - // TODO: dangerous - out += (char) (keyLetter); - } - } - } else - { - // given an empty propList or a zero propCount, - // return all properties + alarms - out = "%v%a%k%c%K%G%H%t%e%B%C%i%F%D%X%E%Y%O%M%L%J%P%p%x%y%R%o%A%T%r%s%g%S%h%U%u%Z%d%f%n%Q%I%V%w"; - } - return out; -} -//--------------------------------------------------------------------- - -void ICalComponent::deleteUnicodeStringVector(JulianPtrArray * stringVector) -{ - t_int32 i; - if (stringVector != 0) - { - for (i = stringVector->GetSize() - 1; i >= 0; i--) - { - delete ((UnicodeString *) stringVector->GetAt(i)); - } - } -} -//--------------------------------------------------------------------- - -void -ICalComponent::deleteICalComponentVector(JulianPtrArray * componentVector) -{ - t_int32 i; - if (componentVector != 0) - { - for (i = componentVector->GetSize() - 1; i >= 0; i--) - { - delete ((ICalComponent *) componentVector->GetAt(i)); - } - } -} - -//--------------------------------------------------------------------- - -void -ICalComponent::cloneICalComponentVector(JulianPtrArray * out, - JulianPtrArray * toClone) -{ - if (out != 0) - { - if (toClone != 0) - { - t_int32 i; - ICalComponent * comp; - ICalComponent * clone; - for (i = 0; i < toClone->GetSize(); i++) - { - comp = (ICalComponent *) toClone->GetAt(i); - clone = comp->clone(0); - out->Add(clone); - } - } - } -} -//--------------------------------------------------------------------- - -#if 0 -void -ICalComponent::setDateTimeValue(ICalProperty ** dateTimePropertyPtr, - DateTime inVal, - JulianPtrArray * inParameters) -{ - PR_ASSERT(dateTimePropertyPtr != 0); - if (dateTimePropertyPtr != 0) - { - if (((ICalProperty *) (*dateTimePropertyPtr)) == 0) - { - ((ICalProperty *) (*dateTimePropertyPtr)) = - ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &inVal, inParameters); - } - else - { - ((ICalProperty *) (*dateTimePropertyPtr))->setValue((void *) &inVal); - ((ICalProperty *) (*dateTimePropertyPtr))->setParameters(inParameters); - } - } -} - -//--------------------------------------------------------------------- - -void ICalComponent::getDateTimeValue(ICalProperty ** dateTimePropertyPtr, - DateTime & outVal) -{ - PR_ASSERT(dateTimePropertyPtr != 0); - if (dateTimePropertyPtr != 0) - { - if ((ICalProperty *)(*dateTimePropertyPtr) == 0) - outVal.setTime(-1); - else - outVal = *((DateTime *) ((ICalProperty *)(*dateTimePropertyPtr))->getValue()); - } - else - { - outVal.setTime(-1); - } -} -//--------------------------------------------------------------------- - -void -ICalComponent::setStringValue(ICalProperty ** stringPropertyPtr, - UnicodeString inVal, - JulianPtrArray * inParameters) -{ - PR_ASSERT(stringPropertyPtr != 0); - if (stringPropertyPtr != 0) - { - if (((ICalProperty *) (*stringPropertyPtr)) == 0) - { - ((ICalProperty *) (*stringPropertyPtr)) = - ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &inVal, inParameters); - } - else - { - ((ICalProperty *) (*stringPropertyPtr))->setValue((void *) &inVal); - ((ICalProperty *) (*stringPropertyPtr))->setParameters(inParameters); - } - } -} - -//--------------------------------------------------------------------- - -void -ICalComponent::getStringValue(ICalProperty ** stringPropertyPtr, - UnicodeString & outVal) -{ - PR_ASSERT(stringPropertyPtr != 0); - if (stringPropertyPtr != 0) - { - if ((ICalProperty *)(*stringPropertyPtr) == 0) - outVal = ""; - else - outVal = *((UnicodeString *) ((ICalProperty *)(*stringPropertyPtr))->getValue()); - } - else - { - outVal = ""; - } -} - -//--------------------------------------------------------------------- - -void -ICalComponent::setIntegerValue(ICalProperty ** integerPropertyPtr, - t_int32 inVal, JulianPtrArray * inParameters) -{ - PR_ASSERT(integerPropertyPtr != 0); - if (integerPropertyPtr != 0) - { - if (((ICalProperty *) (*integerPropertyPtr)) == 0) - { - ((ICalProperty *) (*integerPropertyPtr)) = - ICalPropertyFactory::Make(ICalProperty::INTEGER, - (void *) &inVal, inParameters); - } - else - { - ((ICalProperty *) (*integerPropertyPtr))->setValue((void *) &inVal); - ((ICalProperty *) (*integerPropertyPtr))->setParameters(inParameters); - } - } -} - -//--------------------------------------------------------------------- - -void -ICalComponent::getIntegerValue(ICalProperty ** integerPropertyPtr, - t_int32 & outVal) -{ - PR_ASSERT(integerPropertyPtr != 0); - if (integerPropertyPtr != 0) - { - if ((ICalProperty *)(*integerPropertyPtr) == 0) - outVal = -1; - else - outVal = *((t_int32 *) ((ICalProperty *)(*integerPropertyPtr))->getValue()); - } - else - { - outVal = -1; - } -} -#endif /* #if 0 */ -//--------------------------------------------------------------------- - -void ICalComponent::internalSetProperty(ICalProperty ** propertyPtr, - ICalProperty * replaceProp, - t_bool bForceOverwriteOnEmpty) -{ - PR_ASSERT(propertyPtr != 0); - ICalProperty * prop = 0; - prop = (ICalProperty *) (*(propertyPtr)); - t_bool bOverwrite = TRUE; - if (replaceProp == 0 && !bForceOverwriteOnEmpty) - { - bOverwrite = FALSE; - } - if (bOverwrite) - { - if (prop != 0) - { - delete prop; - prop = 0; - (*(propertyPtr)) = 0; - } - if (replaceProp != 0) - { - prop = replaceProp->clone(0); - (*(propertyPtr)) = prop; - } - } -} - -//--------------------------------------------------------------------- - -void ICalComponent::internalSetPropertyVctr(JulianPtrArray ** propertyVctrPtr, - JulianPtrArray * replaceVctr, - t_bool bAddInsteadOfOverwrite, - t_bool bForceOverwriteOnEmpty) -{ - - // delete the contents of the old vector - // delete the old vector - // create a new vector if replaceVctr != 0 - // clone contents of replaceVctr. - - PR_ASSERT(propertyVctrPtr != 0); - JulianPtrArray * propVctr = 0; - propVctr = (JulianPtrArray *) (*(propertyVctrPtr)); - t_bool bOverwrite = TRUE; - - // don't overwrite if overwrite flag is false && replaceVctr is empty or null. - if (bAddInsteadOfOverwrite) - { - bOverwrite = FALSE; - } - else if ((replaceVctr == 0 || replaceVctr->GetSize() == 0) && !bForceOverwriteOnEmpty) - { - bOverwrite = FALSE; - } - if (bOverwrite) - { - if (propVctr != 0) - { - ICalProperty::deleteICalPropertyVector(propVctr); - delete propVctr; - propVctr = 0; - (*(propertyVctrPtr)) = 0; - } - if (replaceVctr != 0) - { - propVctr = new JulianPtrArray(); - PR_ASSERT(propVctr != 0); - (*(propertyVctrPtr)) = propVctr; - ICalProperty::CloneICalPropertyVector(replaceVctr, propVctr, 0); - } - } - else if (bAddInsteadOfOverwrite) - { - t_int32 i; - if (replaceVctr != 0) - { - ICalProperty * ip = 0; - for (i = 0; i < replaceVctr->GetSize(); i++) - { - ip = ((ICalProperty *) replaceVctr->GetAt(i))->clone(0); - if (ip != 0) - { - propVctr->Add(ip); - } - } - } - } -} -//--------------------------------------------------------------------- - -void ICalComponent::internalSetXTokensVctr(JulianPtrArray ** xTokensVctrPtr, - JulianPtrArray * replaceVctr, - t_bool bAddInsteadOfOverwrite, - t_bool bForceOverwriteOnEmpty) -{ - - // delete the contents of the old vector - // delete the old vector - // create a new vector if replaceVctr != 0 - // clone contents of replaceVctr. - - PR_ASSERT(xTokensVctrPtr != 0); - JulianPtrArray * xTokensVctr = 0; - xTokensVctr = (JulianPtrArray *) (*(xTokensVctrPtr)); - t_bool bOverwrite = TRUE; - - // don't overwrite if overwrite flag is false && replaceVctr is empty or null. - if (bAddInsteadOfOverwrite) - { - bOverwrite = FALSE; - } - else if ((replaceVctr == 0 || replaceVctr->GetSize() == 0) && !bForceOverwriteOnEmpty) - { - bOverwrite = FALSE; - } - if (bOverwrite) - { - if (xTokensVctr != 0) - { - ICalComponent::deleteUnicodeStringVector(xTokensVctr); - delete xTokensVctr; - xTokensVctr = 0; - (*(xTokensVctrPtr)) = 0; - } - if (replaceVctr != 0) - { - xTokensVctr = new JulianPtrArray(); - PR_ASSERT(xTokensVctr != 0); - (*(xTokensVctrPtr)) = xTokensVctr; - ICalProperty::CloneUnicodeStringVector(replaceVctr, xTokensVctr); - } - } - else if (bAddInsteadOfOverwrite) - { - t_int32 i; - if (replaceVctr != 0) - { - UnicodeString * us = 0; - UnicodeString u; - for (i = 0; i < replaceVctr->GetSize(); i++) - { - u = *((UnicodeString *) replaceVctr->GetAt(i)); - us = new UnicodeString(u); - if (us != 0) - { - xTokensVctr->Add(us); - } - } - } - } -} - diff --git a/mozilla/calendar/modules/core/ical/src/icalfrdr.cpp b/mozilla/calendar/modules/core/ical/src/icalfrdr.cpp deleted file mode 100644 index 41e67037551..00000000000 --- a/mozilla/calendar/modules/core/ical/src/icalfrdr.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// icalfrdr.cpp -// John Sun -// 3:03 PM February 10 1998 - -#include -#include - -#include "stdafx.h" -#include "jdefines.h" - -#include "icalfrdr.h" -#include "icalredr.h" -//--------------------------------------------------------------------- - -ICalFileReader::ICalFileReader() {} - -//--------------------------------------------------------------------- - -ICalFileReader::ICalFileReader(char * filename, ErrorCode & status) -: m_file(0), m_filename(0) -{ - m_filename = filename; - m_file = fopen(filename, "r"); - - if (m_file == 0) - { -#if 0 - if (FALSE) TRACE("Can't open %s\n", filename); -#endif - status = 1; - } - else - { - status = ZERO_ERROR; - } -} -//--------------------------------------------------------------------- -ICalFileReader::~ICalFileReader() -{ - if (m_file) { fclose(m_file); m_file = 0; } -} - -//--------------------------------------------------------------------- - -t_int8 ICalFileReader::read(ErrorCode & status) -{ - int c = fgetc(m_file); - if (c == EOF) - { - status = 1; - return -1; - } - else - return (t_int8) c; -} -//--------------------------------------------------------------------- -// TODO: handle quoted-printable -UnicodeString & -ICalFileReader::readLine(UnicodeString & aLine, ErrorCode & status) -{ - status = ZERO_ERROR; - aLine = ""; - char * l = 0; - - if ( 0 != (l = fgets(m_pBuffer,1023,m_file)) ) - { - t_int32 iLen = strlen(m_pBuffer); - if (m_pBuffer[iLen-1] == '\n') - m_pBuffer[iLen-1] = 0; - { - aLine = m_pBuffer; - return aLine; - } - } - status = 1; - return aLine; -} -//--------------------------------------------------------------------- -// NOTE: TODO: make faster profiling? -UnicodeString & -ICalFileReader::readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 iTemp) -{ - status = ZERO_ERROR; - t_int8 i; - t_bool qp = FALSE; - - readLine(aLine, status); - //if (FALSE) TRACE("rfl(1) %s\r\n", aLine.toCString("")); - - if (FAILURE(status)) - { - return aLine; - } - - if (aLine.indexOf("QUOTED-PRINTABLE") >= 0 || aLine.indexOf("quoted-printable") >= 0) - qp = TRUE; - if (qp) - { - // convert string after ':' - t_int32 i; - i = aLine.indexOf(':'); - if (i >= 0) - { - UnicodeString u; - u = aLine.extractBetween(i + 1, aLine.size(), u); - u = ICalReader::convertQuotedPrintableString(u); - aLine.replaceBetween(i + 1, aLine.size(), u); - } - if (aLine[(TextOffset) aLine.size() - 1] == '=') - aLine.remove((TextOffset) aLine.size() - 1, 1); - else - qp = FALSE; - } - - UnicodeString aSubLine; - while (TRUE) - { - i = read(status); - if (i != -1 && i == ' ' || (qp && i != -1)) - { - if (!qp) - { - aLine += readLine(aSubLine, status); - } - else - { - aLine += i; - aSubLine = readLine(aSubLine, status); - // convert aSubLine; - aSubLine = ICalReader::convertQuotedPrintableString(aSubLine); - // remove last '=' if it exists, if it doesn't we're done. - if (aSubLine[(TextOffset) aSubLine.size() - 1] == '=') - aSubLine.remove((TextOffset) aSubLine.size() - 1, 1); - else - qp = FALSE; - - aLine += aSubLine; - } - } - else if (i == -1) - { - return aLine; - } - else - { - ungetc(i, m_file); - break; - } - } - //if (FALSE) TRACE("end of rfl: ---%s---\r\n", aLine.toCString("")); - return aLine; -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/icalprm.cpp b/mozilla/calendar/modules/core/ical/src/icalprm.cpp deleted file mode 100644 index a884b0b4a72..00000000000 --- a/mozilla/calendar/modules/core/ical/src/icalprm.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// icalprm.cpp -// John Sun -// 3:41 PM February 10 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "icalprm.h" -#include "ptrarray.h" -#include "keyword.h" - -//--------------------------------------------------------------------- - -ICalParameter::ICalParameter() {} - -//--------------------------------------------------------------------- - -ICalParameter::ICalParameter(ICalParameter & that) -{ - m_ParameterName = that.m_ParameterName; - m_ParameterValue = that.m_ParameterValue; -} - -//--------------------------------------------------------------------- - -ICalParameter::ICalParameter(const UnicodeString & parameterName, - const UnicodeString & parameterValue) -{ - m_ParameterName = parameterName; - m_ParameterValue = parameterValue; -} -//--------------------------------------------------------------------- -ICalParameter * ICalParameter::clone() -{ - return new ICalParameter(*this); -} -//--------------------------------------------------------------------- - -void -ICalParameter::setParameterName(const UnicodeString & parameterName) -{ - m_ParameterName = parameterName; -} - -//--------------------------------------------------------------------- - -void -ICalParameter::setParameterValue(const UnicodeString & parameterValue) -{ - m_ParameterValue = parameterValue; -} - -//--------------------------------------------------------------------- - -UnicodeString & -ICalParameter::getParameterName(UnicodeString & retName) const -{ - retName = m_ParameterName; - return retName; -} - -//--------------------------------------------------------------------- - -UnicodeString & -ICalParameter::getParameterValue(UnicodeString & retValue) const -{ - retValue = m_ParameterValue; - return retValue; -} - -//--------------------------------------------------------------------- - -UnicodeString & -ICalParameter::toICALString(UnicodeString & result) const -{ - result = nsCalKeyword::Instance()->ms_sSEMICOLON_SYMBOL; - result += m_ParameterName; - result += '='; - result += m_ParameterValue; - return result; -} - -//--------------------------------------------------------------------- - -const ICalParameter & -ICalParameter::operator=(const ICalParameter & d) -{ - if (this != &d) - { - m_ParameterName = d.m_ParameterName; - m_ParameterValue = d.m_ParameterValue; - } - return *this; -} - -//--------------------------------------------------------------------- -UnicodeString & -ICalParameter::GetParameterFromVector(UnicodeString & paramName, - UnicodeString & retVal, - JulianPtrArray * parameters) -{ - t_int32 i; - ICalParameter * ip; - if (parameters != 0) - { - UnicodeString u; - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - if (paramName.compareIgnoreCase(ip->getParameterName(u)) == 0) - { - retVal = ip->getParameterValue(retVal); - return retVal; - } - } - } - retVal = ""; - return retVal; -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/icalredr.cpp b/mozilla/calendar/modules/core/ical/src/icalredr.cpp deleted file mode 100644 index 625508f8089..00000000000 --- a/mozilla/calendar/modules/core/ical/src/icalredr.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// icalredr.cpp -// John Sun -// 3/23/98 3:29:47 PM - -#include "stdafx.h" -#include "icalredr.h" - -//--------------------------------------------------------------------- - -ICalReader::ICalReader() {} - -//--------------------------------------------------------------------- - -t_bool ICalReader::isHex(t_int8 aToken) -{ - if (aToken >= '0' && aToken <= '9') - return TRUE; - else if (aToken >= 'A' && aToken <= 'F') - return TRUE; - else if (aToken >= 'a' && aToken <= 'f') - return TRUE; - else - return FALSE; -} - -//--------------------------------------------------------------------- - -t_int8 ICalReader::convertHex(char fToken, - char sToken) -{ - unsigned char c = 0; - if (fToken >= '0' && fToken <= '9') - c = fToken - '0'; - else if (fToken >= 'A' && fToken <= 'F') - c = fToken - ('A' - 10); - //else if (fToken >= 'a' && fToken <= 'f') - else - c = fToken - ('a' - 10); - - /* Second hex digit */ - c = (c << 4); - if (sToken >= '0' && sToken <= '9') - c += sToken - '0'; - else if (sToken >= 'A' && sToken <= 'F') - c += sToken - ('A' - 10); - //else (sToken >= 'a' && sToken <= 'f') - else - c += sToken - ('a' - 10); - - return (t_int8) c; -} - -//--------------------------------------------------------------------- - -UnicodeString & -ICalReader::convertQuotedPrintableString(UnicodeString & stringToConvert) -{ - t_int32 iEqual = -1; - t_int32 iCurrentPos = 0; - t_bool done = FALSE; - while (!done) - { - iEqual = stringToConvert.indexOf('=', iCurrentPos); - if (iEqual < 0) - done = TRUE; - else - { - if (stringToConvert.size() >= iEqual + 3) - { - if (ICalReader::isHex((char) stringToConvert[(TextOffset)(iEqual + 1)]) && - ICalReader::isHex((char) stringToConvert[(TextOffset)(iEqual + 2)])) - { - t_int8 c; - c = ICalReader::convertHex((char) stringToConvert[(TextOffset)(iEqual+1)], - (char) stringToConvert[(TextOffset)(iEqual+2)]); - UnicodeString u; - u+=c; - stringToConvert.replace(iEqual, 3, u); - iCurrentPos = iEqual + 1; - } - } - else - { - done = TRUE; - } - } - } - return stringToConvert; -} diff --git a/mozilla/calendar/modules/core/ical/src/icalsrdr.cpp b/mozilla/calendar/modules/core/ical/src/icalsrdr.cpp deleted file mode 100644 index 804ef290ee9..00000000000 --- a/mozilla/calendar/modules/core/ical/src/icalsrdr.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * icalsrdr.cpp - * John Sun - * 2/10/98 11:37:56 PM - */ - -/* TODO: remove Unistring dependency. There is a bug if the -target string is encoded with 2byte character. If so, then the -m_pos and m_length variables are wrong. Currently, I will assume that -all const char * passed in will be us-ascii 8-bit chars -*/ - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "ptypes.h" -#include "icalsrdr.h" -#include "icalredr.h" -//--------------------------------------------------------------------- - -ICalStringReader::ICalStringReader() {} - -//--------------------------------------------------------------------- - -ICalStringReader::ICalStringReader(const char * string, - nsCalUtility::MimeEncoding encoding) -: m_string(string), m_pos(0), m_mark(0) -{ - m_length = strlen(m_string); - m_unistring = m_string; - m_Encoding = encoding; -} - -//--------------------------------------------------------------------- - -t_int8 ICalStringReader::read(ErrorCode & status) -{ - if (m_pos >= m_length) - { - status = 1; - return -1; - } - else - { - status = ZERO_ERROR; - if (m_Encoding == nsCalUtility::MimeEncoding_7bit) - { - return m_string[m_pos++]; - } - else - { - // for now only handles quoted-printable - PR_ASSERT(m_Encoding == nsCalUtility::MimeEncoding_QuotedPrintable); - if (m_Encoding == nsCalUtility::MimeEncoding_QuotedPrintable) - { - if ((m_string[m_pos] == '=') && (m_length >= m_pos + 3)) - { - // TODO: use libmime decoding algorithm instead of this one - if (ICalReader::isHex(m_string[m_pos+1]) && ICalReader::isHex(m_string[m_pos + 2])) - { - t_int8 c; - c = ICalReader::convertHex(m_string[m_pos + 1], m_string[m_pos + 2]); - m_pos += 3; - return c; - } - else - { - return m_string[m_pos++]; - } - } - else - { - return m_string[m_pos++]; - } - } - else - { - // handle like 7bit - return m_string[m_pos++]; - } - } - } -} - -//--------------------------------------------------------------------- - -void ICalStringReader::mark() -{ - m_mark = m_pos; -} - -//--------------------------------------------------------------------- - -void ICalStringReader::reset() -{ - m_pos = m_mark; -} - -//--------------------------------------------------------------------- - -UnicodeString & ICalStringReader::readLine(UnicodeString & aLine, - ErrorCode & status) -{ - status = ZERO_ERROR; - t_int8 c = 0; - t_int32 oldpos = m_pos; - - aLine = ""; - c = read(status); - while (!(FAILURE(status))) - { - /* Break on '\n', '\r\n', and '\r' */ - if (c == '\n') - { - break; - } - else if (c == '\r') - { - mark(); - c = read(status); - if (FAILURE(status)) - break; - else if (c == '\n') - { - break; - } - else - { - reset(); - break; - } - } -#if 1 - aLine += c; -#endif - c = read(status); - } -#if 0 - if (m_pos > oldpos) - m_unistring.extractBetween(oldpos, m_pos - 1, aLine); - else - aLine = ""; -#endif - - - //if (FALSE) TRACE("end of readline:---%s---\r\n", aLine.toCString("")); - return aLine; -} - -//--------------------------------------------------------------------- - -UnicodeString & ICalStringReader::readFullLine(UnicodeString & aLine, - ErrorCode & status, t_int32 iTemp) -{ - status = ZERO_ERROR; - t_int32 i; - t_bool qp = FALSE; - - readLine(aLine, status); - //if (FALSE) TRACE("rfl(1) %s\r\n", aLine.toCString("")); - - if (FAILURE(status)) - { - //aLine = ""; - return aLine; - } - - if (aLine.indexOf("QUOTED-PRINTABLE") >= 0 || aLine.indexOf("quoted-printable") >=0 ) - qp = TRUE; - if (qp) - { - // convert string after ':' - t_int32 i; - i = aLine.indexOf(':'); - if (i >= 0) - { - UnicodeString u; - u = aLine.extractBetween(i + 1, aLine.size(), u); - u = ICalReader::convertQuotedPrintableString(u); - aLine.replaceBetween(i + 1, aLine.size(), u); - } - if (aLine[(TextOffset) aLine.size() - 1] == '=') - aLine.remove((TextOffset) aLine.size() - 1, 1); - else - qp = FALSE; - } - - UnicodeString aSubLine; - while (TRUE) - { - mark(); - i = read(status); - if (i == ' ' || (qp && i != -1)) - { - if (!qp) - { - aLine += readLine(aSubLine, status); - } - else - { - aLine += i; - aSubLine = readLine(aSubLine, status); - // convert aSubLine; - aSubLine = ICalReader::convertQuotedPrintableString(aSubLine); - // remove last '=' if it exists, if it doesn't we're done. - if (aSubLine[(TextOffset) aSubLine.size() - 1] == '=') - aSubLine.remove((TextOffset) aSubLine.size() - 1, 1); - else - qp = FALSE; - - aLine += aSubLine; - } - } - else if (FAILURE(status)) - { - return aLine; - } - else - { - reset(); - break; - } - } - //if (FALSE) TRACE("end of rfl: ---%s---\r\n", aLine.toCString("")); - return aLine; -} -//--------------------------------------------------------------------- - - - diff --git a/mozilla/calendar/modules/core/ical/src/icompfy.cpp b/mozilla/calendar/modules/core/ical/src/icompfy.cpp deleted file mode 100644 index 39ffadd76cd..00000000000 --- a/mozilla/calendar/modules/core/ical/src/icompfy.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// icompfy.cpp -// John Sun -// 10:46 AM February 20 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "icompfy.h" -#include "vevent.h" -#include "vtodo.h" -#include "vjournal.h" -#include "vfrbsy.h" -#include "vtimezne.h" -#include "keyword.h" -//--------------------------------------------------------------------- - -ICalComponentFactory::ICalComponentFactory() -{ -} - -//--------------------------------------------------------------------- - -ICalComponent * -ICalComponentFactory::Make(UnicodeString & name, JLog * initLog) -{ - ICalComponent * ret; - - t_int32 hashCode = name.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_VEVENT == hashCode) - { - ret = (ICalComponent *) new VEvent(initLog); - PR_ASSERT(ret != 0); - } - else if (nsCalKeyword::Instance()->ms_ATOM_VTODO == hashCode) - { - ret = (ICalComponent *) new VTodo(initLog); - PR_ASSERT(ret != 0); - } - else if (nsCalKeyword::Instance()->ms_ATOM_VJOURNAL == hashCode) - { - ret = (ICalComponent *) new VJournal(initLog); - PR_ASSERT(ret != 0); - } - else if (nsCalKeyword::Instance()->ms_ATOM_VFREEBUSY == hashCode) - { - ret = (ICalComponent *) new VFreebusy(initLog); - PR_ASSERT(ret != 0); - } - else if (nsCalKeyword::Instance()->ms_ATOM_VTIMEZONE == hashCode) - { - ret = (ICalComponent *) new VTimeZone(initLog); - PR_ASSERT(ret != 0); - } - else - { - ret = 0; - } - return ret; -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/iprprty.cpp b/mozilla/calendar/modules/core/ical/src/iprprty.cpp deleted file mode 100644 index af12b72cdcf..00000000000 --- a/mozilla/calendar/modules/core/ical/src/iprprty.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// iprprty.cpp -// John Sun -// 3:15 PM February 12 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "iprprty.h" -#include "prprty.h" - - -//--------------------------------------------------------------------- -// private never use -IntegerProperty::IntegerProperty() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -IntegerProperty::IntegerProperty(const IntegerProperty & that) -{ - setParameters(that.m_vParameters); - m_Integer = that.m_Integer; -} - -//--------------------------------------------------------------------- - -IntegerProperty::IntegerProperty(t_int32 value, JulianPtrArray * parameters) -: StandardProperty(parameters) -{ - m_Integer = value; -} - -//--------------------------------------------------------------------- - -IntegerProperty::~IntegerProperty() -{ - //deleteICalParameterVector(m_vParameters); - //delete m_vParameters; m_vParameters = 0; -} - -//--------------------------------------------------------------------- - -void * IntegerProperty::getValue() const -{ - return (void *) &m_Integer; -} - -//--------------------------------------------------------------------- - -void IntegerProperty::setValue(void * value) -{ - PR_ASSERT(value != 0); - if (value != 0) - { - m_Integer = *((t_int32 *) value); - } -} - -//--------------------------------------------------------------------- - -ICalProperty * IntegerProperty::clone(JLog * initLog) -{ - if (initLog) {} // NOTE: Remove later to avoid warnings - return new IntegerProperty(*this); -} - -//--------------------------------------------------------------------- - -t_bool IntegerProperty::isValid() -{ - return TRUE; -} - -//--------------------------------------------------------------------- - -UnicodeString & IntegerProperty::toString(UnicodeString & out) -{ - char sBuf[10]; - sprintf(sBuf, "%d", m_Integer); - out = sBuf; - return out; -} - -//--------------------------------------------------------------------- -UnicodeString & -IntegerProperty::toString(UnicodeString & dateFmt, UnicodeString & out) -{ - // NOTE: remove it later, gets rid of compiler warning - if (dateFmt.size() > 0) {} - return toString(out); -} -//--------------------------------------------------------------------- - -UnicodeString & IntegerProperty::toExportString(UnicodeString & out) -{ - return toString(out); -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/jparser.cpp b/mozilla/calendar/modules/core/ical/src/jparser.cpp deleted file mode 100644 index 253b62e6436..00000000000 --- a/mozilla/calendar/modules/core/ical/src/jparser.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * jparser.cpp - * John Sun - * 4/28/98 10:48:13 AM - */ - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "jparser.h" -#include "prprty.h" -#include "tmbevent.h" -#include "nscal.h" -#include "jlog.h" -#include "keyword.h" -#include "icalsrdr.h" - -#include "nspr.h" - -//--------------------------------------------------------------------- - -JulianParser::JulianParser() -{ - m_Reader = 0; - m_OutCalendars = 0; - m_Thread = 0; - m_bParseStarted = FALSE; - m_bParseFinished = FALSE; -} - -//--------------------------------------------------------------------- - -JulianParser::JulianParser(ICalCAPIReader * reader, - JulianPtrArray * outCalendars, - PRThread * thread) -{ - m_Reader = reader; - m_OutCalendars = outCalendars; - m_Thread = thread; - m_bParseStarted = FALSE; - m_bParseFinished = FALSE; -} - -//--------------------------------------------------------------------- - -nsCalUtility::MimeEncoding -JulianParser::stringToEncodingType(UnicodeString & propVal) -{ - if (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_s7bit) == 0) - { - return nsCalUtility::MimeEncoding_7bit; - } - else if (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sQUOTED_PRINTABLE) == 0) - { - return nsCalUtility::MimeEncoding_QuotedPrintable; - } - else if (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBase64) == 0) - { - return nsCalUtility::MimeEncoding_Base64; - } - else - return nsCalUtility::MimeEncoding_7bit; -} - -//--------------------------------------------------------------------- - -void JulianParser::ParseCalendars() -{ - JulianParser::ParseCalendars((ICalReader *) m_Reader, m_OutCalendars); -} - -//--------------------------------------------------------------------- - -void JulianParser::ParseCalendars(ICalReader * reader, - JulianPtrArray * outCalendars) -{ - if (outCalendars == 0) - return; - - JulianPtrArray * parameters = new JulianPtrArray(); - - // TODO: this needs to be changed to capireader later - PR_ASSERT(parameters != 0); - if (parameters != 0) - { - JLog * log = 0; - ErrorCode status = ZERO_ERROR; - UnicodeString strLine, propName, propVal; - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit; - - ICalCAPIReader * cr = (ICalCAPIReader *) reader; - - while(TRUE) - { - //PR_EnterMonitor((PRMonitor *) cr->getMonitor()); - //reader->readFullLine(strLine, status); - cr->readFullLine(strLine, status); - ICalProperty::Trim(strLine); - -#if TESTING_ITIPRIG - if (FALSE) TRACE("\t--Parser: line (size = %d) = ---%s---\r\n", - strLine.size(), strLine.toCString("")); -#endif - if (FAILURE(status) && strLine.size() == 0) - { - //PR_Notify((PRMonitor *) cr->getMonitor()); - if (cr->isFinished()) - { - break; - } -#if TESTING_ITIPRIG - if (FALSE) TRACE("\t--jParser: yielding\r\n"); -#endif -#ifdef NSPR20 - PR_Sleep(PR_INTERVAL_NO_WAIT); -#else - PR_Yield(); -#endif - //break; - } - - ICalProperty::parsePropertyLine(strLine, propName, - propVal, parameters); - -#if TESTING_ITIPRIG - if (TRUE) TRACE("\t--Parser: propName = --%s--, propVal = --%s--,paramSize = %d\r\n", - propName.toCString(""), propVal.toCString(""), parameters->GetSize()); -#endif - if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0)) - { - // parse an NSCalendar, add it to outCalendars - NSCalendar * cal = new NSCalendar(log); - UnicodeString fileName; - cal->parse(reader, fileName, encoding); - outCalendars->Add(cal); - } - else if (propName.compareIgnoreCase( - nsCalKeyword::Instance()->ms_sCONTENT_TRANSFER_ENCODING) == 0) - { - ICalProperty::Trim(propVal); - encoding = stringToEncodingType(propVal); - cr->setEncoding(encoding); - } - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - //PR_ExitMonitor((PRMonitor *)cr->getMonitor()); - } - - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - delete parameters; parameters = 0; - setParseFinished(); - } -} -//--------------------------------------------------------------------- - -void jparser_ParseCalendarsZero(void * jp, void * nPtr) -{ - //if (FALSE) ("--calling ParseCalendarsZero\r\n"); - JulianParser * julPar = (JulianParser *) jp; - julPar->ParseCalendars(); -#if TESTING_ITIPRIG - TRACE("\t--killing parseThread\r\n"); -#endif -#ifdef NSPR20 - PR_ProcessExit(0); -#else - PR_Exit(); -#endif -} - -//--------------------------------------------------------------------- - - - diff --git a/mozilla/calendar/modules/core/ical/src/manifest.mn b/mozilla/calendar/modules/core/ical/src/manifest.mn deleted file mode 100644 index bf5fb46d29b..00000000000 --- a/mozilla/calendar/modules/core/ical/src/manifest.mn +++ /dev/null @@ -1,74 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -LIBRARY_NAME = cal_core_ical -LIBRARY_VERSION = 10 - -CPPSRCS = \ - attendee.cpp \ - bprprty.cpp \ - bydmgntr.cpp \ - bydwgntr.cpp \ - bydygntr.cpp \ - byhgntr.cpp \ - bymdgntr.cpp \ - bymgntr.cpp \ - bymogntr.cpp \ - bywngntr.cpp \ - byydgntr.cpp \ - capiredr.cpp \ - dategntr.cpp \ - deftgntr.cpp \ - dprprty.cpp \ - duprprty.cpp \ - freebusy.cpp \ - functbl.cpp \ - icalcomp.cpp \ - icalfrdr.cpp \ - icalprm.cpp \ - icalredr.cpp \ - icalsrdr.cpp \ - icompfy.cpp \ - iprprty.cpp \ - jparser.cpp \ - nscal.cpp \ - orgnzr.cpp \ - period.cpp \ - pprprty.cpp \ - prprty.cpp \ - prprtyfy.cpp \ - rcrrence.cpp \ - recid.cpp \ - rrday.cpp \ - sdprprty.cpp \ - sprpty.cpp \ - tmbevent.cpp \ - tzpart.cpp \ - unistrto.cpp \ - uri.cpp \ - valarm.cpp \ - vevent.cpp \ - vfrbsy.cpp \ - vjournal.cpp \ - vtimezne.cpp \ - vtodo.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls netlib shell xpfc - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalAttendeeProperty.cpp b/mozilla/calendar/modules/core/ical/src/nsCalAttendeeProperty.cpp deleted file mode 100644 index c428605e46e..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalAttendeeProperty.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "jdefines.h" -#include "nsCalAttendeeProperty.h" -#include "nscalcoreicalCIID.h" -#include "icalprm.h" -#include "ptrarray.h" -#include "unistring.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalPropertyIID, NS_ICALPROPERTY_IID); -static NS_DEFINE_IID(kCCalAttendeePropertyIID, NS_CALATTENDEEPROPERTY_CID); - -nsCalAttendeeProperty::nsCalAttendeeProperty() -{ - NS_INIT_REFCNT(); - Init(); -} - -nsCalAttendeeProperty::~nsCalAttendeeProperty() -{ - if (mICalProperty) { - delete ((Attendee *) mICalProperty); - mICalProperty = nsnull; - } -} - -NS_IMPL_ADDREF(nsCalAttendeeProperty) -NS_IMPL_RELEASE(nsCalAttendeeProperty) - -nsresult nsCalAttendeeProperty::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, NS_CALATTENDEEPROPERTY_CID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) ((nsICalProperty*)(this)); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalProperty::QueryInterface(aIID, aInstancePtr)); -} - -nsresult nsCalAttendeeProperty::Init() -{ - DateTime d; - // todo: make it work for other things beside VEVENT. for now! - mICalProperty = new Attendee(ICalComponent::ICAL_COMPONENT_VEVENT, 0); - return NS_OK; -} - -void * nsCalAttendeeProperty::GetValue() const -{ - return (void *) &(((Attendee *) mICalProperty)->getName()); -} - -nsresult nsCalAttendeeProperty::SetValue(void * value) -{ - UnicodeString u = *((UnicodeString *) value); - ((Attendee *) mICalProperty)->setName(u); - return NS_OK; -} - -nsresult nsCalAttendeeProperty::SetParameters(JulianPtrArray * parameters) -{ - ((Attendee *) mICalProperty)->setParameters(parameters); - return NS_OK; -} - -JulianPtrArray * nsCalAttendeeProperty::GetParameters() -{ - // todo: XXX: fix. - return 0; -} - -nsICalProperty * nsCalAttendeeProperty::Clone() -{ - nsCalAttendeeProperty * prop = nsnull; - - static NS_DEFINE_IID(kCalAttendeePropertyCID, NS_CALATTENDEEPROPERTY_CID); - - nsresult res = nsRepository::CreateInstance(kCalAttendeePropertyCID, - nsnull, - kCalAttendeePropertyCID, - (void **) &prop); - - if (NS_OK != res) - return nsnull; - - prop->mICalProperty = (ICalProperty *) ((Attendee* )mICalProperty)->clone(0); - - return prop; -} - -PRBool nsCalAttendeeProperty::IsValid() -{ - return (PRBool) ((Attendee *)mICalProperty)->isValid(); -} - -nsString & nsCalAttendeeProperty::ToString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((DateTimeProperty *)mICalProperty)->toString(u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalAttendeeProperty::ToICALString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((DateTimeProperty *)mICalProperty)->toICALString(u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalAttendeeProperty::ToICALString(nsString & sProp, nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - UnicodeString prop = sProp.toCString(""); - u = ((DateTimeProperty *)mICalProperty)->toICALString(prop, u); - out = u.toCString(""); - */ - return out; -} - -nsresult nsCalAttendeeProperty::SetParameter(nsString & aKey, nsString & aValue) -{ - // todo: XXX: fix. - return NS_OK; -} - - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalDateTimeProperty.cpp b/mozilla/calendar/modules/core/ical/src/nsCalDateTimeProperty.cpp deleted file mode 100644 index d14c31c9d53..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalDateTimeProperty.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalDateTimeProperty.h" -#include "nscalcoreicalCIID.h" -#include "jdefines.h" -#include "dprprty.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalICalendarParserObjectIID, NS_ICALICALENDAR_PARSER_OBJECT_IID); -static NS_DEFINE_IID(kICalPropertyIID, NS_ICALPROPERTY_IID); -static NS_DEFINE_IID(kCCalDateTimePropertyCID, NS_CALDATETIMEPROPERTY_CID); - -nsCalDateTimeProperty::nsCalDateTimeProperty() -{ - NS_INIT_REFCNT(); - Init(); -} - -nsCalDateTimeProperty::~nsCalDateTimeProperty() -{ - if (mICalProperty) { - delete ((DateTimeProperty *) mICalProperty); - mICalProperty = nsnull; - } -} - -// implement ISupports functions (addref, release, query-interface) -NS_IMPL_ADDREF(nsCalDateTimeProperty) -NS_IMPL_RELEASE(nsCalDateTimeProperty) - -nsresult nsCalDateTimeProperty::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCCalDateTimePropertyCID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) ((nsICalProperty*)(this)); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalStandardProperty::QueryInterface(aIID, aInstancePtr)); -} - - -nsresult nsCalDateTimeProperty::Init() -{ - DateTime d; - mICalProperty = new DateTimeProperty(d, 0); - //mStandardProperty = new nsStandardProperty(); - return NS_OK; -} - -void * nsCalDateTimeProperty::GetValue() const -{ - return (void *) ((DateTimeProperty *) mICalProperty)->getValue(); -} - -nsresult nsCalDateTimeProperty::SetValue(void * value) -{ - ((DateTimeProperty *) mICalProperty)->setValue(value); - return NS_OK; -} - -nsICalProperty * nsCalDateTimeProperty::Clone() -{ - nsCalDateTimeProperty * prop = nsnull; - - static NS_DEFINE_IID(kCalDateTimePropertyCID, NS_CALDATETIMEPROPERTY_CID); - - nsresult res = nsRepository::CreateInstance(kCalDateTimePropertyCID, - nsnull, - kCalDateTimePropertyCID, - (void **) &prop); - - if (NS_OK != res) - return nsnull; - - prop->mICalProperty = (ICalProperty *) ((DateTimeProperty* )mICalProperty)->clone(0); - - return prop; -} - -PRBool nsCalDateTimeProperty::IsValid() -{ - return (PRBool) ((DateTimeProperty *)mICalProperty)->isValid(); -} - -nsString & nsCalDateTimeProperty::ToString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((DateTimeProperty *)mICalProperty)->toString(u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalDateTimeProperty::ToICALString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((DateTimeProperty *)mICalProperty)->toICALString(u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalDateTimeProperty::ToICALString(nsString & sProp, nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - UnicodeString prop = sProp.toCString(""); - u = ((DateTimeProperty *)mICalProperty)->toICALString(prop, u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalDateTimeProperty::toExportString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((DateTimeProperty *)mICalProperty)->toExportString(u); - out = u.toCString(""); - */ - return out; -} - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalICalendarComponent.cpp b/mozilla/calendar/modules/core/ical/src/nsCalICalendarComponent.cpp deleted file mode 100644 index c1781ce2e3a..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalICalendarComponent.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "jdefines.h" -#include "nsCalICalendarComponent.h" -#include "nsICalICalendarComponent.h" -#include "nscalcoreicalCIID.h" -#include "icalcomp.h" -#include "nsICalICalendarContainer.h" -#include "nsICalICalendarParserObject.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalICalendarParserObjectIID, NS_ICALICALENDAR_PARSER_OBJECT_IID); -static NS_DEFINE_IID(kICalICalendarContainerIID, NS_ICALICALENDARCONTAINER_IID); -static NS_DEFINE_IID(kICalICalendarComponentIID, NS_ICALICALENDARCOMPONENT_IID); - -nsCalICalendarComponent::nsCalICalendarComponent() -{ - NS_INIT_REFCNT(); -} - -nsCalICalendarComponent::~nsCalICalendarComponent() -{ -} - -NS_IMPL_ADDREF(nsCalICalendarComponent) -NS_IMPL_RELEASE(nsCalICalendarComponent) - -nsresult nsCalICalendarComponent::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) ((nsICalICalendarComponent*)(this)); - } - else if (aIID.Equals(kICalICalendarParserObjectIID)) { - *aInstancePtr = (void*)(this); - } - else if (aIID.Equals(kICalICalendarContainerIID)) { - *aInstancePtr = (void*) ((nsICalICalendarContainer*)(this)); - } - else if (aIID.Equals(kICalICalendarComponentIID)) { - *aInstancePtr = (void*)(this); - } - else { - *aInstancePtr = 0; - return NS_NOINTERFACE; - } - ((nsISupports*) *aInstancePtr)->AddRef(); - return NS_OK; -} - -nsresult nsCalICalendarComponent::Init() -{ - return NS_OK; -} - -PRBool nsCalICalendarComponent::StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop, - JulianPtrArray * vTimeZones) -{ - // handle x-tokens?? - return PR_TRUE; -} - -nsresult nsCalICalendarComponent::SetParameter(nsString & aKey, nsString & aValue) -{ - return NS_OK; -} - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalIntegerProperty.cpp b/mozilla/calendar/modules/core/ical/src/nsCalIntegerProperty.cpp deleted file mode 100644 index c0c0047826f..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalIntegerProperty.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalIntegerProperty.h" -#include "nsCalStandardProperty.h" -#include "nscalcoreicalCIID.h" -#include "jdefines.h" -#include "iprprty.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalICalendarParserObjectIID, NS_ICALICALENDAR_PARSER_OBJECT_IID); -static NS_DEFINE_IID(kICalPropertyIID, NS_ICALPROPERTY_IID); -static NS_DEFINE_IID(kCCalIntegerPropertyCID, NS_CALINTEGERPROPERTY_CID); - -nsCalIntegerProperty::nsCalIntegerProperty() -{ - NS_INIT_REFCNT(); - Init(); -} - -nsCalIntegerProperty::~nsCalIntegerProperty() -{ - if (mICalProperty) { - delete ((IntegerProperty *) mICalProperty); - mICalProperty = nsnull; - } -} - -// implement ISupports functions (addref, release, query-interface) -NS_IMPL_ADDREF(nsCalIntegerProperty) -NS_IMPL_RELEASE(nsCalIntegerProperty) - -nsresult nsCalIntegerProperty::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCCalIntegerPropertyCID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) ((nsICalProperty*)(this)); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalStandardProperty::QueryInterface(aIID, aInstancePtr)); -} - -nsresult nsCalIntegerProperty::Init() -{ - t_int32 i; - mICalProperty = (ICalProperty *) new IntegerProperty(i, 0); - //mICalProperty = new nsStandardProperty(); - return NS_OK; -} - -void * nsCalIntegerProperty::GetValue() const -{ - return (void *) ((IntegerProperty *) mICalProperty)->getValue(); -} - -nsresult nsCalIntegerProperty::SetValue(void * value) -{ - ((IntegerProperty *) mICalProperty)->setValue(value); - return NS_OK; -} - -nsICalProperty * nsCalIntegerProperty::Clone() -{ - nsCalIntegerProperty * prop = nsnull; - - static NS_DEFINE_IID(kCalIntegerPropertyCID, NS_CALINTEGERPROPERTY_CID); - - nsresult res = nsRepository::CreateInstance(kCalIntegerPropertyCID, - nsnull, - kCalIntegerPropertyCID, - (void **) &prop); - - if (NS_OK != res) - return nsnull; - - prop->mICalProperty = (ICalProperty *) ((IntegerProperty *) mICalProperty)->clone(0); - - return prop; -} - -PRBool nsCalIntegerProperty::IsValid() -{ - return (PRBool) ((IntegerProperty *) mICalProperty)->isValid(); -} - -nsString & nsCalIntegerProperty::ToString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((StringProperty *) mICalProperty)->toString(u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalIntegerProperty::ToICALString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((StringProperty *) mICalProperty)->toICALString(u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalIntegerProperty::ToICALString(nsString & sProp, nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - UnicodeString prop = sProp.toCString(""); - u = ((StringProperty *) mICalProperty)->toICALString(prop, u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalIntegerProperty::toExportString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((StringProperty *) mICalProperty)->toExportString(u); - out = u.toCString(""); - */ - return out; -} - - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalProperty.cpp b/mozilla/calendar/modules/core/ical/src/nsCalProperty.cpp deleted file mode 100644 index 56747525145..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalProperty.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "jdefines.h" -#include "nsCalProperty.h" -#include "nscalcoreicalCIID.h" -#include "sdprprty.h" -#include "icalprm.h" -#include "ptrarray.h" -#include "unistring.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalPropertyIID, NS_ICALPROPERTY_IID); -static NS_DEFINE_IID(kICalICalendarParserObjectIID, NS_ICALICALENDAR_PARSER_OBJECT_IID); - -nsCalProperty::nsCalProperty() -{ - //NS_INIT_REFCNT(); - //Init(); -} - -nsCalProperty::~nsCalProperty() -{ -} - -nsresult nsCalProperty::Init() -{ - return NS_OK; -} - -// implement ISupports functions (addref, release, query-interface) -NS_IMPL_ADDREF(nsCalProperty) -NS_IMPL_RELEASE(nsCalProperty) - -nsresult nsCalProperty::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) ((nsICalProperty*)(this)); - } - else if (aIID.Equals(kICalPropertyIID)) { - *aInstancePtr = (void*)(this); - } - else if (aIID.Equals(kICalICalendarParserObjectIID)) { - *aInstancePtr = (void*)(this); - } - else { - *aInstancePtr = 0; - return NS_NOINTERFACE; - } - ((nsISupports*) *aInstancePtr)->AddRef(); - return NS_OK; -} - -ICalProperty * nsCalProperty::GetICalProperty() const -{ - return mICalProperty; -} - - - - - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalStandardProperty.cpp b/mozilla/calendar/modules/core/ical/src/nsCalStandardProperty.cpp deleted file mode 100644 index a5c92cb4d36..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalStandardProperty.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "jdefines.h" -#include "nsCalStandardProperty.h" -#include "nscalcoreicalCIID.h" -#include "sdprprty.h" -#include "icalprm.h" -#include "ptrarray.h" -#include "unistring.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalPropertyIID, NS_ICALPROPERTY_IID); -static NS_DEFINE_IID(kICalStandardPropertyIID, NS_ICALSTANDARDPROPERTY_IID); -static NS_DEFINE_IID(kICalICalendarParserObjectIID, NS_ICALICALENDAR_PARSER_OBJECT_IID); -nsCalStandardProperty::nsCalStandardProperty() -{ - //NS_INIT_REFCNT(); - //Init(); -} - -nsCalStandardProperty::~nsCalStandardProperty() -{ -} - -// implement ISupports functions (addref, release, query-interface) -NS_IMPL_ADDREF(nsCalStandardProperty) -NS_IMPL_RELEASE(nsCalStandardProperty) - -nsresult nsCalStandardProperty::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) ((nsICalStandardProperty*)(this)); - } - else if (aIID.Equals(kICalPropertyIID)) { - *aInstancePtr = (void*)(this); - } - else if (aIID.Equals(kICalStandardPropertyIID)) { - *aInstancePtr = (void*)(this); - } - else if (aIID.Equals(kICalICalendarParserObjectIID)) { - *aInstancePtr = (void*)(this); - } - else { - *aInstancePtr = 0; - return NS_NOINTERFACE; - } - ((nsISupports*) *aInstancePtr)->AddRef(); - return NS_OK; -} - -nsresult nsCalStandardProperty::Init() -{ - return NS_OK; -} - -nsresult nsCalStandardProperty::AddParameter(nsString & aKey, nsString & aValue) -{ - ICalParameter * ipm = new ICalParameter((UnicodeString) aKey, (UnicodeString) aValue); - return AddParameter(ipm); -} - - -nsresult nsCalStandardProperty::AddParameter(ICalParameter * ipm) -{ - if (mICalProperty) - ((StandardProperty *) mICalProperty)->addParameter(ipm); - return NS_OK; -} - -nsresult nsCalStandardProperty::Parse(nsString & in) -{ - return NS_OK; -} - -nsresult nsCalStandardProperty::SetParameters(JulianPtrArray * parameters) -{ - ((StandardProperty *) mICalProperty)->setParameters(parameters); - return NS_OK; -} - -JulianPtrArray * nsCalStandardProperty::GetParameters() -{ - return ((StandardProperty *) mICalProperty)->getParameters(); -} - -nsresult nsCalStandardProperty::SetParameter(nsString & aKey, nsString & aValue) -{ - char * cKey = 0; - char * cValue = 0; - cKey = aKey.ToCString(cKey, aKey.Length()); - cValue = aValue.ToCString(cValue, aValue.Length()); - // don't do anything, just append to vector for now - ICalParameter * ipm = new ICalParameter(cKey, cValue); - AddParameter(ipm); - delete [] cKey; - delete [] cValue; - return NS_OK; -} - - - - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalStringProperty.cpp b/mozilla/calendar/modules/core/ical/src/nsCalStringProperty.cpp deleted file mode 100644 index f6866b67458..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalStringProperty.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalStringProperty.h" -#include "nscalcoreicalCIID.h" -#include "jdefines.h" -#include "dprprty.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalICalendarParserObjectIID, NS_ICALICALENDAR_PARSER_OBJECT_IID); -static NS_DEFINE_IID(kICalPropertyIID, NS_ICALPROPERTY_IID); -static NS_DEFINE_IID(kICalStandardPropertyIID, NS_ICALSTANDARDPROPERTY_IID); -static NS_DEFINE_IID(kCCalStringPropertyCID, NS_CALSTRINGPROPERTY_CID); - -nsCalStringProperty::nsCalStringProperty() -{ - NS_INIT_REFCNT(); - Init(); -} - -nsCalStringProperty::~nsCalStringProperty() -{ - if (mICalProperty) { - delete ((StringProperty *) mICalProperty); - mICalProperty = nsnull; - } -} - -// implement ISupports functions (addref, release, query-interface) -NS_IMPL_ADDREF(nsCalStringProperty) -NS_IMPL_RELEASE(nsCalStringProperty) - -nsresult nsCalStringProperty::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCCalStringPropertyCID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) ((nsICalProperty*)(this)); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalStandardProperty::QueryInterface(aIID, aInstancePtr)); -} - -nsresult nsCalStringProperty::Init() -{ - UnicodeString u; - mICalProperty = (ICalProperty *) new StringProperty(u, 0); - //mICalProperty = new nsStandardProperty(); - return NS_OK; -} - -void * nsCalStringProperty::GetValue() const -{ - return (void *) ((StringProperty *) mICalProperty)->getValue(); -} - -nsresult nsCalStringProperty::SetValue(void * value) -{ - ((StringProperty *) mICalProperty)->setValue(value); - return NS_OK; -} - -nsICalProperty * nsCalStringProperty::Clone() -{ - nsCalStringProperty * prop = nsnull; - - static NS_DEFINE_IID(kCalStringPropertyCID, NS_CALSTRINGPROPERTY_CID); - - nsresult res = nsRepository::CreateInstance(kCalStringPropertyCID, - nsnull, - kCalStringPropertyCID, - (void **) &prop); - - if (NS_OK != res) - return nsnull; - - prop->mICalProperty = (ICalProperty *) ((StringProperty *) mICalProperty)->clone(0); - - return prop; -} - -PRBool nsCalStringProperty::IsValid() -{ - return (PRBool) ((StringProperty *) mICalProperty)->isValid(); -} - -nsString & nsCalStringProperty::ToString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((StringProperty *) mICalProperty)->toString(u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalStringProperty::ToICALString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((StringProperty *) mICalProperty)->toICALString(u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalStringProperty::ToICALString(nsString & sProp, nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - UnicodeString prop = sProp.toCString(""); - u = ((StringProperty *) mICalProperty)->toICALString(prop, u); - out = u.toCString(""); - */ - return out; -} - -nsString & nsCalStringProperty::toExportString(nsString & out) -{ - /* - todo: XXX: finish - UnicodeString u = out.toCString(""); - u = ((StringProperty *) mICalProperty)->toExportString(u); - out = u.toCString(""); - */ - return out; -} - - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalTimeBasedEvent.cpp b/mozilla/calendar/modules/core/ical/src/nsCalTimeBasedEvent.cpp deleted file mode 100644 index ce13aaa933f..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalTimeBasedEvent.cpp +++ /dev/null @@ -1,343 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTimeBasedEvent.h" -#include "nscalcoreicalCIID.h" -#include "tmbevent.h" -#include "nsICalICalendarContainer.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalTimeBasedEventIID, NS_ICALTIMEBASEDEVENT_IID); - -nsCalTimeBasedEvent::nsCalTimeBasedEvent() -{ - NS_INIT_REFCNT(); -} - -nsCalTimeBasedEvent::~nsCalTimeBasedEvent() -{ -} - -NS_IMPL_ADDREF(nsCalTimeBasedEvent) -NS_IMPL_RELEASE(nsCalTimeBasedEvent) - -nsresult nsCalTimeBasedEvent::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kICalTimeBasedEventIID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) ((nsICalTimeBasedEvent*)(this)); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*)(this); - AddRef(); - return NS_OK; - } - return (nsCalICalendarComponent::QueryInterface(aIID, aInstancePtr)); -} - -nsresult nsCalTimeBasedEvent::Init() -{ - return NS_OK; -} - -PRInt32 nsCalTimeBasedEvent::GetSequence() const -{ - if (mICalComponent) - return (PRInt32) ((TimeBasedEvent *) mICalComponent)->getSequence(); - else - return -1; -} - -nsresult nsCalTimeBasedEvent::SetSequence(PRInt32 i, JulianPtrArray * parameters) -{ - if (mICalComponent) - ((TimeBasedEvent *) mICalComponent)->setSequence(i, parameters); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetSequenceProperty(nsICalProperty * property) -{ - if (mICalComponent) { - t_int32 i = *((t_int32 *) (property->GetValue())); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setSequence(i, params); - } - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddAttachProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->addAttach(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddAttendeeProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - // todo: finish - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddCategoriesProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->addCategories(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetClassProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setClass(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddCommentProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->addComment(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddContactProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->addContact(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetCreatedProperty(nsICalProperty * property) -{ - // todo: assert property is of datetime - if (((TimeBasedEvent *) mICalComponent)) { - DateTime d = *((DateTime *) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setCreated(d, params); - } - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetDescriptionProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setDescription(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetDTStartProperty(nsICalProperty * property) -{ - // todo: assert property is of datetime - if (((TimeBasedEvent *) mICalComponent)) { - // todo: parse value = data stuff. - DateTime d = *((DateTime *) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setDTStart(d, params); - } - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetDTStampProperty(nsICalProperty * property) -{ - // todo: assert property is of datetime - if (((TimeBasedEvent *) mICalComponent)) { - DateTime d = *((DateTime *) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setDTStamp(d, params); - } - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddExDateProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->addExDate(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddExRuleProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - // todo: finish - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetLastModifiedProperty(nsICalProperty * property) -{ - // todo: assert property is of datetime - if (((TimeBasedEvent *) mICalComponent)) { - DateTime d = *((DateTime *) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setDTStamp(d, params); - } - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetOrganizerProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - // todo: finish - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddRDateProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - // todo: parse value = DATE, PERIOD - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->addRDate(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddRRuleProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - // todo: finish - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetRecurrenceIDProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - // todo: finish - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddRelatedToProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->addRelatedTo(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::AddRequestStatusProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->addRequestStatus(s, params); - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SetStatusProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setStatus(s, params); - return NS_OK; -} -nsresult nsCalTimeBasedEvent::SetSummaryProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setSummary(s, params); - return NS_OK; -} -nsresult nsCalTimeBasedEvent::SetUIDProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setUID(s, params); - return NS_OK; -} -nsresult nsCalTimeBasedEvent::SetURLProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((TimeBasedEvent *) mICalComponent)->setURL(s, params); - return NS_OK; -} - -PRBool nsCalTimeBasedEvent::StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop, - JulianPtrArray * vTimeZones) -{ - if (nsnull == mICalComponent) - return NS_OK; // todo: change to custom error. - if (nsnull == prop) - return NS_OK; // todo: change to custom error. - - switch(tag) - { - case eCalICalendarTag_sequence: SetSequenceProperty(prop); break; - default: - // todo: handle errors && x-tokens - break; - } - return NS_OK; -} - -nsresult nsCalTimeBasedEvent::SelfCheck() -{ - /* - if (mICalComponent) { - ((TimeBasedEvent *) mICalComponent)->selfCheck(); - } - */ - return NS_OK; -} - - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalVEvent.cpp b/mozilla/calendar/modules/core/ical/src/nsCalVEvent.cpp deleted file mode 100644 index d8593984f3e..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalVEvent.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalVEvent.h" -#include "nscalcoreicalCIID.h" -#include "tmbevent.h" -#include "nsICalICalendarContainer.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalICalendarParserObjectIID, NS_ICALICALENDAR_PARSER_OBJECT_IID); -static NS_DEFINE_IID(kICalICalendarContainerIID, NS_ICALICALENDARCONTAINER_IID); -static NS_DEFINE_IID(kICalVEventIID, NS_ICALVEVENT_IID); -static NS_DEFINE_IID(kICalTimeBasedEventIID, NS_ICALTIMEBASEDEVENT_IID); -static NS_DEFINE_IID(kCCalVEventCID, NS_CALICALENDARVEVENT_CID); - -nsCalVEvent::nsCalVEvent() -{ - NS_INIT_REFCNT(); - nsCalVEvent::Init(); -} - -nsCalVEvent::~nsCalVEvent() -{ - if (mICalComponent) - { - delete ((VEvent *) mICalComponent); - mICalComponent = 0; - } -} - -NS_IMPL_ADDREF(nsCalVEvent) -NS_IMPL_RELEASE(nsCalVEvent) - -nsresult nsCalVEvent::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCCalVEventCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) ((nsICalVEvent*)(this)); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*)(this); - AddRef(); - return NS_OK; - } - return (nsCalTimeBasedEvent::QueryInterface(aIID, aInstancePtr)); -} - -nsresult nsCalVEvent::Init() -{ - mICalComponent = (ICalComponent *) new VEvent(0); - return NS_OK; -} - -nsresult nsCalVEvent::SetParameter(nsString & aKey, nsString & aValue) -{ - return NS_OK; -} - -DateTime nsCalVEvent::GetDTEnd() const -{ - if (((VEvent *) mICalComponent)) - return (DateTime) ((VEvent *) mICalComponent)->getDTEnd(); - else - return -1; -} - -nsresult nsCalVEvent::SetDTEnd(DateTime d, JulianPtrArray * parameters) -{ - if (((VEvent *) mICalComponent)) - ((VEvent *) mICalComponent)->setDTEnd(d, parameters); - return NS_OK; -} - -nsresult nsCalVEvent::SetDTEndProperty(nsICalProperty * property) -{ - // todo: assert property is of datetime - if (((VEvent *) mICalComponent)) { - DateTime d = *((DateTime *) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((VEvent *) mICalComponent)->setDTEnd(d, params); - } - return NS_OK; -} - -nsresult nsCalVEvent::SetLocationProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((VEvent *) mICalComponent)->setLocation(s, params); - return NS_OK; -} -nsresult nsCalVEvent::SetTranspProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((VEvent *) mICalComponent)->setTransp(s, params); - return NS_OK; -} -nsresult nsCalVEvent::SetGEOProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((VEvent *) mICalComponent)->setGEO(s, params); - return NS_OK; -} - -nsresult nsCalVEvent::SetPriorityProperty(nsICalProperty * property) -{ - // todo: assert property is of integer type - if (mICalComponent) { - t_int32 i = *((t_int32 *) (property->GetValue())); - JulianPtrArray * params = property->GetParameters(); - ((VEvent *) mICalComponent)->setPriority(i, params); - } - return NS_OK; -} - -nsresult nsCalVEvent::AddResourcesProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - ((VEvent *) mICalComponent)->addResources(s, params); - return NS_OK; -} - -PRBool nsCalVEvent::StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop, - JulianPtrArray * vTimeZones) -{ - if (nsnull == mICalComponent) - return NS_OK; // todo: change to custom error. - if (nsnull == prop) - return NS_OK; // todo: change to custom error. - - switch(tag) - { - case eCalICalendarTag_dtend: SetDTEndProperty(prop); break; - //case eCalICalendarTag_duration: SetDurationProperty(prop); break; - case eCalICalendarTag_geo: SetGEOProperty(prop); break; - case eCalICalendarTag_location: SetLocationProperty(prop); break; - case eCalICalendarTag_priority: SetPriorityProperty(prop); break; - case eCalICalendarTag_transp: SetTranspProperty(prop); break; - //case eCalICalendarTag_resources: AddResourcesProperty(prop); break; - default: - // todo: handle errors && x-tokens - break; - } - return (nsCalTimeBasedEvent::StoreProperty(tag, prop, vTimeZones)); -} - -/* -nsresult nsCalVEvent::SelfCheck() -{ - if (((VEvent *) mICalComponent)) { - ((VEvent *) mICalComponent)->selfCheck(); - } - return NS_OK; -} -*/ - -VEvent * nsCalVEvent::GetICalEvent() -{ - return (VEvent *) mICalComponent; -} - -PRBool nsCalVEvent::IsValid() -{ - return (((VEvent *)mICalComponent)->isValid()); -} - - - - - - diff --git a/mozilla/calendar/modules/core/ical/src/nsCalendar.cpp b/mozilla/calendar/modules/core/ical/src/nsCalendar.cpp deleted file mode 100644 index eeca254835d..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCalendar.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalendar.h" -//#include "nsICalICalendarParserObject.h" -#include "nscalcoreicalCIID.h" -#include "nscal.h" -#include "nsICalICalendarContainer.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kICalICalendarParserObjectIID, NS_ICALICALENDAR_PARSER_OBJECT_IID); -static NS_DEFINE_IID(kICalICalendarContainerIID, NS_ICALICALENDARCONTAINER_IID); -static NS_DEFINE_IID(kICalendarIID, NS_ICALENDAR_IID); - -nsCalendar::nsCalendar() -{ - NS_INIT_REFCNT(); - Init(); -} - -nsCalendar::~nsCalendar() -{ - if (mCalendar) { - delete mCalendar; - mCalendar = nsnull; - } -} - -// implement ISupports functions (addref, release, query-interface) -NS_IMPL_ADDREF(nsCalendar) -NS_IMPL_RELEASE(nsCalendar) - -nsresult nsCalendar::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (nsnull == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) ((nsICalendar*)(this)); - } - else if (aIID.Equals(kICalICalendarParserObjectIID)) { - *aInstancePtr = (void*)(this); - } - else if (aIID.Equals(kICalICalendarContainerIID)) { - *aInstancePtr = (void*) ((nsICalICalendarContainer*)(this)); - } - else if (aIID.Equals(kICalendarIID)) { - *aInstancePtr = (void*)(this); - } - else { - *aInstancePtr = 0; - return NS_NOINTERFACE; - } - ((nsISupports*) *aInstancePtr)->AddRef(); - return NS_OK; -} - -nsresult nsCalendar::Init() -{ - mCalendar = new NSCalendar(); - return NS_OK; -} - -nsresult nsCalendar::SetParameter(nsString & aKey, nsString & aValue) -{ - return NS_OK; -} - -UnicodeString nsCalendar::GetCalScale() const -{ - return mCalendar->getCalScale(); -} - -nsresult nsCalendar::SetCalScale(UnicodeString s, JulianPtrArray * parameters) -{ - mCalendar->setCalScale(s, parameters); - return NS_OK; -} - -/* -nsICalProperty * nsCalendar::GetCalScaleProperty() const -{ - return mCalendar->getCalScaleProperty(); -} -*/ - -UnicodeString nsCalendar::GetVersion() const -{ - return mCalendar->getVersion(); -} - -nsresult nsCalendar::SetVersion(UnicodeString s, JulianPtrArray * parameters) -{ - mCalendar->setVersion(s, parameters); - return NS_OK; -} - -nsresult nsCalendar::SetVersionProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - mCalendar->setVersion(s, params); - return NS_OK; -} - -nsresult nsCalendar::SetProdidProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - mCalendar->setProdid(s, params); - return NS_OK; -} - -nsresult nsCalendar::SetCalScaleProperty(nsICalProperty * property) -{ - // todo: assert property is of string type - UnicodeString s = *((UnicodeString* ) property->GetValue()); - JulianPtrArray * params = property->GetParameters(); - mCalendar->setCalScale(s, params); - return NS_OK; -} - -nsresult nsCalendar::SetMethodProperty(nsICalProperty * property) -{ - // todo: assert property is of integer type - UnicodeString s = *((UnicodeString *) property->GetValue()); - NSCalendar::METHOD i = NSCalendar::stringToMethod(s); - mCalendar->setMethod(i); - return NS_OK; -} - -/* -nsICalProperty * nsCalendar::GetVersionProperty() const -{ - return mCalendar->getVersionProperty(); -} -*/ - -UnicodeString nsCalendar::GetProdid() const -{ - return mCalendar->getProdid(); -} - -nsresult nsCalendar::SetProdid(UnicodeString s, JulianPtrArray * parameters) -{ - mCalendar->setProdid(s, parameters); - return NS_OK; -} - -/* -nsICalProperty * nsCalendar::GetProdidProperty() const -{ - return mCalendar->getProdidProperty(); -} -*/ - -nsresult nsCalendar::SetMethod(PRInt32 i) -{ - mCalendar->setMethod((NSCalendar::METHOD) i); - return NS_OK; -} - -PRInt32 nsCalendar::GetMethod() const -{ - return (PRInt32) mCalendar->getMethod(); -} - -nsresult nsCalendar::AddEvent(nsICalVEvent * event) -{ - if (mCalendar) - { - mCalendar->addEvent(event->GetICalEvent()); - } - return NS_OK; -} - -PRBool nsCalendar::StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop, - JulianPtrArray * vTimeZones) -{ - if (nsnull == mCalendar) - return NS_OK; // todo: change to custom error. - if (nsnull == prop) - return NS_OK; // todo: change to custom error. - - switch(tag) - { - case eCalICalendarTag_method: SetMethodProperty(prop); break; - case eCalICalendarTag_version: SetVersionProperty(prop); break; - case eCalICalendarTag_calscale: SetCalScaleProperty(prop); break; - case eCalICalendarTag_prodid: SetProdidProperty(prop); break; - default: - // todo: handle errors && x-tokens - break; - } - return NS_OK; -} - -NSCalendar * nsCalendar::GetNSCalendar() const -{ - return mCalendar; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/core/ical/src/nsCoreICalFactory.cpp b/mozilla/calendar/modules/core/ical/src/nsCoreICalFactory.cpp deleted file mode 100644 index f4b03e694d4..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nsCoreICalFactory.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsIFactory.h" -#include "nsISupports.h" -#include "nsCoreCIID.h" - -#include "nsCalendar.h" -#include "nsCalVEvent.h" -#include "nsCalDateTimeProperty.h" -#include "nsCalStringProperty.h" -#include "nsCalIntegerProperty.h" -#include "nsCalAttendeeProperty.h" -#include "nscalcoreicalCIID.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); -static NS_DEFINE_IID(kCCalendarCID, NS_CALICALENDARVCALENDAR_CID); -static NS_DEFINE_IID(kCCalVEventCID, NS_CALICALENDARVEVENT_CID); -static NS_DEFINE_IID(kCCalDateTimePropertyCID, NS_CALDATETIMEPROPERTY_CID); -static NS_DEFINE_IID(kCCalStringPropertyCID, NS_CALSTRINGPROPERTY_CID); -static NS_DEFINE_IID(kCCalIntegerPropertyCID, NS_CALINTEGERPROPERTY_CID); -static NS_DEFINE_IID(kCCalAttendeePropertyCID, NS_CALATTENDEEPROPERTY_CID); - -class nsCoreICalFactory : public nsIFactory -{ - public: - // nsISupports methods - NS_IMETHOD QueryInterface(const nsIID &aIID, - void **aResult); - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - // nsIFactory methods - NS_IMETHOD CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult); - - NS_IMETHOD LockFactory(PRBool aLock); - - nsCoreICalFactory(const nsCID &aClass); - ~nsCoreICalFactory(); - - private: - nsrefcnt mRefCnt; - nsCID mClassID; -}; - -nsCoreICalFactory::nsCoreICalFactory(const nsCID &aClass) -{ - mRefCnt = 0; - mClassID = aClass; -} - -nsCoreICalFactory::~nsCoreICalFactory() -{ - NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); -} - -nsresult nsCoreICalFactory::QueryInterface(const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - // Always NULL result, in case of failure - *aResult = NULL; - - 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; -} - -nsrefcnt nsCoreICalFactory::AddRef() -{ - return ++mRefCnt; -} - -nsrefcnt nsCoreICalFactory::Release() -{ - if (--mRefCnt == 0) { - delete this; - return 0; // Don't access mRefCnt after deleting! - } - return mRefCnt; -} - -nsresult nsCoreICalFactory::CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - *aResult = NULL; - - nsISupports *inst = nsnull; - - if (mClassID.Equals(kCCalendarCID)) { - inst = (nsISupports *)(nsICalendar *)new nsCalendar(); - } - else if (mClassID.Equals(kCCalDateTimePropertyCID)) { - inst = (nsISupports *)(nsICalProperty *)new nsCalDateTimeProperty(); - } - else if (mClassID.Equals(kCCalStringPropertyCID)) { - inst = (nsISupports *)(nsICalProperty *)new nsCalStringProperty(); - } - else if (mClassID.Equals(kCCalAttendeePropertyCID)) { - inst = (nsISupports *)(nsICalProperty *)new nsCalAttendeeProperty(); - } - else if (mClassID.Equals(kCCalIntegerPropertyCID)) { - inst = (nsISupports *)(nsICalProperty *)new nsCalIntegerProperty(); - } - else if (mClassID.Equals(kCCalVEventCID)) { - inst = (nsISupports *)(nsICalVEvent *)new nsCalVEvent(); - } - - if (inst == NULL) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult res = inst->QueryInterface(aIID, aResult); - - if (res != NS_OK) { - // We didn't get the right interface, so clean up - delete inst; - } - - return res; -} - -nsresult nsCoreICalFactory::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; - } - - *aFactory = new nsCoreICalFactory(aClass); - - if (nsnull == aFactory) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); -} - diff --git a/mozilla/calendar/modules/core/ical/src/nscal.cpp b/mozilla/calendar/modules/core/ical/src/nscal.cpp deleted file mode 100644 index b81c27a9615..00000000000 --- a/mozilla/calendar/modules/core/ical/src/nscal.cpp +++ /dev/null @@ -1,2250 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// nscal.h -// John Sun -// 1:35 PM Febuary 18 1998 - -/* - * Updated 9/24/98 sman - * We need to be able to append a list of events: AddEventList - */ - -#include "stdafx.h" -#include "jdefines.h" - -#include "nscal.h" -#include "prprty.h" -#include "prprtyfy.h" -#include "icalcomp.h" -#include "icompfy.h" -#include "icalredr.h" -#include "vevent.h" -#include "vtodo.h" -#include "vjournal.h" -#include "vfrbsy.h" -#include "vtimezne.h" -#include "jlog.h" -#include "jutility.h" -#include "keyword.h" - -#include "uidrgntr.h" -#include "datetime.h" -#include "period.h" -#include "recid.h" - -/** to work on UNIX */ -//#define TRACE printf - -//--------------------------------------------------------------------- -t_bool NSCalendar::m_bLoadMultipleCalendars = FALSE; -t_bool NSCalendar::m_bSmartLoading = TRUE; -//--------------------------------------------------------------------- - -// never use -#if 0 -NSCalendar::NSCalendar() -{ - PR_ASSERT(FALSE); -} -#endif - -//--------------------------------------------------------------------- - -NSCalendar::NSCalendar(JLog * initLog) -: m_VJournalVctr(0), m_VEventVctr(0), m_VTodoVctr(0), - m_VTimeZoneVctr(0), m_VFreebusyVctr(0), m_XTokensVctr(0), - m_CalScale(0), -#if 0 - m_Source(0), m_Name(0), -#endif - m_Version(0), - m_Prodid(0), m_iMethod(0) -{ - //PR_ASSERT(m_Log != 0); - m_Log = initLog; -} -//--------------------------------------------------------------------- -NSCalendar::NSCalendar(NSCalendar & that) -: m_VJournalVctr(0), m_VEventVctr(0), m_VTodoVctr(0), - m_VTimeZoneVctr(0), m_VFreebusyVctr(0), m_XTokensVctr(0), -#if 0 - m_Source(0), m_Name(0), -#endif - m_CalScale(0), m_Version(0), m_Prodid(0) -{ - m_iMethod = that.m_iMethod; - // copy component vectors - if (that.m_VJournalVctr != 0) - { - m_VJournalVctr = new JulianPtrArray(); PR_ASSERT(m_VJournalVctr != 0); - if (m_VJournalVctr != 0) - { - ICalComponent::cloneICalComponentVector(m_VJournalVctr, that.m_VJournalVctr); - } - } - if (that.m_VEventVctr != 0) - { - m_VEventVctr = new JulianPtrArray(); PR_ASSERT(m_VEventVctr != 0); - if (m_VEventVctr != 0) - { - ICalComponent::cloneICalComponentVector(m_VEventVctr, that.m_VEventVctr); - } - } - if (that.m_VTodoVctr != 0) - { - m_VTodoVctr = new JulianPtrArray(); PR_ASSERT(m_VTodoVctr != 0); - if (m_VTodoVctr != 0) - { - ICalComponent::cloneICalComponentVector(m_VTodoVctr, that.m_VTodoVctr); - } - } - if (that.m_VTimeZoneVctr != 0) - { - m_VTimeZoneVctr = new JulianPtrArray(); PR_ASSERT(m_VTimeZoneVctr != 0); - if (m_VTimeZoneVctr != 0) - { - ICalComponent::cloneICalComponentVector(m_VTimeZoneVctr, that.m_VTimeZoneVctr); - } - } - if (that.m_VFreebusyVctr != 0) - { - m_VFreebusyVctr = new JulianPtrArray(); PR_ASSERT(m_VFreebusyVctr != 0); - if (m_VFreebusyVctr != 0) - { - ICalComponent::cloneICalComponentVector(m_VFreebusyVctr, that.m_VFreebusyVctr); - } - } - // clone xtokens - if (that.m_XTokensVctr != 0) - { - m_XTokensVctr = new JulianPtrArray(); PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - ICalProperty::CloneUnicodeStringVector(that.m_XTokensVctr, m_XTokensVctr); - } - } - // clone ICalProperties. - if (that.m_CalScale != 0) - { - m_CalScale = that.m_CalScale->clone(m_Log); - } - if (that.m_Version != 0) - { - m_Version = that.m_Version->clone(m_Log); - } - if (that.m_Prodid != 0) - { - m_Prodid = that.m_Prodid->clone(m_Log); - } -#if 0 - if (that.m_Source != 0) - { - m_Source = that.m_Source->clone(m_Log); - } - if (that.m_Name != 0) - { - m_Name = that.m_Name->clone(m_Log); - } -#endif - - -} -//--------------------------------------------------------------------- -NSCalendar::~NSCalendar() -{ - if (m_VEventVctr != 0) - { - ICalComponent::deleteICalComponentVector(m_VEventVctr); - delete m_VEventVctr; m_VEventVctr = 0; - } - if (m_VFreebusyVctr != 0) - { - ICalComponent::deleteICalComponentVector(m_VFreebusyVctr); - delete m_VFreebusyVctr; m_VFreebusyVctr = 0; - } - if (m_VJournalVctr != 0) - { - ICalComponent::deleteICalComponentVector(m_VJournalVctr); - delete m_VJournalVctr; m_VJournalVctr = 0; - } - if (m_VTodoVctr!= 0) - { - ICalComponent::deleteICalComponentVector(m_VTodoVctr); - delete m_VTodoVctr; m_VTodoVctr = 0; - } - if (m_VTimeZoneVctr!= 0) - { - ICalComponent::deleteICalComponentVector(m_VTimeZoneVctr); - delete m_VTimeZoneVctr; m_VTimeZoneVctr = 0; - } - - if (m_CalScale != 0) - { - delete m_CalScale; m_CalScale = 0; - } - if (m_Prodid != 0) - { - delete m_Prodid; m_Prodid = 0; - } - if (m_Version != 0) - { - delete m_Version; m_Version = 0; - } -#if 0 - if (m_Name != 0) - { - delete m_Name; m_Name = 0; - } - if (m_Source != 0) - { - delete m_Source; m_Source = 0; - } -#endif - - //if (m_Method != 0) { delete m_Method; m_Method = 0; } - - if (m_XTokensVctr != 0) - { - ICalComponent::deleteUnicodeStringVector(m_XTokensVctr); - delete m_XTokensVctr; m_XTokensVctr = 0; - } -} -//--------------------------------------------------------------------- - -/* - * Returns: - * TRUE if export worked - * FALSE if there was a problem - */ -void -NSCalendar::export(const char * filename, t_bool & status) -{ - FILE *f = fopen(filename, "w"); - if (f != 0) - { - char * ucc = 0; -#if 1 - UnicodeString sResult, out; - status = TRUE; - - sResult = nsCalKeyword::Instance()->ms_sBEGIN_VCALENDAR; - sResult += nsCalKeyword::Instance()->ms_sLINEBREAK; - ucc = sResult.toCString(""); - if (ucc != 0) - { - fprintf(f, ucc); - delete [] ucc; ucc = 0; - } - else - status = FALSE; - - // PRINT Calendar Properties - sResult = createCalendarHeader(out); - ucc = sResult.toCString(""); - if (ucc != 0) - { - fprintf(f, ucc); - delete [] ucc; ucc = 0; - } - else - status = FALSE; - - // PRINT X-TOKENS - sResult = ICalProperty::vectorToICALString(getXTokens(), out); - ucc = sResult.toCString(""); - if (ucc != 0) - { - fprintf(f, ucc); - delete [] ucc; ucc = 0; - } - else - status = FALSE; - - // PRINT Calendar Components - status |= printComponentVectorToFile(getTimeZones(), f); - status |= printComponentVectorToFile(getEvents(), f); - status |= printComponentVectorToFile(getTodos(), f); - status |= printComponentVectorToFile(getJournals(), f); - status |= printComponentVectorToFile(getVFreebusy(), f); - - sResult = nsCalKeyword::Instance()->ms_sEND_VCALENDAR; - sResult += nsCalKeyword::Instance()->ms_sLINEBREAK; - ucc = sResult.toCString(""); - if (ucc != 0) - { - fprintf(f, ucc); - delete [] ucc; ucc = 0; - } - else - status = FALSE; - -#else - char * ucc = toICALString().toCString(""); - if (ucc != 0) - { - size_t iLen = strlen(ucc); - size_t iCountWritten = fwrite(ucc, iLen, 1, f); - delete [] ucc; ucc = 0; - status = (iCountWritten == 1) ? TRUE : FALSE; - } - else - { - status = FALSE; - } -#endif - int iRet = fclose(f); - if (0 != iRet) - { - //int iError =errno; - status = FALSE; - } - } - else - { - status = FALSE; - } -} - -//--------------------------------------------------------------------- - -NSCalendar * -NSCalendar::clone(JLog * initLog) -{ - m_Log = initLog; - return new NSCalendar(*this); -} - -//--------------------------------------------------------------------- - -void -NSCalendar::parse(ICalReader * brFile, - UnicodeString & fileName, - nsCalUtility::MimeEncoding encoding) -{ - - UnicodeString strLine, propName, propVal; - - JulianPtrArray * parameters = new JulianPtrArray(); - PR_ASSERT(parameters != 0 && brFile != 0); - - if (parameters == 0 || brFile == 0) - return; - - t_bool bNextComponent = FALSE; - - ErrorCode status = ZERO_ERROR; - UnicodeString sOK; - UnicodeString u, sName; - ICalComponent * ic; - t_bool bUpdatedComponent; - - UnicodeString uid; -#if 0 - DateTime d; - UnicodeString rid; -#endif - if (fileName.size() > 0) - { - // TODO: set filename - } - while (TRUE) - { - PR_ASSERT(brFile != 0); - brFile->readFullLine(strLine, status); - ICalProperty::Trim(strLine); - - if (FAILURE(status) && strLine.size() == 0) - break; - - ICalProperty::parsePropertyLine(strLine, propName, - propVal, parameters); - - if (strLine.size() == 0) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - continue; - } - - // break for "END:" line - else if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0)) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - // if parsing of multiple calendars allowed, continue in loop. - if (m_bLoadMultipleCalendars) - continue; - else - break; - } - else - { - if (propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - bNextComponent = TRUE; - sName = propVal; - - while (bNextComponent) - { - // TODO: finish - ic = ICalComponentFactory::Make(sName, m_Log); - if (ic != 0) - { - if (m_Log) m_Log->addEventErrorEntry(); - sOK = ic->parse(brFile, methodToString(getMethod(), u), - sOK, getTimeZones()); - - // TODO: finish smart, multiple handling -#if 0 - if (m_bLoadMultipleCalendars) - { - // if multiple calendars can be loaded, - // then I could overwrite events no matter what (lazy) , or check - // if the sequence number is greater and then overwrite (smart) - // TODO: finish - - JulianPtrArray * out = new JulianPtrArray(); - PR_ASSERT(out != 0); - - if (m_bSmartLoading) - { - // Smart multiple handling, overwrite only if component is old - // TODO: make it getMatchingComponents (handle recid) - getComponentsWithType(out, ic->getUID(), ic->GetType()); - if (out->GetSize() == 0) - { - if (ic->isValid()) - { - bUpdatedComponent = addComponentWithType(ic, ic->GetType()); - if (bUpdatedComponent) - { - delete ic; ic = 0; - } - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidComponent, 300); - delete ic; ic = 0; - } - } - else - { - if (ic->getSequence() > getMaximumSequence(out) && - (ic->isValid())) - { - removeComponents(out); - bUpdatedComponent = addComponentWithType(ic, ic->GetType()); - if (bUpdatedComponent) - { - delete ic; ic = 0; - } - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidComponent, 300); - delete ic; ic = 0; - } - } - } - else - { - // Lazy multiple handling, overwrite if component matches - // TODO: make it getMatchingComponents (handle recid) - getComponentsWithType(out, ic->getUID(), ic->GetType()); - if (out->GetSize() == 0) - { - if (ic->isValid()) - { - bUpdatedComponent = addComponentWithType(ic, ic->GetType()); - if (bUpdatedComponent) - { - delete ic; ic = 0; - } - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidComponent, 300); - delete ic; ic = 0; - } - } - else - { - if (ic->isValid()) - { - removeComponents(out); - bUpdatedComponent = addComponentWithType(ic, ic->GetType()); - if (bUpdatedComponent) - { - delete ic; ic = 0; - } - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidComponent, 300); - delete ic; ic = 0; - } - } - } - delete out; out = 0; - } - else - { - // not multiple handling - if (ic->isValid()) - { - bUpdatedComponent = addComponentWithType(ic, ic->GetType()); - if (bUpdatedComponent) - { - delete ic; ic = 0; - } - //addComponent(ic, sName); - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidComponent, 300); - delete ic; ic = 0; - } - } -#else // #if 0 - - //if (ic->isValid() && ic->getUID().size() > 0) - if (ic->isValid()) - { - //addComponent(ic, sName); - bUpdatedComponent = addComponentWithType(ic, ic->GetType()); - if (m_Log) - { - m_Log->setCurrentEventLogComponentType((nsCalLogErrorVector::ECompType) ic->GetType()); - m_Log->setCurrentEventLogValidity(TRUE); - uid = ""; -#if 0 - rid = ""; -#endif - if (ic->GetType() == ICalComponent::ICAL_COMPONENT_VEVENT || - ic->GetType() == ICalComponent::ICAL_COMPONENT_VTODO || - ic->GetType() == ICalComponent::ICAL_COMPONENT_VJOURNAL) - { - uid = ((TimeBasedEvent *) ic)->getUID(); -#if 0 - d = ((TimeBasedEvent *) ic)->getRecurrenceID(); - if (d.isValid()) - rid = d.toISO8601(); -#endif - } - else if (ic->GetType() == ICalComponent::ICAL_COMPONENT_VFREEBUSY) - { - uid = ((VFreebusy *) ic)->getUID(); - } - else if (ic->GetType() == ICalComponent::ICAL_COMPONENT_VTIMEZONE) - { - uid = ((VTimeZone *) ic)->getTZID(); - } -#if 0 - m_Log->setUIDRecurrenceID(uid, rid); -#else - m_Log->setUID(uid); -#endif - } - if (bUpdatedComponent) - { - delete ic; ic = 0; - } - } - else - { - if (m_Log) - { - //m_Log->setCurrentEventLogComponentType((nsCalLogErrorVector::ECompType) ic->GetType()); - // make invalid event errors go to NSCALENDAR - m_Log->setCurrentEventLogComponentType(nsCalLogErrorVector::ECompType_NSCALENDAR); - m_Log->setCurrentEventLogValidity(FALSE); - uid = ""; -#if 0 - rid = ""; -#endif - if (ic->GetType() == ICalComponent::ICAL_COMPONENT_VEVENT || - ic->GetType() == ICalComponent::ICAL_COMPONENT_VTODO || - ic->GetType() == ICalComponent::ICAL_COMPONENT_VJOURNAL) - { - uid = ((TimeBasedEvent *) ic)->getUID(); -#if 0 - d = ((TimeBasedEvent *) ic)->getRecurrenceID(); - if (d.isValid()) - rid = d.toISO8601(); -#endif - } - else if (ic->GetType() == ICalComponent::ICAL_COMPONENT_VFREEBUSY) - { - uid = ((VFreebusy *) ic)->getUID(); - } - else if (ic->GetType() == ICalComponent::ICAL_COMPONENT_VTIMEZONE) - { - uid = ((VTimeZone *) ic)->getTZID(); - } -#if 0 - m_Log->setUIDRecurrenceID(uid, rid); -#else - m_Log->setUID(uid); -#endif - } - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidComponent, 300); -#if 0 - if (m_Log) - { - // Print the REQUEST-STATUS of the deleted event. - if (ic->getRequestStatus() != 0) - { - UnicodeString * uPtr; - t_int32 ii; - for (ii = 0; ii < ic->getRequestStatus()->GetSize(); ii++) - { - uPtr = (UnicodeString *) ic->getRequestStatus()->GetAt(ii); - m_Log->logError(*uPtr); - } - } - } -#endif // #if 0 - delete ic; ic = 0; - } -#endif // #else - if (sOK.compareIgnoreCase(nsCalKeyword::Instance()->ms_sOK) == 0) - bNextComponent = FALSE; - else - { - if (sOK.startsWith("BEGIN:")) - { - bNextComponent = TRUE; - // TODO: i'm extracting after 6, that means I'm assuming "BEGIN:whatever" - sName = sOK.extractBetween(6, sOK.size(), sName); - } - else - bNextComponent = FALSE; - } - } - else - bNextComponent = FALSE; - - //----- - if (ICalProperty::IsXToken(sName)) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - if (m_Log) - { - m_Log->addEventErrorEntry(); - //m_Log->setCurrentEventLogComponentType(nsCalLogErrorVector::ECompType_XCOMPONENT); - // make x-toekn errors go to NSCALENDAR - m_Log->setCurrentEventLogComponentType(nsCalLogErrorVector::ECompType_NSCALENDAR); - } - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iXTokenComponentIgnored, - nsCalKeyword::Instance()->ms_sNSCALENDAR, sName, 200); - - // Ignore all lines between BEGIN:X-COMPONENT and END:X-COMPONENT - while (TRUE) - { - brFile->readFullLine(strLine, status); - if (FAILURE(status) && strLine.size() == 0) - break; - ICalProperty::parsePropertyLine(strLine, propName, propVal, parameters); - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - (propVal.compareIgnoreCase(sName) == 0)) - { - // correct end of X-Component parsing - break; - } - else if ( - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0)) || - - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - ((propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) || - (ICalProperty::IsXToken(propVal))))) - - { - // incorrect end of X-Component parsing, log an error - // ends with END:VCALENDAR or BEGIN:VCALENDAR, VEVENT, VTODO, VJOURNAL, VFREEBUSY, VTIMEZONE - // or BEGIN:X-token - - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iAbruptEndOfParsing, - nsCalKeyword::Instance()->ms_sNSCALENDAR, strLine, 300); - sOK = propName; - sOK += nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - sOK += propVal; - bNextComponent = TRUE; - sName = propVal; - break; - } - } - } - //----- - //if (ic == 0 || (!bNextComponent)) - if (ic == 0 && (!bNextComponent)) - { - break; - } - } - } - else - { - if (m_Log) m_Log->setCurrentEventLogComponentType(nsCalLogErrorVector::ECompType_NSCALENDAR); - storeData(strLine, propName, propVal, parameters); - - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - } - } - } - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - delete parameters; parameters = 0; - expandAllComponents(); - //selfCheck(); -} - -//--------------------------------------------------------------------- - -t_bool NSCalendar::storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters) -{ - t_int32 i; - - t_int32 hashCode = propName.hashCode(); - if (nsCalKeyword::Instance()->ms_ATOM_VERSION == hashCode) - { - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVCALENDAR, strLine, 100); - } - setVersion(propVal, parameters); - return TRUE; - } - else if (nsCalKeyword::Instance()->ms_ATOM_PRODID == hashCode) - { - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVCALENDAR, strLine, 100); - } - setProdid(propVal, parameters); - return TRUE; - } - else if (nsCalKeyword::Instance()->ms_ATOM_CALSCALE == hashCode) - { - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVCALENDAR, strLine, 100); - } - // if propVal != CALSCALE, just log, - // will set to GREGORIAN later. - if (nsCalKeyword::Instance()->ms_ATOM_GREGORIAN != propVal.hashCode()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyValue, - nsCalKeyword::Instance()->ms_sVCALENDAR, - propName, propVal, 200); - } - - setCalScale(propVal, parameters); - return TRUE; - } - else if (nsCalKeyword::Instance()->ms_ATOM_METHOD == hashCode) - { - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVCALENDAR, strLine, 100); - } - i = stringToMethod(propVal); - if (i < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyValue, - nsCalKeyword::Instance()->ms_sVCALENDAR, - propName, propVal, 200); - } - else - { - if (getMethod() >= 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVCALENDAR, - propName, propVal, 100); - } - setMethod((NSCalendar::METHOD) i); - } - return TRUE; - } - else if (ICalProperty::IsXToken(propName)) - { - addXTokens(strLine); - - return TRUE; - } -#if 0 - else if (nsCalKeyword::Instance()->ms_ATOM_SOURCE == hashCode) - { - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVCALENDAR, strLine, 100); - } - setSource(propVal, parameters); - return TRUE; - } - else if (nsCalKeyword::Instance()->ms_ATOM_NAME == hashCode) - { - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVCALENDAR, strLine, 100); - } - setName(propVal, parameters); - return TRUE; - } -#endif - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyName, - nsCalKeyword::Instance()->ms_sVCALENDAR, - propName, 200); - - return FALSE; - } -} -//--------------------------------------------------------------------- - -void -NSCalendar::expandAllComponents() -{ - JulianPtrArray * v = 0; - v = getEvents(); - expandTBEVector(v, ICalComponent::ICAL_COMPONENT_VEVENT); - - v = getTodos(); - expandTBEVector(v, ICalComponent::ICAL_COMPONENT_VTODO); - - v = getJournals(); - expandTBEVector(v, ICalComponent::ICAL_COMPONENT_VJOURNAL); -} - -//--------------------------------------------------------------------- - -void -NSCalendar::expandTBEVector(JulianPtrArray * v, - ICalComponent::ICAL_COMPONENT type) -{ - // no need to expand if method is a decline-counter or refresh - if (v != 0 && (m_iMethod != METHOD_DECLINECOUNTER && m_iMethod != METHOD_REFRESH)) - { - t_int32 i; - TimeBasedEvent * tbe = 0; - for (i = v->GetSize() - 1; i >= 0; i--) - { - tbe = (TimeBasedEvent *) v->GetAt(i); - if (tbe->isExpandableEvent()) - { - expandComponent(tbe, type); - - // remove old event - v->RemoveAt(i); - delete tbe; tbe = 0; - } - } - } -} - -//--------------------------------------------------------------------- - -void -NSCalendar::expandComponent(TimeBasedEvent * tbe, - ICalComponent::ICAL_COMPONENT type) -{ - JulianPtrArray * v = new JulianPtrArray(); PR_ASSERT(v != 0); - if (v != 0) - { - // create the components and fill them in v, passing in timezone vector - tbe->createRecurrenceEvents(v, getTimeZones()); - - // add each component to correct vector. - if (v->GetSize() > 0) - { - //UnicodeString uDebug; - //if (FALSE) TRACE("Expandable event\r\n\t%s\n\tbeing expanded", tbe->toString(uDebug).toCString("")); - t_int32 i; - ICalComponent * ic = 0; - t_bool bUpdatedComponent = FALSE; - for (i = 0; i < v->GetSize(); i++) - { - ic = (ICalComponent *) v->GetAt(i); - bUpdatedComponent = addComponentWithType(ic, type); - if (bUpdatedComponent) - { - delete ic; ic = 0; - } - } - } - delete v; v = 0; - } -} - -//--------------------------------------------------------------------- - -JulianPtrArray * -NSCalendar::getLogVector(ICalComponent * ic) -{ - if (m_Log && ic) - { - JulianPtrArray * vvError = 0; - vvError = m_Log->GetErrorVector(); - if (vvError != 0) - { - t_int32 i = 0; - nsCalLogErrorVector * lev = 0; - UnicodeString uid; -#if 0 - UnicodeString rid; -#endif - ICalComponent::ICAL_COMPONENT icType; - icType = ic->GetType(); - if (icType == ICalComponent::ICAL_COMPONENT_VEVENT || - icType == ICalComponent::ICAL_COMPONENT_VTODO || - icType == ICalComponent::ICAL_COMPONENT_VJOURNAL) - { -#if 0 - DateTime d; - d = ((TimeBasedEvent *) ic)->getRecurrenceID(); - if (d.isValid()) - rid = d.toISO8601(); -#endif - uid = ((TimeBasedEvent *) ic)->getUID(); - } - else if (icType == ICalComponent::ICAL_COMPONENT_VFREEBUSY) - { - uid = ((VFreebusy *) ic)->getUID(); - } - else if (icType == ICalComponent::ICAL_COMPONENT_VTIMEZONE) - { - uid = ((VTimeZone *) ic)->getTZID(); - } - - for (i = 0; i < vvError->GetSize(); i++) - { - lev = (nsCalLogErrorVector *) vvError->GetAt(i); - if ((lev->GetComponentType() == (nsCalLogErrorVector::ECompType) ic->GetType()) && - (lev->GetUID() == uid) -#if 0 - && (lev->GetRecurrenceID() == rid) -#endif - ) - return (lev->GetErrors()); - } - } - } - return 0; -} - -//--------------------------------------------------------------------- - -JulianPtrArray * -NSCalendar::getLogVector() -{ - if (m_Log) - { - JulianPtrArray * vvError = 0; - vvError = m_Log->GetErrorVector(); - if (vvError != 0) - { - t_int32 i = 0; - nsCalLogErrorVector * lev = 0; - for (i = 0; i < vvError->GetSize(); i++) - { - lev = (nsCalLogErrorVector *) vvError->GetAt(i); - if (lev->GetComponentType() == nsCalLogErrorVector::ECompType_NSCALENDAR) - return (lev->GetErrors()); - } - } - } - return 0; -} - -//--------------------------------------------------------------------- - -UnicodeString NSCalendar::toString() -{ - UnicodeString sResult, s, out; - s = nsCalKeyword::Instance()->ms_sPRODID; - sResult += ICalProperty::propertyToICALString(s, getProdidProperty(), out); - s = nsCalKeyword::Instance()->ms_sCALSCALE; - sResult += ICalProperty::propertyToICALString(s, getCalScaleProperty(), out); - s = nsCalKeyword::Instance()->ms_sVERSION; - sResult += ICalProperty::propertyToICALString(s, getVersionProperty(), out); -#if 0 - s = nsCalKeyword::Instance()->ms_sNAME; - sResult += ICalProperty::propertyToICALString(s, getNameProperty(), out); - s = nsCalKeyword::Instance()->ms_sSOURCE; - sResult += ICalProperty::propertyToICALString(s, getSourceProperty(), out); -#endif - // print method - sResult += nsCalKeyword::Instance()->ms_sMETHOD; - sResult += nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - sResult += methodToString(getMethod(), out); - - sResult += nsCalKeyword::Instance()->ms_sLINEBREAK; - //sResult += ICalProperty::propertyToICALString(s, getMethodProperty(), sResult); - - return sResult; -} - -//--------------------------------------------------------------------- - -UnicodeString & -NSCalendar::createCalendarHeader(UnicodeString & sResult) -{ - UnicodeString s, out; - sResult = ""; - s = nsCalKeyword::Instance()->ms_sPRODID; - sResult += ICalProperty::propertyToICALString(s, getProdidProperty(), out); - s = nsCalKeyword::Instance()->ms_sCALSCALE; - sResult += ICalProperty::propertyToICALString(s, getCalScaleProperty(), out); - s = nsCalKeyword::Instance()->ms_sVERSION; - sResult += ICalProperty::propertyToICALString(s, getVersionProperty(), out); -#if 0 - s = nsCalKeyword::Instance()->ms_sNAME; - sResult += ICalProperty::propertyToICALString(s, getNameProperty(), out); - s = nsCalKeyword::Instance()->ms_sSOURCE; - sResult += ICalProperty::propertyToICALString(s, getSourceProperty(), out); -#endif - // print method enum - sResult += nsCalKeyword::Instance()->ms_sMETHOD; - sResult += nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - sResult += methodToString(getMethod(), out); - sResult += nsCalKeyword::Instance()->ms_sLINEBREAK; - //sResult += ICalProperty::propertyToICALString(s, getMethodProperty(), out); - - return sResult; -} - -//--------------------------------------------------------------------- - -UnicodeString NSCalendar::toICALString() -{ - UnicodeString sResult, out; - sResult = nsCalKeyword::Instance()->ms_sBEGIN_VCALENDAR; - sResult += nsCalKeyword::Instance()->ms_sLINEBREAK; - sResult += createCalendarHeader(out); - sResult += ICalProperty::vectorToICALString(getXTokens(), out); - //if (FALSE) TRACE("out = %s", out.toCString("")); - - // PRINT Calendar Components - sResult += printComponentVector(getTimeZones(), out); - sResult += printComponentVector(getEvents(), out); - sResult += printComponentVector(getVFreebusy(), out); - sResult += printComponentVector(getTodos(), out); - sResult += printComponentVector(getJournals(), out); - sResult += nsCalKeyword::Instance()->ms_sEND_VCALENDAR; - sResult += nsCalKeyword::Instance()->ms_sLINEBREAK; - return sResult; -} -//--------------------------------------------------------------------- -VEvent * NSCalendar::getEvent(UnicodeString sUID, t_int32 iSeqNo) -{ - return (VEvent *) NSCalendar::getComponent(getEvents(), sUID, iSeqNo); -} -//--------------------------------------------------------------------- -VTodo * NSCalendar::getTodo(UnicodeString sUID, t_int32 iSeqNo) -{ - return (VTodo *) NSCalendar::getComponent(getTodos(), sUID, iSeqNo); -} -//--------------------------------------------------------------------- -VJournal * NSCalendar::getJournal(UnicodeString sUID, t_int32 iSeqNo) -{ - return (VJournal *) NSCalendar::getComponent(getJournals(), sUID, iSeqNo); -} -//--------------------------------------------------------------------- -VFreebusy * NSCalendar::getVFreebusy(UnicodeString sUID, t_int32 iSeqNo) -{ - return (VFreebusy *) NSCalendar::getComponent(getVFreebusy(), sUID, iSeqNo); -} -//--------------------------------------------------------------------- - -ICalComponent * -NSCalendar::getComponent(JulianPtrArray * vTBE, - UnicodeString & sUID, t_int32 iSeqNo) - -{ - ICalComponent * e = 0; - t_int32 i; - if (vTBE != 0 && sUID.size() > 0) - { - if (iSeqNo != -1) { - - for (i = 0; i < vTBE->GetSize(); i++) - { - e = (ICalComponent *) vTBE->GetAt(i); - if (e->MatchUID_seqNO(sUID, iSeqNo)) - return e; - } - } - else - { - for (i = 0; i < vTBE->GetSize(); i++) - { - e = (ICalComponent *) vTBE->GetAt(i); - if (e->getUID().compareIgnoreCase(sUID) == 0) - return e; - } - } - } - return 0; -} -//--------------------------------------------------------------------- -JulianPtrArray * NSCalendar::changeEventsOwnership() -{ - JulianPtrArray * out = m_VEventVctr; - m_VEventVctr = 0; - return out; -} -//--------------------------------------------------------------------- -void NSCalendar::updateEventsRange(DateTime dStart, DateTime dEnd) -{ - if (dStart.isValid()) - { - if (!m_EventsSpanStart.isValid()) - m_EventsSpanStart = dStart; - else - { - if (m_EventsSpanStart.afterDateTime(dStart)) - m_EventsSpanStart = dStart; - } - - /* - * set m_EventsSpanEnd to dStart if dEnd. not valid and m_EventsSpanNotSet - */ - if (!m_EventsSpanEnd.isValid() && (!dEnd.isValid())) - { - m_EventsSpanEnd = dStart; - } - } - - if (dEnd.isValid()) - { - if (!m_EventsSpanEnd.isValid()) - m_EventsSpanEnd = dEnd; - else - { - if (m_EventsSpanEnd.beforeDateTime(dEnd)) - m_EventsSpanEnd = dEnd; - } - } -} -void NSCalendar::updateEventsRange(VEvent * v) -{ - PR_ASSERT(v->isValid()); - updateEventsRange( v->getDTStart(), v->getDTEnd() ); -} -//--------------------------------------------------------------------- -void NSCalendar::addEvent(ICalComponent * v) -{ - if (m_VEventVctr == 0) - m_VEventVctr = new JulianPtrArray(); - PR_ASSERT(m_VEventVctr != 0); - if (m_VEventVctr != 0) - { - PR_ASSERT(ICalComponent::ICAL_COMPONENT_VEVENT == v->GetType()); - updateEventsRange((VEvent *) v); - m_VEventVctr->Add(v); - //m_VEventVctr->InsertBinary(v, TimeBasedEvent::CompareTimeBasedEventsByDTStart); - } -} -//--------------------------------------------------------------------- -void NSCalendar::addEventList(JulianPtrArray* pEventList) -{ - int j; - ICalComponent* pEvent; - if (0 != pEventList) - { - for (j = 0; j < pEventList->GetSize(); j++) - { - pEvent = (ICalComponent*)pEventList->GetAt(j); - if (0 != pEvent) - addEvent(pEvent); - } - } -} -//--------------------------------------------------------------------- -void NSCalendar::addTodo(ICalComponent * v) -{ - if (m_VTodoVctr == 0) - m_VTodoVctr = new JulianPtrArray(); - PR_ASSERT(m_VTodoVctr != 0); - if (m_VTodoVctr != 0) - { - m_VTodoVctr->Add(v); - //m_VTodoVctr->InsertBinary(v, TimeBasedEvent::CompareTimeBasedEventsByDTStart); - } -} -//--------------------------------------------------------------------- -void NSCalendar::addJournal(ICalComponent * v) -{ - if (m_VJournalVctr == 0) - m_VJournalVctr = new JulianPtrArray(); - PR_ASSERT(m_VJournalVctr != 0); - if (m_VJournalVctr != 0) - { - m_VJournalVctr->Add(v); - //m_VJournalVctr->InsertBinary(v, TimeBasedEvent::CompareTimeBasedEventsByDTStart); - } -} -//--------------------------------------------------------------------- -void NSCalendar::addVFreebusy(ICalComponent * v) -{ - if (m_VFreebusyVctr == 0) - m_VFreebusyVctr = new JulianPtrArray(); - PR_ASSERT(m_VFreebusyVctr != 0); - if (m_VFreebusyVctr != 0) - { - m_VFreebusyVctr->Add(v); - //m_VFreebusyVctr->InsertBinary(v, VFreebusy::CompareVFreebusyByDTStart); - } -} -//--------------------------------------------------------------------- -void NSCalendar::addTimeZone(ICalComponent * v) -{ - if (m_VTimeZoneVctr == 0) - m_VTimeZoneVctr = new JulianPtrArray(); - PR_ASSERT(m_VTimeZoneVctr != 0); - if (m_VTimeZoneVctr != 0) - { - m_VTimeZoneVctr->Add(v); - } -} -//--------------------------------------------------------------------- - -t_bool NSCalendar::addComponentWithType(ICalComponent * ic, - ICalComponent::ICAL_COMPONENT type) -{ - - ///////////// - // if already have component, just update it - JulianPtrArray * v = 0; - t_bool bUpdatedAnyComponents = FALSE; - - switch(ic->GetType()) - { - case ICalComponent::ICAL_COMPONENT_VEVENT: - v = m_VEventVctr; - break; - case ICalComponent::ICAL_COMPONENT_VTODO: - v = m_VTodoVctr; - break; - case ICalComponent::ICAL_COMPONENT_VJOURNAL: - v = m_VJournalVctr; - break; - case ICalComponent::ICAL_COMPONENT_VTIMEZONE: - v = m_VTimeZoneVctr; - break; - case ICalComponent::ICAL_COMPONENT_VFREEBUSY: - v = m_VFreebusyVctr; - break; - default: - v = 0; - } - if (v != 0) - { - t_bool bUpdated = FALSE; - t_int32 i; - ICalComponent * comp = 0; - for (i = 0; i < v->GetSize(); i++) - { - comp = (ICalComponent *) v->GetAt(i); - bUpdated = comp->updateComponent(ic); - bUpdatedAnyComponents |= bUpdated; - } - } - - if (!bUpdatedAnyComponents) - { - // Add only if not updated. - switch (type) - { - case ICalComponent::ICAL_COMPONENT_VEVENT: - addEvent(ic); - break; - case ICalComponent::ICAL_COMPONENT_VTODO: - addTodo(ic); - break; - case ICalComponent::ICAL_COMPONENT_VJOURNAL: - addJournal(ic); - break; - case ICalComponent::ICAL_COMPONENT_VTIMEZONE: - addTimeZone(ic); - break; - case ICalComponent::ICAL_COMPONENT_VFREEBUSY: - addVFreebusy(ic); - break; - default: - break; - } - } - - return bUpdatedAnyComponents; -} - -//--------------------------------------------------------------------- -#if 0 -void NSCalendar::addComponentsWithType(JulianPtrArray * components, - ICalComponent::ICAL_COMPONENT type) -{ - t_int32 i; - PR_ASSERT(components != 0); - if (components != 0) - { - for (i = 0; i < components->GetSize(); i++) - { - ICalComponent * ic = (ICalComponent *) components->GetAt(i); - addComponentWithType(ic, type); - } - } -} -#endif -//--------------------------------------------------------------------- - -void -NSCalendar::createVFreebusyHelper(Freebusy * f, DateTime start, - DateTime end) -{ - if (f != 0) - { - t_int32 i; - - DateTime startP; - - DateTime endP; - - Period period; - period.setStart(start); - period.setEnd(end); - - VEvent * ev; - - Period * p; - - f->setType(Freebusy::FB_TYPE_BUSY); -#if 0 - f->setStatus(Freebusy::FB_STATUS_BUSY); -#endif - JulianPtrArray * v = getEvents(); - - if (v != 0) - { - for (i = 0; i < v->GetSize(); i++) - { - ev = (VEvent *) v->GetAt(i); - - // must be opaque - if (ev->getTransp() == nsCalKeyword::Instance()->ms_sOPAQUE) - { - startP = ev->getDTStart(); - endP = ((ev->isAllDayEvent()) ? start : ev->getDTEnd()); - - if (period.isIntersecting(startP, endP)) - { - startP = ((start > startP) ? start : startP); - - endP = ((end < endP) ? end : endP); - - p = new Period(); PR_ASSERT(p != 0); - if (p != 0) - { - p->setStart(startP); - p->setEnd(endP); - f->addPeriod(p); - delete p; p = 0; - } - } - } - } - } - } -} - -//--------------------------------------------------------------------- - -VFreebusy * -NSCalendar::createVFreebusy(DateTime start, DateTime end) -{ - - // set freebusy type and status to busy - Freebusy * f = new Freebusy(m_Log); PR_ASSERT(f != 0); - createVFreebusyHelper(f, start, end); - - // create the vfreebusy - VFreebusy * vf = new VFreebusy(m_Log); - PR_ASSERT(vf != 0); - if (vf != 0) - { - DateTime dCreated; - /*vf->setCreated(dCreated);*/ - vf->setLastModified(dCreated); - vf->setDTStart(start); - vf->setDTEnd(end); - UnicodeString us = "vfbreply@hostname.com"; - - vf->setUID(nsCalUIDRandomGenerator::generate(us)); - vf->setSequence(0); - if (f != 0) - { - vf->addFreebusy(f); - } - vf->normalize(); - } - return vf; -} - -//--------------------------------------------------------------------- - -void NSCalendar::calculateVFreebusy(VFreebusy * toFillIn) -{ - if (toFillIn != 0) - { - DateTime start, end; - start = toFillIn->getDTStart(); - end = toFillIn->getDTEnd(); - - if (start.isValid() && - end.isValid() && - !start.afterDateTime(end)) - { - DateTime currentTime; - - // remove all old freebusy periods - toFillIn->removeAllFreebusy(); - - Freebusy * f = new Freebusy(m_Log); PR_ASSERT(f != 0); - createVFreebusyHelper(f, start, end); - if (f != 0) - { - toFillIn->addFreebusy(f); - } - toFillIn->normalize(); - toFillIn->setLastModified(currentTime); - } - } -} - -//--------------------------------------------------------------------- - -t_bool -NSCalendar::printComponentVectorToFile(JulianPtrArray * components, - FILE * f) -{ - t_bool bWrittenOK = TRUE; - if (components != 0 && f != 0) - { - UnicodeString out; - ICalComponent * ic = 0; - char * occ = 0; - t_int32 i; - for (i = 0; i < components->GetSize(); i++) - { - ic = (ICalComponent *) components->GetAt(i); - out = ic->toICALString(); - occ = out.toCString(""); - if (occ != 0) - { - fprintf(f, occ); - delete [] occ; occ = 0; - } - else - { - bWrittenOK = FALSE; - break; - } - } - } - return bWrittenOK; -} - -//--------------------------------------------------------------------- - -UnicodeString & -NSCalendar::printComponentVector(JulianPtrArray * components, - UnicodeString & out) -{ - out = ""; - - if (components != 0) - { - ICalComponent * ic = 0; - t_int32 i; - for (i = 0; i < components->GetSize(); i++) - { - ic = (ICalComponent *) components->GetAt(i); - out += ic->toICALString(); - } - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -NSCalendar::printFilteredComponentVector(JulianPtrArray * components, - UnicodeString & strFmt, - UnicodeString & out) -{ - t_int32 i; - out = ""; - - if (components != 0) - { - UnicodeString u; - for (i = 0; i < components->GetSize(); i++) - { - ICalComponent * ic = (ICalComponent *) components->GetAt(i); - u = ICalComponent::componentToString(ic->GetType()); - out += ic->format(u, strFmt, "", FALSE); - } - } - return out; -} - -//--------------------------------------------------------------------- -#if 0 -UnicodeString & -NSCalendar::printFilteredComponentVectorWithProperties(JulianPtrArray * components, - char ** ppsPropList, - t_int32 iPropCount, - UnicodeString & out) -{ - UnicodeString strFmt; - out = ""; - strFmt = ICalComponent::makeFormatString(ppsPropList, iPropCount, strFmt); - out = printFilteredComponentVector(components, strFmt, out); - return out; -} -#endif -//--------------------------------------------------------------------- - -UnicodeString & -NSCalendar::debugPrintComponentVector(JulianPtrArray * components, - const UnicodeString sType, - UnicodeString & out) -{ - t_int32 i; - out = ""; - - if (components != 0) - { - char num[10]; - sprintf(num, "%d", components->GetSize()); - out += "----"; - out += sType; - out += "'s ---- N = "; - out += num; - out += "-------- \r\n"; - - for (i = 0; i < components->GetSize(); i++) - { - ICalComponent * ic = (ICalComponent *) components->GetAt(i); - sprintf(num, "%d", i + 1); - out += num; - out += ")\t"; - out += ic->toString(); - out += nsCalKeyword::Instance()->ms_sLINEBREAK; - } - } - else - { - out += "----"; out += sType; out += "'s ---- N = 0 --------\r\n"; - } - return out; -} - -//--------------------------------------------------------------------- - -void -NSCalendar::getUniqueUIDs(JulianPtrArray * retUID, - ICalComponent::ICAL_COMPONENT type) -{ - // only handle VEvent, VTodo, VJournal, VFreebusy - switch (type) - { - case ICalComponent::ICAL_COMPONENT_VEVENT: - getUniqueUIDsHelper(retUID, getEvents(), type); - break; - case ICalComponent::ICAL_COMPONENT_VTODO: - getUniqueUIDsHelper(retUID, getTodos(), type); - break; - case ICalComponent::ICAL_COMPONENT_VJOURNAL: - getUniqueUIDsHelper(retUID, getJournals(), type); - break; - case ICalComponent::ICAL_COMPONENT_VFREEBUSY: - getUniqueUIDsHelper(retUID, getVFreebusy(), type); - break; - default: - break; - } -} - -//--------------------------------------------------------------------- -void NSCalendar::getEventsByRange(JulianPtrArray * out, - DateTime start, DateTime end) -{ - if (out != 0) - { - if (m_VEventVctr != 0) - { - t_int32 i; - VEvent * anEvent; - for (i = 0; i < m_VEventVctr->GetSize(); i++) - { - anEvent = (VEvent *) m_VEventVctr->GetAt(i); - if (!(anEvent->getDTStart().beforeDateTime(start)) && - !(anEvent->getDTStart().afterDateTime(end))) - { - out->Add(anEvent); - } - } - } - } -} -//--------------------------------------------------------------------- -void NSCalendar::getEvents(JulianPtrArray * out, UnicodeString & sUID) -{ - getComponents(out, getEvents(), sUID); -} -//--------------------------------------------------------------------- -void NSCalendar::getEventsByComponentID(JulianPtrArray * out, - UnicodeString & sUID, - UnicodeString & sRecurrenceID, - UnicodeString & sModifier) -{ - getTBEByComponentID(out, getEvents(), sUID, sRecurrenceID, sModifier); -} -//--------------------------------------------------------------------- -void NSCalendar::getTodos(JulianPtrArray * out, UnicodeString & sUID) -{ - getComponents(out, getTodos(), sUID); -} -//--------------------------------------------------------------------- -void NSCalendar::getJournals(JulianPtrArray * out, UnicodeString & sUID) -{ - getComponents(out, getJournals(), sUID); -} -//--------------------------------------------------------------------- - -void -NSCalendar::sortComponentsByUID(ICalComponent::ICAL_COMPONENT type) -{ - switch (type) - { - // only sorts VEvent, VTodo, VJournal, VFreebusy, not VTimeZone - case ICalComponent::ICAL_COMPONENT_VEVENT: - sortComponentsByUIDHelper(getEvents(), type); - break; - case ICalComponent::ICAL_COMPONENT_VTODO: - sortComponentsByUIDHelper(getTodos(), type); - break; - case ICalComponent::ICAL_COMPONENT_VJOURNAL: - sortComponentsByUIDHelper(getJournals(), type); - break; - case ICalComponent::ICAL_COMPONENT_VFREEBUSY: - sortComponentsByUIDHelper(getVFreebusy(), type); - break; - default: - break; - } -} - -//--------------------------------------------------------------------- - -void -NSCalendar::sortComponentsByDTStart(ICalComponent::ICAL_COMPONENT type) -{ - switch (type) - { - // only sort VEvent, VTodo, VJournal, VFreebusy, not VTimeZone - case ICalComponent::ICAL_COMPONENT_VEVENT: - sortComponentsByDTStartHelper(getEvents(), type); - break; - case ICalComponent::ICAL_COMPONENT_VTODO: - sortComponentsByDTStartHelper(getTodos(), type); - break; - case ICalComponent::ICAL_COMPONENT_VJOURNAL: - sortComponentsByDTStartHelper(getJournals(), type); - break; - case ICalComponent::ICAL_COMPONENT_VFREEBUSY: - sortComponentsByDTStartHelper(getVFreebusy(), type); - break; - default: - break; - } -} - -//--------------------------------------------------------------------- - -void -NSCalendar::sortComponentsByUIDHelper(JulianPtrArray * components, - ICalComponent::ICAL_COMPONENT type) -{ - if (components != 0) - { - switch (type) - { - // only sort VEvent, VTodo, VJournal, VFreebusy - case ICalComponent::ICAL_COMPONENT_VEVENT: - case ICalComponent::ICAL_COMPONENT_VTODO: - case ICalComponent::ICAL_COMPONENT_VJOURNAL: - components->QuickSort(TimeBasedEvent::CompareTimeBasedEventsByUID); - break; - case ICalComponent::ICAL_COMPONENT_VFREEBUSY: - components->QuickSort(VFreebusy::CompareVFreebusyByUID); - break; - default: - break; - } - } -} - -//--------------------------------------------------------------------- - -void -NSCalendar::sortComponentsByDTStartHelper(JulianPtrArray * components, - ICalComponent::ICAL_COMPONENT type) -{ - if (components != 0) - { - switch (type) - { - // only sort VEvent, VTodo, VJournal, VFreebusy - case ICalComponent::ICAL_COMPONENT_VEVENT: - case ICalComponent::ICAL_COMPONENT_VTODO: - case ICalComponent::ICAL_COMPONENT_VJOURNAL: - components->QuickSort(TimeBasedEvent::CompareTimeBasedEventsByDTStart); - break; - case ICalComponent::ICAL_COMPONENT_VFREEBUSY: - components->QuickSort(VFreebusy::CompareVFreebusyByDTStart); - break; - default: - break; - } - } -} - -//--------------------------------------------------------------------- - -void -NSCalendar::getUniqueUIDsHelper(JulianPtrArray * retUID, - JulianPtrArray * components, - ICalComponent::ICAL_COMPONENT type) -{ - PR_ASSERT(retUID != 0); - if (components != 0) - { - t_int32 i; - UnicodeString u; - ICalComponent * ic; - sortComponentsByUIDHelper(components, type); - for (i = 0; i < components->GetSize(); i++) - { - ic = (ICalComponent *) components->GetAt(i); - if (i == 0) - { - u = ic->getUID(); - retUID->Add(new UnicodeString(u)); - } - else if (ic->getUID() != u) - { - u = ic->getUID(); - retUID->Add(new UnicodeString(u)); - } - } - } -} - -//--------------------------------------------------------------------- -#if 0 -void -NSCalendar::getComponentsWithType(JulianPtrArray * out, - UnicodeString & uid, - ICalComponent::ICAL_COMPONENT type) -{ - switch (type) - { - case ICalComponent::ICAL_COMPONENT_VEVENT: - getComponents(out, getEvents(), uid); - break; - case ICalComponent::ICAL_COMPONENT_VTODO: - getComponents(out, getTodos(), uid); - break; - case ICalComponent::ICAL_COMPONENT_VJOURNAL: - getComponents(out, getJournals(), uid); - break; - // TODO: add VFreebusy - default: - break; - } -} -#endif -//--------------------------------------------------------------------- - -void -NSCalendar::getTBEWithTypeByComponentID(JulianPtrArray * out, - UnicodeString & uid, - UnicodeString & sRecurrenceID, - UnicodeString & sModifier, - ICalComponent::ICAL_COMPONENT type) -{ - switch (type) - { - case ICalComponent::ICAL_COMPONENT_VEVENT: - getTBEByComponentID(out, getEvents(), uid, sRecurrenceID, sModifier); - break; - case ICalComponent::ICAL_COMPONENT_VTODO: - getTBEByComponentID(out, getTodos(), uid, sRecurrenceID, sModifier); - break; - case ICalComponent::ICAL_COMPONENT_VJOURNAL: - getTBEByComponentID(out, getJournals(), uid, sRecurrenceID, sModifier); - break; - default: - break; - } -} - -//--------------------------------------------------------------------- - -void -NSCalendar::getTBEByComponentID(JulianPtrArray * out, - JulianPtrArray * components, - UnicodeString & sUID, - UnicodeString & sRecurrenceID, - UnicodeString & sModifier) -{ - PR_ASSERT(out != 0); - if (components != 0) - { - t_int32 i; - UnicodeString uid; - TimeBasedEvent * ic; - - // NOTE: if sRecurrence is invalid (i.e. 19691231T235959Z) - // then just call getComponents - DateTime d; - d.setTimeString(sRecurrenceID); - if (!d.isValid()) - { - getComponents(out, components, sUID); - } - else - { - PR_ASSERT(d.isValid()); - nsCalRecurrenceID::RANGE aRange = nsCalRecurrenceID::RANGE_NONE; - aRange = nsCalRecurrenceID::stringToRange(sModifier); - DateTime icrid; - - for (i = 0; i < components->GetSize(); i++) - { - ic = (TimeBasedEvent *) components->GetAt(i); - - uid = ic->getUID(); - icrid = ic->getRecurrenceID(); - if (uid == sUID) - { - if (icrid.isValid()) - { - if (icrid == d) - { - // always add exact match - out->Add(ic); - } - else if (aRange == nsCalRecurrenceID::RANGE_THISANDPRIOR && - icrid.beforeDateTime(d)) - { - // also add if THISANDPRIOR and icrid < d - out->Add(ic); - } - else if (aRange == nsCalRecurrenceID::RANGE_THISANDFUTURE && - icrid.afterDateTime(d)) - { - // also add if THISANDFUTURE and icrid > d - out->Add(ic); - } - } - } - } - } - } -} - -//--------------------------------------------------------------------- - -void -NSCalendar::getComponents(JulianPtrArray * out, - JulianPtrArray * components, - UnicodeString & sUID) -{ - PR_ASSERT(out != 0); - if (components != 0) - { - t_int32 i; - UnicodeString uid; - ICalComponent * ic; - for (i = 0; i < components->GetSize(); i++) - { - ic = (ICalComponent *) components->GetAt(i); - uid = ic->getUID(); - if (uid == sUID) - { - out->Add(components->GetAt(i)); - } - //if (FALSE) TRACE("uid, sUID = (%s,%s)\r\n", uid.toCString(""), sUID.toCString("")); - } - } -} - -//--------------------------------------------------------------------- - -NSCalendar::METHOD -NSCalendar::stringToMethod(UnicodeString & method) -{ - t_int32 hashCode = method.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_PUBLISH == hashCode) return METHOD_PUBLISH; - else if (nsCalKeyword::Instance()->ms_ATOM_REQUEST == hashCode) return METHOD_REQUEST; - else if (nsCalKeyword::Instance()->ms_ATOM_REPLY == hashCode) return METHOD_REPLY; - else if (nsCalKeyword::Instance()->ms_ATOM_CANCEL == hashCode) return METHOD_CANCEL; - else if (nsCalKeyword::Instance()->ms_ATOM_REFRESH == hashCode) return METHOD_REFRESH; - else if (nsCalKeyword::Instance()->ms_ATOM_COUNTER == hashCode) return METHOD_COUNTER; - else if (nsCalKeyword::Instance()->ms_ATOM_DECLINECOUNTER == hashCode) return METHOD_DECLINECOUNTER; - else if (nsCalKeyword::Instance()->ms_ATOM_ADD == hashCode) return METHOD_ADD; - else return METHOD_INVALID; -} - -//--------------------------------------------------------------------- -#if 0 -t_bool -NSCalendar::AreStringVectorsEqual(JulianPtrArray * a, JulianPtrArray * b) -{ - // If both are null, then same - // If one is null, other is not then NOT same - // If both NOT null and different size then NOT same - // If both NOT null and same size and same contents then same - // If both NOT null and same size and different contents then NOT same - - if ((a == 0 && b != 0) || (a != 0 && b == 0)) - return FALSE; - else if (a == 0 && b == 0) - return TRUE; - else - { - // a != 0 && b != 0 - - if (a->GetSize() != b->GetSize() ) - { - return FALSE; - } - else - { - // TODO: inefficient O(n^2) - t_int32 i, j; - t_bool bIn = FALSE; - UnicodeString aus, bus; - for (i = 0; i < a->GetSize(); i++) - { - aus = *((UnicodeString *) a->GetAt(i)); - bIn = FALSE; - - // check for aus in b - for (j = 0; j < b->GetSize(); j++) - { - bus = *((UnicodeString *) b->GetAt(i)); - if (aus.compareIgnoreCase(bus) == 0) - { - bIn = TRUE; - break; - } - } - - if (!bIn) - return FALSE; - } - } - } -} -#endif -//--------------------------------------------------------------------- - -UnicodeString & NSCalendar::methodToString(NSCalendar::METHOD method, UnicodeString & out) -{ - switch(method) - { - case METHOD_PUBLISH: out = nsCalKeyword::Instance()->ms_sPUBLISH; break; - case METHOD_REQUEST: out = nsCalKeyword::Instance()->ms_sREQUEST; break; - case METHOD_REPLY: out = nsCalKeyword::Instance()->ms_sREPLY; break; - case METHOD_CANCEL: out = nsCalKeyword::Instance()->ms_sCANCEL; break; - case METHOD_REFRESH: out = nsCalKeyword::Instance()->ms_sREFRESH; break; - case METHOD_COUNTER: out = nsCalKeyword::Instance()->ms_sCOUNTER; break; - case METHOD_DECLINECOUNTER: out = nsCalKeyword::Instance()->ms_sDECLINECOUNTER; break; - case METHOD_ADD: out = nsCalKeyword::Instance()->ms_sADD; break; - default: - // TODO: Log and error?? - out = ""; - break; - } - return out; -} - -//--------------------------------------------------------------------- -// CalScale -void NSCalendar::setCalScale(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_CalScale == 0) - m_CalScale = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_CalScale->setValue((void *) &s); - m_CalScale->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_CalScale), s, parameters); -#endif -} -UnicodeString NSCalendar::getCalScale() const -{ -#if 1 - UnicodeString u; - if (m_CalScale == 0) - return ""; - else { - u = *((UnicodeString *) m_CalScale->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_CalScale), us); - return us; -#endif -} -//--------------------------------------------------------------------- -#if 0 -// Source -void NSCalendar::setSource(UnicodeString s, JulianPtrArray * parameters) -{ -#if 0 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Source == 0) - m_Source = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Source->setValue((void *) &s); - m_Source->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Source), s, parameters); -#endif -} -UnicodeString NSCalendar::getSource() const -{ -#if 0 - UnicodeString u; - if (m_Source == 0) - return ""; - else { - u = *((UnicodeString *) m_Source->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Source), us); - return us; -#endif -} -//--------------------------------------------------------------------- -// Name -void NSCalendar::setName(UnicodeString s, JulianPtrArray * parameters) -{ -#if 0 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Name == 0) - m_Name = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Name->setValue((void *) &s); - m_Name->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Name), s, parameters); -#endif -} -UnicodeString NSCalendar::getName() const -{ -#if 0 - UnicodeString u; - if (m_Name == 0) - return ""; - else { - u = *((UnicodeString *) m_Name->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Name), us); - return us; -#endif -} -#endif /* #if 0 */ -//--------------------------------------------------------------------- -// Version -void NSCalendar::setVersion(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Version == 0) - m_Version = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Version->setValue((void *) &s); - m_Version->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Version), s, parameters); -#endif -} -UnicodeString NSCalendar::getVersion() const -{ -#if 1 - UnicodeString u; - if (m_Version == 0) - return ""; - else { - u = *((UnicodeString *) m_Version->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Version), us); - return us; -#endif -} -//--------------------------------------------------------------------- -// Prodid -void NSCalendar::setProdid(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Prodid == 0) - m_Prodid = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Prodid->setValue((void *) &s); - m_Prodid->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Prodid), s, parameters); -#endif -} -UnicodeString NSCalendar::getProdid() const -{ -#if 1 - UnicodeString u; - if (m_Prodid == 0) - return ""; - else { - u = *((UnicodeString *) m_Prodid->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Prodid), us); - return us; -#endif -} -//--------------------------------------------------------------------- -// XTOKENS -void NSCalendar::addXTokens(UnicodeString s) -{ - if (m_XTokensVctr == 0) - m_XTokensVctr = new JulianPtrArray(); - PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - m_XTokensVctr->Add(new UnicodeString(s)); - } -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/orgnzr.cpp b/mozilla/calendar/modules/core/ical/src/orgnzr.cpp deleted file mode 100644 index ee69b4bfd30..00000000000 --- a/mozilla/calendar/modules/core/ical/src/orgnzr.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// orgnzr.cpp -// John Sun -// 4/7/98 11:28:26 AM - -#include "stdafx.h" -#include "jdefines.h" - -#include "orgnzr.h" -#include "jutility.h" -#include "keyword.h" -#include "uri.h" -//--------------------------------------------------------------------- - -const t_int32 nsCalOrganizer::ms_cnsCalOrganizerName = 'N'; -const t_int32 nsCalOrganizer::ms_cnsCalOrganizerDir = 'l'; // 'el' -const t_int32 nsCalOrganizer::ms_cnsCalOrganizerSentBy = 's'; -const t_int32 nsCalOrganizer::ms_cnsCalOrganizerCN = 'C'; -const t_int32 nsCalOrganizer::ms_cnsCalOrganizerLanguage = 'm'; -const t_int32 nsCalOrganizer::ms_cnsCalOrganizerDisplayName = 'z'; - -//--------------------------------------------------------------------- - -nsCalOrganizer::nsCalOrganizer(JLog * initLog) -: m_Log(initLog) -{ -} - -//--------------------------------------------------------------------- - -nsCalOrganizer::nsCalOrganizer(nsCalOrganizer & that) -{ - m_CN = that.m_CN; - m_Language = that.m_Language; - m_SentBy = that.m_SentBy; - m_Dir = that.m_Dir; - - m_Name = that.m_Name; -} - -//--------------------------------------------------------------------- - -nsCalOrganizer::~nsCalOrganizer() -{ -} - -//--------------------------------------------------------------------- - -ICalProperty * -nsCalOrganizer::clone(JLog * initLog) -{ - m_Log = initLog; - //PR_ASSERT(m_Log != 0); - return (ICalProperty *) new nsCalOrganizer(*this); -} - -//--------------------------------------------------------------------- - -void nsCalOrganizer::parse(UnicodeString & propVal, - JulianPtrArray * parameters) -{ - t_int32 i; - ICalParameter * param; - UnicodeString pName, pVal; - if (propVal.size() == 0) - { - return; - } - setName(propVal); - if (parameters != 0) - { - for (i = 0; i < parameters->GetSize(); i++) - { - param = (ICalParameter *) parameters->GetAt(i); - - setParam(param->getParameterName(pName), - param->getParameterValue(pVal)); - } - } -} - -//--------------------------------------------------------------------- - -void nsCalOrganizer::setParam(UnicodeString & paramName, - UnicodeString & paramVal) -{ - ErrorCode status = ZERO_ERROR; - - //if (FALSE) TRACE("(%s, %s)\r\n", paramName.toCString(""), paramVal.toCString("")); - if (paramName.size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName, - nsCalKeyword::Instance()->ms_sORGANIZER, paramName, 200); - } - else - { - t_int32 hashCode = paramName.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_CN == hashCode) - { - if (getCN().size() != 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sORGANIZER, paramName, 100); - } - setCN(paramVal); - } - else if (nsCalKeyword::Instance()->ms_ATOM_LANGUAGE == hashCode) - { - if (getLanguage().size() != 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sORGANIZER, paramName, 100); - } - setLanguage(paramVal); - } - else if (nsCalKeyword::Instance()->ms_ATOM_SENTBY == hashCode) - { - if (getSentBy().size() != 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sORGANIZER, paramName, 100); - } - nsCalUtility::stripDoubleQuotes(paramVal); // double quote property - setSentBy(paramVal); - } - else if (nsCalKeyword::Instance()->ms_ATOM_DIR == hashCode) - { - if (getDir().size() != 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sORGANIZER, paramName, 100); - } - nsCalUtility::stripDoubleQuotes(paramVal); // double quote property - setDir(paramVal); - } - else if (ICalProperty::IsXToken(paramName)) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iXTokenParamIgnored, - nsCalKeyword::Instance()->ms_sORGANIZER, paramName, 100); - } - else - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName, - nsCalKeyword::Instance()->ms_sORGANIZER, paramName, 200); - } - } -} - -//--------------------------------------------------------------------- - -UnicodeString & nsCalOrganizer::toICALString(UnicodeString & out) -{ - UnicodeString u; - return toICALString(u, out); -} - -//--------------------------------------------------------------------- - -UnicodeString & nsCalOrganizer::toICALString(UnicodeString & sProp, - UnicodeString & out) -{ - out = ""; - out += sProp; - UnicodeString u; - if (m_CN.size() > 0) - { - out += ';'; out += nsCalKeyword::Instance()->ms_sCN; - out += '='; out += m_CN; - } - if (m_Language.size() > 0) - { - out += ';'; out += nsCalKeyword::Instance()->ms_sLANGUAGE; - out += '='; out += m_Language; - } - if (m_SentBy.size() > 0) - { - // double quote sent-by, dir - u = m_SentBy; - u = nsCalUtility::addDoubleQuotes(u); - out += ';'; out += nsCalKeyword::Instance()->ms_sSENTBY; - out += '='; out += u; - } - if (m_Dir.size() > 0) - { - // double quote sent-by, dir - u = m_Dir; - u = nsCalUtility::addDoubleQuotes(u); - out += ';'; out += nsCalKeyword::Instance()->ms_sDIR; - out += '='; out += u; - } - out += ':'; - out += m_Name; - out += nsCalKeyword::Instance()->ms_sLINEBREAK; - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & nsCalOrganizer::toString(UnicodeString & out) -{ - out = toString(nsCalFormatString::Instance()->ms_OrganizerStrDefaultFmt, out); - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & nsCalOrganizer::toString(UnicodeString & strFmt, - UnicodeString & out) -{ - if (strFmt.size() == 0 && - nsCalFormatString::Instance()->ms_OrganizerStrDefaultFmt.size() > 0) - { - // if empty string, use default - return toString(out); - } - - UnicodeString into; - t_int32 i,j; - //if (FALSE) TRACE("strFmt = %s\r\n", strFmt.toCString("")); - out = ""; - for ( i = 0; i < strFmt.size(); ) - { - - // NOTE: changed from % to ^ for attendee - /// - /// If there's a special formatting character, - /// handle it. Otherwise, just emit the supplied - /// character. - /// - - j = strFmt.indexOf('^', i); - if ( -1 != j) - { - if (j > i) - { - out += strFmt.extractBetween(i,j,into); - } - i = j + 1; - if ( strFmt.size() > i) - { - out += toStringChar(strFmt[(TextOffset) i]); - i++; - } - } - else - { - out += strFmt.extractBetween(i, strFmt.size(),into); - break; - } - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString nsCalOrganizer::toStringChar(t_int32 c) -{ - switch(c) - { - case ms_cnsCalOrganizerName: - return getName(); - case ms_cnsCalOrganizerDir: - return m_Dir; - case ms_cnsCalOrganizerSentBy: - return m_SentBy; - case ms_cnsCalOrganizerCN: - return m_CN; - case ms_cnsCalOrganizerLanguage: - return m_Language; - case ms_cnsCalOrganizerDisplayName: - // return CN is CN != "", else - // return the nsCalOrganizerName after the ':' - if (m_CN.size() > 0) - return m_CN; - else - { - UnicodeString u; - t_int32 i = m_Name.indexOf(':'); - if (i >= 0) - { - u = getName().extractBetween(i + 1, getName().size(), u); - return u; - } - else - return ""; - } - default: - return ""; - } -} - -//--------------------------------------------------------------------- - -t_bool nsCalOrganizer::isValid() -{ - /* - UnicodeString mailto; - if (getName().size() < 7) - return FALSE; - // change to URL, must have "MAILTO:" in front - mailto = getName().extractBetween(0, 7, mailto); - if (mailto.compareIgnoreCase(nsCalKeyword::Instance()->ms_sMAILTO_COLON) != 0) - return FALSE; - else - return TRUE; - */ - return URI::IsValidURI(m_Name); -} - -//--------------------------------------------------------------------- - -void * -nsCalOrganizer::getValue() const -{ - return (void *) &m_Name; -} - -//--------------------------------------------------------------------- - -void -nsCalOrganizer::setValue(void * value) -{ - PR_ASSERT(value != 0); - if (value != 0) - { - m_Name = *((UnicodeString *) value); - } -} - -//--------------------------------------------------------------------- - -void nsCalOrganizer::setParameters(JulianPtrArray * parameters) -{ - t_int32 i; - ICalParameter * param; - UnicodeString pName, pVal; - if (parameters != 0) - { - for (i = 0; i < parameters->GetSize(); i++) - { - param = (ICalParameter *) parameters->GetAt(i); - setParam(param->getParameterName(pName), - param->getParameterValue(pVal)); - } - } -} - -//--------------------------------------------------------------------- - -void nsCalOrganizer::setName(UnicodeString sName) -{ - m_Name = sName; -} - -//--------------------------------------------------------------------- diff --git a/mozilla/calendar/modules/core/ical/src/period.cpp b/mozilla/calendar/modules/core/ical/src/period.cpp deleted file mode 100644 index 735fe1a5eb2..00000000000 --- a/mozilla/calendar/modules/core/ical/src/period.cpp +++ /dev/null @@ -1,624 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// period.cpp -// John Sun -// 11:37 AM January 29 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include -#include -#include "datetime.h" -#include "duration.h" - -#include "period.h" - -//static UnicodeString s_sP = "P"; -//static UnicodeString s_sDash = " - "; -//static UnicodeString s_sForwardSlash = "/"; -//static UnicodeString s_sInvalidPeriod = "Invalid Period"; -//static UnicodeString s_sICALInvalidPeriod = "19691231T235959Z/PT-1H"; -//--------------------------------------------------------------------- -////////////////////////////// -// PRIVATE METHODS -////////////////////////////// -//--------------------------------------------------------------------- - -void Period::parse(UnicodeString & us) -{ - //UnicodeString s = us; - UnicodeString sStart, sEnd; - t_int32 indexOfSlash = us.indexOf('/'); - //DateTime start, end; - //nsCalDuration d; - - if (indexOfSlash < 0) - { - // LOG and create invalid period - createInvalidPeriod(); - } - else - { - sStart = us.extractBetween(0, indexOfSlash, sStart); - sEnd = us.extractBetween(indexOfSlash + 1, us.size(), sEnd); - - m_DTStart.setTimeString(sStart); //PR_ASSERT(m_DTStart != 0); - - m_DTEnd.setTimeString(sEnd); - if (!m_DTEnd.isValid()) - { - m_Duration.setDurationString(sEnd); - } - -#if 0 - if (sEnd[(TextOffset) 0] == 'P') //sEnd.startsWith(s_sP)) - { - m_Duration.setDurationString(sEnd); //PR_ASSERT(m_Duration != 0); - } - else - { - m_DTEnd.setTimeString(sEnd); //PR_ASSERT(m_DTEnd != 0); - } -#endif - - } -} -//--------------------------------------------------------------------- - -void Period::selfCheck() -{ - if (!isValid()) - createInvalidPeriod(); -} - -//--------------------------------------------------------------------- - -void Period::createInvalidPeriod() -{ - m_DTStart.setTime(-1); - m_DTEnd.setTime(-1); - m_Duration.set(-1, -1, -1, -1, -1, -1); -} - -//--------------------------------------------------------------------- - -DateTime & Period::getEndingTime(DateTime & d) -{ - PR_ASSERT(isValid()); - if (isValid()) - { - if (getEnd().isValid()) - { - d = m_DTEnd; - return d; - } - else - { - d = m_DTStart; - d.add(m_Duration); - return d; - } - } - else - { - // NOT valid period returns -1 - d.setTime(-1); - return d; - } -} - -//--------------------------------------------------------------------- -////////////////////////////// -// CONSTRUCTORS -////////////////////////////// -//--------------------------------------------------------------------- - -Period::Period() -: - m_DTStart(-1), - m_DTEnd(-1), - m_Duration(-1, -1, -1, -1, -1, -1, -1) - //m_DTStart(0), - //m_DTEnd(0), - //m_Duration(0) -{} - -//--------------------------------------------------------------------- - -Period::Period(Period & that) -{ - - m_DTStart.setTime(that.getStart().getTime()); - m_DTEnd.setTime(that.getEnd().getTime()); - - m_Duration = that.m_Duration; -} - -//--------------------------------------------------------------------- - -Period::Period(UnicodeString & us) -: - m_DTStart(-1), - m_DTEnd(-1), - m_Duration(-1, -1, -1, -1, -1, -1, -1) -{ - parse(us); - selfCheck(); -} - -//--------------------------------------------------------------------- - -////////////////////////////// -// DESTRUCTORS -////////////////////////////// -//--------------------------------------------------------------------- - -Period::~Period() -{ - //if (m_DTStart != 0) { delete m_DTStart; m_DTStart = 0; } - //if (m_DTEnd != 0) { delete m_DTEnd; m_DTEnd = 0; } - //if (m_Duration != 0) { delete m_Duration; m_Duration = 0; } -} - -//--------------------------------------------------------------------- - -////////////////////////////// -// GETTERS and SETTERS -////////////////////////////// -//--------------------------------------------------------------------- - -void Period::setStart(DateTime d) -{ - m_DTStart = d; -} - -//--------------------------------------------------------------------- - -void Period::setEnd(DateTime d) -{ - m_DTEnd = d; -} - -//--------------------------------------------------------------------- - -void Period::setDuration(nsCalDuration d) -{ - m_Duration = d; -} - -//--------------------------------------------------------------------- - -void Period::setPeriodString(UnicodeString & us) -{ - parse(us); -} - -//--------------------------------------------------------------------- - -////////////////////////////// -// UTILITIES -////////////////////////////// - -//--------------------------------------------------------------------- - -t_bool Period::isValid() -{ - //Date d; - - if (!getStart().isValid()) - { - return FALSE; - } - else if (getEnd().isValid()) - { - if (getEnd() < getStart()) - return FALSE; - // assert duration is invalid - PR_ASSERT(!getDuration().isValid()); - return TRUE; - } - else { - if (getDuration().isValid()) - { - if (getDuration().isNegativeDuration()) - return FALSE; - else - return TRUE; - } - return FALSE; - } -} -//--------------------------------------------------------------------- - -t_bool Period::isIntersecting(DateTime & start, DateTime & end) -{ - DateTime pEnd; - - PR_ASSERT(!start.afterDateTime(end)); - PR_ASSERT(isValid()); - // Bad input always returns FALSE - if (start.afterDateTime(end) || !isValid()) - { - return FALSE; - } - - - if (!getStart().beforeDateTime(end)) - return FALSE; - - pEnd = getEndingTime(pEnd); - - if (!pEnd.afterDateTime(start)) - return FALSE; - - return TRUE; -} - -//--------------------------------------------------------------------- - -t_bool Period::isIntersecting(Period & period) -{ - DateTime dS, dE; - dE = period.getEndingTime(dE); - dS = period.getStart(); - return isIntersecting(dS, dE); -} - -//--------------------------------------------------------------------- - -t_bool Period::isInside(DateTime & start, DateTime & end) -{ - DateTime pEnd; - - PR_ASSERT(!start.afterDateTime(end)); - PR_ASSERT(isValid()); - // handle bad input (ALWAYS returns FALSE) - if (start.afterDateTime(end) || !isValid()) - { - return FALSE; - } - pEnd = getEndingTime(pEnd); - if ((!getStart().beforeDateTime(start)) && - (!pEnd.afterDateTime(end))) - return TRUE; - return FALSE; -} - -//--------------------------------------------------------------------- - -t_bool Period::isInside(Period & period) -{ - DateTime dS, dE; - dE = period.getEndingTime(dE); - dS = period.getStart(); - return isInside(dS, dE); -} - -//--------------------------------------------------------------------- - -UnicodeString Period::toString() -{ - if (!isValid()) - { - return "Invalid Period"; - } - else - { - UnicodeString u; - u = getStart().toString(); - u += "-"; - if (getEnd().isValid()) - { - u += getEnd().toString(); - } - else - { - u += getDuration().toString(); - } - return u; - } -} - -//--------------------------------------------------------------------- - -UnicodeString Period::toICALString() -{ - if (!isValid()) - { - return "19691231T235959Z/INVALID_DURATION"; - } - else - { - UnicodeString sOut = getStart().toISO8601(); - sOut += '/'; - if (getEnd().isValid()) - sOut += getEnd().toISO8601(); - else - sOut += getDuration().toICALString(); - return sOut; - } - -} - -//--------------------------------------------------------------------- - -////////////////////////////// -// STATIC METHODS -////////////////////////////// -//--------------------------------------------------------------------- - -t_bool Period::IsConnectedPeriods(Period & p1, Period & p2) -{ - DateTime p1end; - DateTime p2end; - - if (p1.isIntersecting(p2)) - return TRUE; - - // check for back-to-back periods - p1end = p1.getEndingTime(p1end); - p2end = p2.getEndingTime(p2end); - - if (p1.getStart().equalsDateTime(p2end) || - p2.getStart().equalsDateTime(p1end)) - return TRUE; - - return FALSE; -} - -//--------------------------------------------------------------------- - -void Period::Union(Period & inPer1, Period & inPer2, Period & outPer) -{ - DateTime s1, s2; - DateTime p1end; - DateTime p2end; - - PR_ASSERT(inPer1.isValid() && inPer2.isValid()); - // handle bad input (return invalid period) - if (!inPer1.isValid() || !inPer2.isValid()) - { - DateTime d; - d.setTime(-1); - outPer.setStart(d); - outPer.setEnd(d); - return; - } - - if (!IsConnectedPeriods(inPer1, inPer2)) - { - // return an invalid period - outPer.createInvalidPeriod(); - } - else - { - s1 = inPer1.getStart(); - s2 = inPer2.getStart(); - if (s1.beforeDateTime(s2)) - outPer.setStart(s1); - else - outPer.setStart(s2); - - p1end = inPer1.getEndingTime(p1end); - p2end = inPer2.getEndingTime(p2end); - - if (p1end.afterDateTime(p2end)) - outPer.setEnd(p1end); - else - outPer.setEnd(p2end); - } -} - -//--------------------------------------------------------------------- - -void Period::Intersection(Period & inPer, DateTime & start, - DateTime & end, Period & outPer) -{ - DateTime pend; - DateTime pstart; - - PR_ASSERT(inPer.isValid()); - PR_ASSERT(!start.afterDateTime(end)); - // handle bad input (return invalid period) - if (!inPer.isValid() || start.afterDateTime(end)) - { - pstart.setTime(-1); - outPer.setStart(pstart); - outPer.setEnd(pstart); - } - - - if (!inPer.isIntersecting(start, end)) - { - outPer.createInvalidPeriod(); - } - else - { - pstart = inPer.getStart(); - - if (start.afterDateTime(pstart)) - outPer.setStart(start); - else - outPer.setStart(pstart); - - pend = inPer.getEndingTime(pend); - - if (end.beforeDateTime(pend)) - outPer.setEnd(end); - else - outPer.setEnd(pend); - } -} -//--------------------------------------------------------------------- - -void Period::SubtractedPeriod(Period & inPer, DateTime & start, - DateTime & end, JulianPtrArray * out) -{ - Period * pNew = 0; - DateTime pend, pstart; - - PR_ASSERT(!start.afterDateTime(end)); - // handle bad input (add nothing to vector) - if (start.afterDateTime(end)) - { - return; - } - - pstart = inPer.getStart(); - pend = inPer.getEndingTime(pend); - - Period pInt; - Period::Intersection(inPer, start, end, pInt); - if (!pInt.isValid()) - { - // return whole period since no intersection - pNew = new Period(); PR_ASSERT(pNew != 0); - pNew->setStart(pstart); - pNew->setEnd(pend); - out->Add(pNew); - return; - } - - if (pstart.beforeDateTime(start)) - { - pNew = new Period(); PR_ASSERT(pNew != 0); - pNew->setStart(pstart); - pNew->setEnd(start); - out->Add(pNew); - } - - if (pend.afterDateTime(end)) - { - pNew = new Period(); PR_ASSERT(pNew != 0); - pNew->setStart(end); - pNew->setEnd(pend); - out->Add(pNew); - } -} - -//--------------------------------------------------------------------- - -t_bool Period::IsParseable(UnicodeString & s) -{ - UnicodeString sStart, sEnd; - t_int32 indexOfSlash = s.indexOf('/', 0); - - if (indexOfSlash < 0) - return FALSE; - else - { - sStart = s.extractBetween(0, indexOfSlash, sStart); - sEnd = s.extractBetween(indexOfSlash + 1, s.size(), sEnd); - - if (!DateTime::IsParseable(sStart)) - return FALSE; - if (!DateTime::IsParseable(sEnd)) - { - nsCalDuration d(sEnd); //PR_ASSERT(d != 0); - if (!d.isValid()) - return FALSE; - //delete d; d = 0; // nullify after delete - } - } - return TRUE; -} - -//--------------------------------------------------------------------- - -UnicodeString & -Period::getTimeString(UnicodeString & sPeriod, t_bool bStart, - UnicodeString & out) -{ - PR_ASSERT(IsParseable(sPeriod)); - if (!IsParseable(sPeriod)) - { - out = "19691231T235959Z/INVALID_DURATION"; - return out; - } - t_int32 index = sPeriod.indexOf('/'); - PR_ASSERT(index != -1); - if (index == -1) - { - out = "19691231T235959Z/INVALID_DURATION"; - return out; - } - - if (bStart) - { - return sPeriod.extractBetween(0, index, out); - } - else - return sPeriod.extractBetween(index + 1, sPeriod.size(), out); -} -//--------------------------------------------------------------------- - -UnicodeString & -Period::getStartTimeString(UnicodeString & sPeriod, UnicodeString & out) -{ - return getTimeString(sPeriod, TRUE, out); -} - -//--------------------------------------------------------------------- - -UnicodeString & -Period::getEndTimeString(UnicodeString & sPeriod, UnicodeString & out) -{ - return getTimeString(sPeriod, FALSE, out); -} - -//--------------------------------------------------------------------- - -int Period::ComparePeriods(const void * a, const void * b) -{ - DateTime startA, startB; - PR_ASSERT(a != 0 && b != 0); - - Period * dtA = *(Period **) a; - Period * dtB = *(Period **) b; - - startA = dtA->getStart(); - startB = dtB->getStart(); - return (int) startA.compareTo(startB); - //return (int) (DateTime::CompareDateTimes(&startA, &startB)); -} - -//--------------------------------------------------------------------- - -int Period::ComparePeriodsByEndTime(const void * a, const void * b) -{ - DateTime endA, endB; - PR_ASSERT(a != 0 && b != 0); - - Period * dtA = *(Period **) a; - Period * dtB = *(Period **) b; - - endA = dtA->getEndingTime(endA); - endB = dtB->getEndingTime(endB); - return (int) endA.compareTo(endB); - //return (int) (DateTime::CompareDateTimes(&startA, &startB)); -} - -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/pprprty.cpp b/mozilla/calendar/modules/core/ical/src/pprprty.cpp deleted file mode 100644 index 1cfcace9db4..00000000000 --- a/mozilla/calendar/modules/core/ical/src/pprprty.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// pprprty.cpp -// John Sun -// 3:15 PM February 12 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "pprprty.h" -#include "period.h" -#include "prprty.h" - -//--------------------------------------------------------------------- - -// private never use -PeriodProperty::PeriodProperty() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -PeriodProperty::PeriodProperty(const PeriodProperty & that) -{ - setParameters(that.m_vParameters); - m_Period = that.m_Period; -} - -//--------------------------------------------------------------------- - -PeriodProperty::PeriodProperty(Period * value, JulianPtrArray * parameters) -: StandardProperty(parameters) -{ - PR_ASSERT(value != 0); - //m_string = *((UnicodeString *) value); - if (value != 0) - { - m_Period = value; - } -} -//--------------------------------------------------------------------- - -PeriodProperty::~PeriodProperty() -{ - delete m_Period; m_Period = 0; - //deleteICalParameterVector(m_vParameters); - //delete m_vParameters; m_vParameters = 0; -} - -//--------------------------------------------------------------------- - -void * PeriodProperty::getValue() const -{ - return (void *) m_Period; -} - -//--------------------------------------------------------------------- - -void PeriodProperty::setValue(void * value) -{ - PR_ASSERT(value != 0); - // NOTE: deleting old period - if (value != 0) - { - if (m_Period != 0) { delete m_Period; m_Period = 0; } - m_Period = ((Period *) value); - } -} - -//--------------------------------------------------------------------- - -ICalProperty * PeriodProperty::clone(JLog * initLog) -{ - if (initLog) {} // NOTE: Remove later to avoid warnings - return new PeriodProperty(*this); -} - -//--------------------------------------------------------------------- - -t_bool PeriodProperty::isValid() -{ - if (m_Period == 0) - return FALSE; - return m_Period->isValid(); -} - -//--------------------------------------------------------------------- - -UnicodeString & PeriodProperty::toString(UnicodeString & out) -{ - - PR_ASSERT(m_Period != 0); - - if (m_Period != 0) - { - //if (m_Period->isValid() - out = m_Period->toString(); - //else - // out = "NULL"; - } - else - { - // Bad period return "". - out = ""; - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -PeriodProperty::toString(UnicodeString & dateFmt, UnicodeString & out) -{ - // NOTE: remove it later, gets rid of compiler warning - if (dateFmt.size() > 0) {} - return toString(out); -} - -//--------------------------------------------------------------------- - -UnicodeString & PeriodProperty::toExportString(UnicodeString & out) -{ - PR_ASSERT(m_Period != 0); - if (m_Period != 0) - { - out = m_Period->toICALString(); - } - else - { - // Bad period return "". - out = ""; - } - return out; -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/prprty.cpp b/mozilla/calendar/modules/core/ical/src/prprty.cpp deleted file mode 100644 index 1b70d636886..00000000000 --- a/mozilla/calendar/modules/core/ical/src/prprty.cpp +++ /dev/null @@ -1,767 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// prprty.cpp -// John Sun -// 4:11 PM February 10 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include -#include "unistrto.h" -#include "prprty.h" -#include "ptrarray.h" -#include "icalprm.h" -#include "period.h" -#include "jutility.h" -#include "keyword.h" - -//--------------------------------------------------------------------- - -ICalProperty::ICalProperty() {} -ICalProperty::ICalProperty(ICalProperty & that) { if (&that != 0) {} } - -//--------------------------------------------------------------------- - -UnicodeString & -ICalProperty::propertyToICALString(UnicodeString & sProp, - UnicodeString & sVal, - JulianPtrArray * parameters, - UnicodeString & retVal) -{ - ICalParameter * aName; - retVal = ""; - t_int32 size = 0; - t_int32 i; - - - if (parameters != 0) - size = parameters->GetSize(); - if (sVal.size() > 0) - { - UnicodeString u; - retVal = sProp; - for (i = 0; i < size; i++) - { - aName = (ICalParameter *) parameters->GetAt(i); - retVal += aName->toICALString(u); - } - retVal += ':'; retVal += sVal; retVal += nsCalKeyword::Instance()->ms_sLINEBREAK; - } - //if (FALSE) TRACE("retVal = %s\r\n", retVal.toCString("")); - return retVal; -} - -//--------------------------------------------------------------------- -// TRUE = in range, FALSE = out of range. -t_bool ICalProperty::CheckParams(JulianPtrArray * parameters, - JAtom validParamNameRange[], - t_int32 validParamNameRangeSize) -{ - if (parameters == 0 || parameters->GetSize() == 0) - return TRUE; - - // more parameters that range - if (parameters->GetSize() > validParamNameRangeSize) - return FALSE; - - UnicodeString u; - t_int32 i; - ICalParameter * ip; - - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - u = ip->getParameterName(u); - - if (!nsCalUtility::checkRange(u.hashCode(), validParamNameRange, - validParamNameRangeSize)) - { - return FALSE; - } - } - return TRUE; -} -//--------------------------------------------------------------------- -// TRUE = in range, FALSE = out of range. -t_bool ICalProperty::CheckParamsWithValueRangeCheck(JulianPtrArray * parameters, - JAtom validParamNameRange[], - t_int32 validParamNameRangeSize, - JAtom validValueRange[], - t_int32 validValueRangeSize) -{ - - - // no parameters - if (parameters == 0 || parameters->GetSize() == 0) - return TRUE; - - // more parameters that range - if (parameters->GetSize() > validParamNameRangeSize) - return FALSE; - - UnicodeString u; - ICalParameter * ip; - t_int32 i; - - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - u = ip->getParameterName(u); - - if (!nsCalUtility::checkRange(u.hashCode(), validParamNameRange, - validParamNameRangeSize)) - { - return FALSE; - } - - if (nsCalKeyword::Instance()->ms_ATOM_VALUE == u.hashCode()) - { - u = ip->getParameterValue(u); - if (!nsCalUtility::checkRange(u.hashCode(), validValueRange, - validValueRangeSize)) - { - if (!ICalProperty::IsXToken(u)) - return FALSE; - } - } - - else if (nsCalKeyword::Instance()->ms_ATOM_ENCODING == u.hashCode()) - { - u = ip->getParameterValue(u); - if (!nsCalUtility::checkRange(u.hashCode(), - nsCalAtomRange::Instance()->ms_asEncodingRange, - nsCalAtomRange::Instance()->ms_iEncodingRangeSize)) - { - if (!ICalProperty::IsXToken(u)) - return FALSE; - } - } - - else if (nsCalKeyword::Instance()->ms_ATOM_RELTYPE == u.hashCode()) - { - u = ip->getParameterValue(u); - if (!nsCalUtility::checkRange(u.hashCode(), - nsCalAtomRange::Instance()->ms_asRelTypeRange, - nsCalAtomRange::Instance()->ms_iRelTypeRangeSize)) - { - if (!ICalProperty::IsXToken(u)) - return FALSE; - } - } - - else if (nsCalKeyword::Instance()->ms_ATOM_RELATED == u.hashCode()) - { - u = ip->getParameterValue(u); - if (!nsCalUtility::checkRange(u.hashCode(), - nsCalAtomRange::Instance()->ms_asRelatedRange, - nsCalAtomRange::Instance()->ms_iRelatedRangeSize)) - { - return FALSE; - } - } - } - return TRUE; -} - -//--------------------------------------------------------------------- -#if 0 -// return TRUE if error, FALSE otherwise -t_bool ICalProperty::checkParam(UnicodeString & propName, - UnicodeString & paramName, - UnicodeString & paramVal) -{ - t_int32 hashCode = propName.hashCode(); - - if (nsCalUtility::checkRange(hashCode, - nsCalAtomRange::Instance()->ms_asIrregularProperties, - nsCalAtomRange::Instance()->ms_iIrregularPropertiesSize)) - { - // if special property, then don't check parameters - return FALSE; - } - else - { - t_int32 pNHC = paramName.hashCode(); - - // X-TOKEN, no error - if (IsXToken(paramName)) - return FALSE; - - // not a valid parameter for th - if (!nsCalUtility::checkRange(pNHC, - nsCalAtomRange::Instance()->ms_asParameterRange, - nsCalAtomRange::Instance()->ms_iParameterRangeSize)) - return TRUE; - - else - { - t_int32 pVHC = paramVal.hashCode(); - // check parameter name ranges here - // TODO: For now check only VALUE, ENCODING, - // TODO: Check LANGUAGE later - if (nsCalKeyword::Instance()->ms_ATOM_VALUE == pNHC) - { - if ((!nsCalUtility::checkRange(pVHC, - nsCalAtomRange::Instance()->ms_asValueRange, - nsCalAtomRange::Instance()->ms_iValueRangeSize)) - && (!IsXToken(paramVal))) - return TRUE; - } - else if (nsCalKeyword::Instance()->ms_ATOM_ENCODING == pNHC) - { - if ((!nsCalUtility::checkRange(pVHC, - nsCalAtomRange::Instance()->ms_asEncodingRange, - nsCalAtomRange::Instance()->ms_iEncodingRangeSize)) && (!IsXToken(paramVal))) - return TRUE; - } - return FALSE; - } - } -} -#endif -//--------------------------------------------------------------------- -// checks for parameters here. -// If method encounters a bad parameter, -// then method won't add it to the parameters vector, -// and set parseError to TRUE - -void ICalProperty::parsePropertyLine(UnicodeString & strLine, - UnicodeString & outName, - UnicodeString & outVal, - JulianPtrArray * parameters) -{ - ErrorCode status = ZERO_ERROR; - - t_int32 lineLength = strLine.size(); - // NOTE: won't work with backslashed :, ;. Spec doesn't - // mention any special handling for backslashed :, ;. - t_int32 iColon = strLine.indexOf(':'); - t_int32 iSColon = strLine.indexOf(';'); - t_int32 iDQuote = strLine.indexOf('\"'); - t_int32 i, iEDQuote; - - //if (FALSE) TRACE("strLine = %s\r\n", strLine.toCString("")); - - // Ignore colons, semicolons inside double quotes - while (iDQuote >= 0 && iColon > iDQuote) - { - // get second quote - iEDQuote = strLine.indexOf('\"', iDQuote + 1); - if (iEDQuote > 0 && iColon < iEDQuote) - { - i = strLine.indexOf(':', iEDQuote); - iColon = ((i != -1) ? i : iColon); - } - if (iEDQuote > 0) - { - iDQuote = strLine.indexOf('\"', iEDQuote + 1); - } - else - { - iDQuote = -1; - } - } - - // no parameters - if (iSColon < 0) - { - if (iColon >= 0) - { - outName = strLine.extractBetween(0, iColon, outName).toUpper(); - //outName = strLine.extractBetween(0, iColon, outName); - //outName = nsCalUtility::ToUpper(outName); - - outVal = strLine.extractBetween(iColon + 1, lineLength, outVal); - } - else - { - outName = strLine.toUpper(); - //outName = strLine; - //outName = nsCalUtility::ToUpper(outName); - - outVal = ""; - } - } - else - { - // has parameters - UnicodeString u; - t_int32 iIndex = -1; - - if (iColon > 0) - { - iIndex = (iColon < iSColon) ? iColon : iSColon; - - outName = strLine.extractBetween(0, iIndex, u).toUpper(); - //outName = strLine.extractBetween(0, iIndex, u); - //outName = nsCalUtility::ToUpper(outName); - - outVal = strLine.extractBetween(iColon + 1, lineLength, u); - } - if (iIndex < iColon) - u = strLine.extractBetween(iIndex + 1, iColon, u); - else - u = ""; - - //if (FALSE) TRACE("u = %s\r\n", u.toCString("")); // u = sParams now. - if (u.size() > 0) - { - // NOTE: TODO: This assumes semicolons can't exist between DQUOTE - UnicodeStringTokenizer * st = new UnicodeStringTokenizer(u, - nsCalKeyword::Instance()->ms_sSEMICOLON_SYMBOL); - PR_ASSERT(st != 0); - PR_ASSERT(parameters != 0); - - if (st != 0 && parameters != 0) - { - UnicodeString paramName; - UnicodeString paramVal; - t_int32 iEq = -1; - - //t_bool error; - //t_int32 paramsLen = -1; - - while (st->hasMoreTokens()) - { - u = st->nextToken(u, status); - u.trim(); - - //if (FALSE) TRACE("u = %s\r\n", u.toCString("")); - - iEq = u.indexOf('='); - if (iEq < 0) - { - paramName = u.extractBetween(0, u.size(), paramName).toUpper(); - //paramName = u.extractBetween(0, u.size(), paramName); - //paramName = nsCalUtility::ToUpper(paramName); - - paramVal = ""; - } - else - { - paramName = u.extractBetween(0, iEq, paramName).toUpper(); - //paramName = u.extractBetween(0, u.size(), paramName); - //paramName = nsCalUtility::ToUpper(paramName); - - paramVal = u.extractBetween(iEq + 1, u.size(), paramVal); - } - - //if (FALSE) TRACE("paramName = %s\r\n", paramName.toCString("")); - //if (FALSE) TRACE("paramVal = %s\r\n", paramVal.toCString("")); - - // checking parameters here - // NOTE: moved error checking to the storeData method - //error = checkParam(outName, paramName, paramVal); - //if (!error) - //{ - parameters->Add(new ICalParameter(paramName, paramVal)); - //} - //else - //{ - // parseError = TRUE; - //} - } - delete st; st = 0; - } - } - } - //if (FALSE) TRACE("outName = --%s--, outVal = --%s--, paramSize = %d\r\n", outName.toCString(""), outVal.toCString(""), parameters->GetSize()); - - //return parseError; - //return FALSE; -} - -//--------------------------------------------------------------------- - -void -ICalProperty::deleteICalParameterVector(JulianPtrArray * parameters) -{ - ICalParameter * ip; - t_int32 i; - if (parameters != 0) - { - for (i = parameters->GetSize() - 1; i >= 0; i--) - { - ip = (ICalParameter *) parameters->GetAt(i); - delete ip; ip = 0; - } - } -} - -//--------------------------------------------------------------------- - -// Trims UnicodeStrings. The UnicodeString::trim() method seems to -// only trim space separators (ASCII 12 and ' '). It doesn't trim -// ('\r' ASCII 13). Note assumes only 8-bit string -UnicodeString & -ICalProperty::Trim(UnicodeString & s) -{ - TextOffset endOffset = s.size(); - TextOffset startOffset = 0; - while ((startOffset < endOffset) && - (s[(TextOffset) startOffset] == ' ' || - s[(TextOffset) startOffset] == '\t' || - s[(TextOffset) startOffset] == '\r' || - s[(TextOffset) startOffset] == '\n')) - { - startOffset++; - } - while ((startOffset < endOffset) && - (s[(TextOffset) (endOffset - 1)] == ' ' || - s[(TextOffset) (endOffset - 1)] == '\t' || - s[(TextOffset) (endOffset - 1)] == '\r' || - s[(TextOffset) (endOffset - 1)] == '\n')) - { - endOffset--; - } - if ((startOffset > 0) || (endOffset < s.size())) - s.extractBetween(startOffset, endOffset, s); - return s; -} - -//--------------------------------------------------------------------- - -void -ICalProperty::deleteICalPropertyVector(JulianPtrArray * properties) -{ - ICalProperty * ip; - t_int32 i; - if (properties != 0) - { - for (i = properties->GetSize() - 1; i >= 0; i--) - { - ip = (ICalProperty *) properties->GetAt(i); - delete ip; ip = 0; - } - } -} -//--------------------------------------------------------------------- -void -ICalProperty::deletePeriodVector(JulianPtrArray * periods) -{ - Period * ip; - t_int32 i; - if (periods != 0) - { - for (i = periods->GetSize() - 1; i >= 0; i--) - { - ip = (Period *) periods->GetAt(i); - delete ip; ip = 0; - } - } -} -//--------------------------------------------------------------------- -UnicodeString & -ICalProperty::propertyToString(ICalProperty * property, - UnicodeString & dateFmt, - UnicodeString & retVal) -{ - if (property == 0) - retVal = ""; - else - { - retVal = property->toString(dateFmt, retVal); - } - return retVal; -} - -//--------------------------------------------------------------------- - -UnicodeString & -ICalProperty::propertyToString(ICalProperty * property, - UnicodeString & retVal) -{ - if (property == 0) - retVal = ""; - else - { - retVal = property->toString(retVal); - } - return retVal; -} -//--------------------------------------------------------------------- -UnicodeString & -ICalProperty::propertyVectorToString(JulianPtrArray * properties, - UnicodeString & retVal) -{ - retVal = ""; - if (properties == 0) - { - } - else - { - UnicodeString u; - ICalProperty * prop; - t_int32 i; - - for (i = 0; i < properties->GetSize(); i++) - { - prop = (ICalProperty *) properties->GetAt(i); - PR_ASSERT(prop != 0); - if (prop != 0) - { - retVal += prop->toString(u); - if (i < properties->GetSize() - 1) - retVal += ','; //ms_sCOMMA_SYMBOL; - } - } - } - return retVal; -} -//--------------------------------------------------------------------- -UnicodeString & -ICalProperty::propertyVectorToString(JulianPtrArray * properties, - UnicodeString & dateFmt, - UnicodeString & retVal) -{ - - retVal = ""; - if (properties == 0) - { - } - else - { - t_int32 i; - UnicodeString u; - ICalProperty * prop; - - for (i = 0; i < properties->GetSize(); i++) - { - prop = (ICalProperty *) properties->GetAt(i); - PR_ASSERT(prop != 0); - if (prop != 0) - { - retVal += prop->toString(dateFmt, u); - - if (i < properties->GetSize() - 1) - retVal += ','; //ms_sCOMMA_SYMBOL; - } - } - } - return retVal; -} -//--------------------------------------------------------------------- - -UnicodeString & -ICalProperty::parameterToCalString(UnicodeString sParam, - UnicodeString & sVal, - UnicodeString & out) -{ - out = ""; - if (sVal.size() > 0) - { - out = nsCalKeyword::Instance()->ms_sSEMICOLON_SYMBOL; - out += sParam; - out += '='; - out += sVal; - } - return out; -} - -//--------------------------------------------------------------------- - - -UnicodeString & -ICalProperty::parameterVToCalString(UnicodeString sParam, - JulianPtrArray * v, - UnicodeString & out) -{ - UnicodeString ss; - t_int32 i = 0; - out = ""; - if (v != 0) { - - for (i = 0; i < v->GetSize(); i++) - { - ss = *((UnicodeString *) v->GetAt(i)); - if (i == 0) - { - out += ';'; out += sParam; - out += '='; out += ss; - } - else - { - out += ';'; out += ss; - } - } - } - return out; -} - -//--------------------------------------------------------------------- -UnicodeString & -ICalProperty::propertyToICALString(UnicodeString & propName, - ICalProperty * property, - UnicodeString & retVal) -{ - if (property == 0) - retVal = ""; - else - { - UnicodeString out; - out = property->toICALString(propName, retVal); - retVal = multiLineFormat(retVal); - //retVal = multiLineFormat(property->toICALString(propName, retVal)); - } - return retVal; -} -//--------------------------------------------------------------------- -UnicodeString & -ICalProperty::propertyVectorToICALString(UnicodeString & propName, - JulianPtrArray * properties, - UnicodeString & retVal) -{ - t_int32 i; - UnicodeString u; - ICalProperty * prop; - retVal = ""; - if (properties == 0) - { - } - else - { - //retVal = ""; - for (i = 0; i < properties->GetSize(); i++) - { - prop = (ICalProperty *) properties->GetAt(i); - PR_ASSERT(prop != 0); - if (prop != 0) - { - retVal += multiLineFormat(prop->toICALString(propName, u)); - } - } - } - return retVal; -} -//--------------------------------------------------------------------- -UnicodeString & -ICalProperty::vectorToICALString(JulianPtrArray * strings, UnicodeString & retVal) -{ - retVal = ""; - if (strings == 0) - { - } - else - { - t_int32 i; - UnicodeString u; - - for (i = 0; i < strings->GetSize(); i++) - { - u = *((UnicodeString *) strings->GetAt(i)); - u += nsCalKeyword::Instance()->ms_sLINEBREAK; - retVal += multiLineFormat(u); - } - } - return retVal; -} - -//--------------------------------------------------------------------- - -UnicodeString & -ICalProperty::multiLineFormat(UnicodeString & s) -{ - t_int32 size = s.size(); - - if (size == 0) - return s; - if (size <= ms_iMAX_LINE_LENGTH) - return s; - else - { - UnicodeString sResult, t; - - sResult = s.extractBetween(0, ms_iMAX_LINE_LENGTH, sResult); - t = s.extractBetween(ms_iMAX_LINE_LENGTH, size, t); - t.insert(0, nsCalKeyword::Instance()->ms_sLINEBREAKSPACE); - sResult += multiLineFormat(t); - - // end recursion - size = sResult.size(); - if (sResult.endsWith(nsCalKeyword::Instance()->ms_sLINEFEEDSPACE)) - sResult.removeBetween(size - 1, size); - s = sResult; - return s; - } -} - -//--------------------------------------------------------------------- -t_bool -ICalProperty::IsXToken(UnicodeString & s) -{ - if (s.size() == 0) - return FALSE; - if (s.size() < 2) - return FALSE; - if ((s[(TextOffset) 0] != 'X' && s[(TextOffset) 0] != 'x') || - (s[(TextOffset) 1] != '-')) - return FALSE; - else - return TRUE; -} -//--------------------------------------------------------------------- - -void -ICalProperty::CloneICalPropertyVector(JulianPtrArray * propertiesToClone, - JulianPtrArray * out, - JLog * initLog) -{ - if (out == 0 || propertiesToClone == 0) - return; - else - { - t_int32 i; - ICalProperty * ip; - for (i = 0; i < propertiesToClone->GetSize(); i++) - { - ip = ((ICalProperty *) propertiesToClone->GetAt(i))->clone(initLog); - PR_ASSERT(ip != 0); - out->Add(ip); - } - } -} - -//--------------------------------------------------------------------- - -void -ICalProperty::CloneUnicodeStringVector(JulianPtrArray * ustringsToClone, - JulianPtrArray * out) -{ - if (out == 0 || ustringsToClone == 0) - return; - else - { - t_int32 i; - UnicodeString * u; - for (i = 0; i < ustringsToClone->GetSize(); i++) - { - u = new UnicodeString(*((UnicodeString *) ustringsToClone->GetAt(i))); - PR_ASSERT(u != 0); - out->Add(u); - } - } -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/prprtyfy.cpp b/mozilla/calendar/modules/core/ical/src/prprtyfy.cpp deleted file mode 100644 index 94a8cb8a51e..00000000000 --- a/mozilla/calendar/modules/core/ical/src/prprtyfy.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// prprtyfy.cpp -// John Sun -// 5:19 PM February 12 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "prprtyfy.h" -#include "prprty.h" -#include "dprprty.h" -#include "duprprty.h" -#include "iprprty.h" -#include "sprprty.h" -//#include "bprprty.h" -//#include "pprprty.h" - - -ICalPropertyFactory::ICalPropertyFactory() -{ -} - -//--------------------------------------------------------------------- - -ICalProperty * -ICalPropertyFactory::Make(ICalProperty::PropertyTypes aType, void * value, - JulianPtrArray * parameters) -{ - - PR_ASSERT(value != 0); - if (value != 0) - { - switch (aType) - { - case ICalProperty::TEXT: - return new StringProperty(*((UnicodeString *) value), parameters); - case ICalProperty::DATETIME: - return new DateTimeProperty(*((DateTime *) value), parameters); - case ICalProperty::INTEGER: - return new IntegerProperty(*((t_int32 *) value), parameters); - case ICalProperty::DURATION: - return new DurationProperty(*((nsCalDuration *) value), parameters); - case ICalProperty::PERIOD: - return 0; - //return new PeriodProperty((Period *) value, parameters); - case ICalProperty::BOOLEAN: - return 0; - //return new BooleanProperty(*(t_bool *) value, parameters); - default: - return 0; - } - } - return 0; -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/rcrrence.cpp b/mozilla/calendar/modules/core/ical/src/rcrrence.cpp deleted file mode 100644 index ba0e21c9869..00000000000 --- a/mozilla/calendar/modules/core/ical/src/rcrrence.cpp +++ /dev/null @@ -1,1871 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// rcrrence.cpp -// John Sun -// 10:45 AM Febuary 2 1997 - -// TODO: Known bugs in recurrence handling: -// 1) Given a rule WITH a BYMONTH tag and no BYDAY, BYMONTHDAY, BYYEARDAY tag -// I should use dtstart as BYMONTHDAY -// i.e. RRULE:FREQ=YEARLY;COUNT=10;BYMONTH=6,7 -> 6/7/97,7/7/97,6/7/98,7/7/98,6/7/99,7/7/99, etc. -// NOT 6/1-31/97,7/1-31/97,6/1-31/98,7/1-31/98,6/1-31/99,7/1-31/99, etc. as it does now. -// 2) UNTIL BUG -// generator aborts if date gets past until. However some dates may not be produced -// that are actually before certain produced dates. -// 3) BYSETPOS -// start dates affect bySETPOS' first value. This is bad. -// (i.e FREQ=MONTHLY;BYDAY=TU,WE,TH;BYSETPOS=3 with start of 19970904T090000) -// should not produce 9/10, which current code does -// 4) I DON'T HANDLE BYSECOND. or FREQ=SECONDLY -// 5) DON'T HANDLE TZID yet! -// 7) FREQ tag that is lower than span value of BYxxx TAG fail -// (i.e FREQ=MINUTELY;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16 FAILS) -#include "stdafx.h" -#include "jdefines.h" - -#include -#include -#include "datetime.h" -#include "duration.h" -#include "rrday.h" -#include "ptrarray.h" -#include "jutility.h" -#include "bydmgntr.h" -#include "bydwgntr.h" -#include "bydygntr.h" -#include "byhgntr.h" -#include "bymgntr.h" -#include "bymdgntr.h" -#include "bymogntr.h" -#include "bywngntr.h" -#include "byydgntr.h" -#include "deftgntr.h" -#include "dategntr.h" -#include "keyword.h" -#include "period.h" -#include "datetime.h" -#include "rcrrence.h" -#include "unistrto.h" -#include "keyword.h" -#include "icalprm.h" -#include "jlog.h" - -//#define DEBUG 1 -//--------------------------------------------------------------------- -//static UnicodeString s_sSemiColonSymbol = ";"; -//static UnicodeString nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL = ","; - -/* - * This is a hack so I could get it compiled on unix. We need - * to remove Windows specific code from this file. - * -terry (copying sman's hack) - */ -#define TRACE printf - -#if JULIAN_DEBUGGING_RECURRENCE - -void Recurrence::TRACE_DATETIMEVECTOR(JulianPtrArray * x, char * name) -{ - //if (FALSE) TRACE("Name: %s,", name); - if (x != 0) - { - //if (FALSE) TRACE("Size: %d", x->GetSize()); - t_int32 ii; - for (ii = 0; ii < x->GetSize(); ii++) - { - //if (FALSE) TRACE("\r\n %s[%d] = %s", name, ii, ((DateTime *)x->GetAt(ii))->toISO8601().toCString("")); - } - //if (FALSE) TRACE("\r\n"); - } - else - { - //if (FALSE) TRACE(" is NULL\r\n"); - } -}; -// prints a vector of vector of datetimes -void Recurrence::TRACE_DATETIMEVECTORVECTOR(JulianPtrArray * x, char * name) -{ - //if (FALSE) TRACE("Name: %s,", name); - JulianPtrArray * xi; - if (x != 0) - { - //if (FALSE) TRACE("Size: %d", x->GetSize()); - t_int32 ii; - t_int32 jj; - for (ii = 0; ii < x->GetSize(); ii++) - { - xi = (JulianPtrArray *) x->GetAt(ii); - for (jj = 0; jj < xi->GetSize(); jj++) - { - //if (FALSE) TRACE("\r\n %s[%d][%d] = %s", name, ii, jj,((DateTime *)xi->GetAt(jj))->toISO8601().toCString("")); - } - } - //if (FALSE) RACE("\r\n"); - } - else - { - //if (FALSE) TRACE(" is NULL\r\n"); - } -} - -#endif - -const t_int32 Recurrence::ms_iUNSET = -10000; // should be set to Integer.MIN - -const t_int32 Recurrence::ms_iByMinuteGntrIndex = 0; -const t_int32 Recurrence::ms_iByHourGntrIndex = 1; -const t_int32 Recurrence::ms_iByWeekNoGntrIndex = 2; -const t_int32 Recurrence::ms_iByYearDayGntrIndex = 3; -const t_int32 Recurrence::ms_iByMonthGntrIndex = 4; -const t_int32 Recurrence::ms_iByMonthDayGntrIndex = 5; -const t_int32 Recurrence::ms_iByDayYearlyGntrIndex = 6; -const t_int32 Recurrence::ms_iByDayMonthlyGntrIndex = 7; -const t_int32 Recurrence::ms_iByDayWeeklyGntrIndex = 8; -const t_int32 Recurrence::ms_iDefaultGntrIndex = 9; -const t_int32 Recurrence::ms_iGntrSize = 10; - -const t_int32 Recurrence::ms_aiGenOrderZero[] = -{ - Recurrence::ms_iByWeekNoGntrIndex, - Recurrence::ms_iByYearDayGntrIndex, - Recurrence::ms_iByMonthGntrIndex, - Recurrence::ms_iByDayYearlyGntrIndex - - /* - Recurrence::ms_iByMonthGntrIndex, - Recurrence::ms_iByWeekNoGntrIndex, - Recurrence::ms_iByYearDayGntrIndex, - Recurrence::ms_iByDayYearlyGntrIndex*/ -}; -const t_int32 Recurrence::ms_GenOrderZeroLen = 4; -const t_int32 Recurrence::ms_aiGenOrderOne[] = -{ - Recurrence::ms_iByMonthDayGntrIndex, - Recurrence::ms_iByDayMonthlyGntrIndex -}; -const t_int32 Recurrence::ms_GenOrderOneLen = 2; - -const t_int32 Recurrence::ms_aiGenOrderTwo[] ={Recurrence::ms_iByDayWeeklyGntrIndex}; -const t_int32 Recurrence::ms_GenOrderTwoLen = 1; -const t_int32 Recurrence::ms_aiGenOrderThree[] = {Recurrence::ms_iByHourGntrIndex}; -const t_int32 Recurrence::ms_GenOrderThreeLen = 1; -const t_int32 Recurrence::ms_aiGenOrderFour[] = {Recurrence::ms_iByMinuteGntrIndex}; -const t_int32 Recurrence::ms_GenOrderFourLen = 1; -const t_int32 Recurrence::ms_aiGenOrderFive[] = {Recurrence::ms_iDefaultGntrIndex}; -const t_int32 Recurrence::ms_GenOrderFiveLen = 1; - -const t_int32 * Recurrence::ms_aaiGenOrder[] = -{ - Recurrence::ms_aiGenOrderZero, - Recurrence::ms_aiGenOrderOne, - Recurrence::ms_aiGenOrderTwo, - Recurrence::ms_aiGenOrderThree, - Recurrence::ms_aiGenOrderFour, - Recurrence::ms_aiGenOrderFive, -}; -const t_int32 Recurrence::ms_GenOrderLen = 6; - -//--------------------------------------------------------------------- - -void Recurrence::init() -{ - m_iType = nsCalUtility::RT_NONE; - m_Interval = 0; - m_iCount = ms_iUNSET; - m_iWkSt = Calendar::MONDAY; - m_Until.setTime(-1); - m_iBySetPosLen = 0; - - m_aaiByDay = 0; - m_aiByMinute = 0; - m_aiByHour = 0; - m_aiByMonthDay = 0; - m_aiByYearDay = 0; - m_aiBySetPos = 0; - m_aiByWeekNo = 0; - m_aiByMonth = 0; - - m_GntrVctr = new JulianPtrArray(); PR_ASSERT(m_GntrVctr != 0); - - ms_ByMinuteGntr = new ByMinuteGenerator(); PR_ASSERT(ms_ByMinuteGntr != 0); - ms_ByHourGntr = new ByHourGenerator(); PR_ASSERT(ms_ByHourGntr != 0); - ms_ByWeekNoGntr = new ByWeekNoGenerator(); PR_ASSERT(ms_ByWeekNoGntr != 0); - ms_ByYearDayGntr = new ByYearDayGenerator(); PR_ASSERT(ms_ByYearDayGntr != 0); - ms_ByMonthGntr = new ByMonthGenerator(); PR_ASSERT(ms_ByMonthGntr != 0); - ms_ByMonthDayGntr = new ByMonthDayGenerator(); PR_ASSERT(ms_ByMonthDayGntr != 0); - ms_ByDayYearlyGntr = new ByDayYearlyGenerator(); PR_ASSERT(ms_ByDayYearlyGntr != 0); - ms_ByDayMonthlyGntr = new ByDayMonthlyGenerator(); PR_ASSERT(ms_ByDayMonthlyGntr != 0); - ms_ByDayWeeklyGntr = new ByDayWeeklyGenerator(); PR_ASSERT(ms_ByDayWeeklyGntr != 0); - ms_DefaultGntr = new DefaultGenerator(); PR_ASSERT(ms_DefaultGntr != 0); - - - // MUST BE IN THIS ORDER!! - m_GntrVctr->Add(ms_ByMinuteGntr); - m_GntrVctr->Add(ms_ByHourGntr); - m_GntrVctr->Add(ms_ByWeekNoGntr); - m_GntrVctr->Add(ms_ByYearDayGntr); - m_GntrVctr->Add(ms_ByMonthGntr); - m_GntrVctr->Add(ms_ByMonthDayGntr); - m_GntrVctr->Add(ms_ByDayYearlyGntr); - m_GntrVctr->Add(ms_ByDayMonthlyGntr); - m_GntrVctr->Add(ms_ByDayWeeklyGntr); - m_GntrVctr->Add(ms_DefaultGntr); - - m_iActiveGenerators = 0; - -} -//--------------------------------------------------------------------- - -Recurrence::Recurrence() -{ - init(); -} - -//--------------------------------------------------------------------- -#if 0 -Recurrence::Recurrence(DateTime startDate, DateTime stopDate, - nsCalDuration * duration, UnicodeString & ruleString) -{ - init(); - m_StartDate = startDate; - m_StopDate = stopDate; - m_Duration = duration; - - m_bParseValid = parse(ruleString); - -} -//--------------------------------------------------------------------- - -Recurrence::Recurrence(DateTime startDate, nsCalDuration * duration, - UnicodeString & ruleString) -{ - init(); - m_StartDate = startDate; - m_Duration = duration; - - m_StopDate = startDate; - m_StopDate.add(*duration); - - m_bParseValid = parse(ruleString); -} -#endif -//--------------------------------------------------------------------- - -Recurrence::Recurrence(DateTime startDate, UnicodeString & ruleString) -{ - init(); - m_StartDate = startDate; - m_StopDate.setTime(-1); - m_Duration = 0; - - m_bParseValid = parse(ruleString); -} -//--------------------------------------------------------------------- - -Recurrence::~Recurrence() -{ - // delete, generators, then delete parameters. - - t_int32 i; - for (i = m_GntrVctr->GetSize() - 1; i >= 0; i--) - { - delete ((DateGenerator *)m_GntrVctr->GetAt(i)); - } - m_GntrVctr->RemoveAll(); - - if (m_aaiByDay != 0) { delete [] m_aaiByDay; m_aaiByDay = 0; } - if (m_aiByMinute != 0) { delete [] m_aiByMinute; m_aiByMinute = 0; } - if (m_aiByHour != 0) { delete [] m_aiByHour ; m_aiByHour = 0; } - if (m_aiByMonthDay != 0) { delete [] m_aiByMonthDay; m_aiByMonthDay = 0; } - if (m_aiByYearDay != 0) { delete [] m_aiByYearDay ; m_aiByYearDay = 0; } - if (m_aiBySetPos != 0) { delete [] m_aiBySetPos ; m_aiBySetPos = 0; } - if (m_aiByWeekNo != 0) { delete [] m_aiByWeekNo ; m_aiByWeekNo = 0; } - if (m_aiByMonth != 0) { delete [] m_aiByMonth ; m_aiByMonth = 0; } - - if (m_GntrVctr != 0) { delete m_GntrVctr; m_GntrVctr = 0; } - if (m_Interval != 0) { delete m_Interval; m_Interval = 0; } - if (m_Duration != 0) { delete m_Duration; m_Duration = 0; } -} - -//--------------------------------------------------------------------- - -t_bool Recurrence::isValid() const -{ - return m_bParseValid; -} - -//--------------------------------------------------------------------- - -void -Recurrence::parsePropertyLine(UnicodeString & strLine, - JulianPtrArray * parameters) - //Hashtable * properties) -{ - t_int32 iColon = strLine.indexOf(':'); - if (iColon < 0) - { - return; - } - else - { - ErrorCode status = ZERO_ERROR; - UnicodeString u; - - u = strLine.extractBetween(iColon + 1, strLine.size(), u); - - UnicodeStringTokenizer * st = - new UnicodeStringTokenizer(u, nsCalKeyword::Instance()->ms_sSEMICOLON_SYMBOL); - - PR_ASSERT(st != 0); - - UnicodeString paramName; - UnicodeString paramVal; - t_int32 iEq = -1; - - while (st->hasMoreTokens()) - { - u = st->nextToken(u, status); - u.trim(); - -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("u = %s\r\n", u.toCString("")); -#endif - iEq = u.indexOf('='); - if (iEq < 0) - { - paramName = u.extractBetween(0, u.size(), paramName).toUpper(); - paramVal = ""; - } - else - { - paramName = u.extractBetween(0, iEq, paramName).toUpper(); - paramVal = u.extractBetween(iEq + 1, u.size(), paramVal); - } -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("[paramName | paramVal] = [%s | %s]\r\n", paramName.toCString(""), paramVal.toCString("")); -#endif - parameters->Add(new ICalParameter(paramName, paramVal)); - } - delete st; st = 0; - } -} -//--------------------------------------------------------------------- -// TODO: crash proof -t_bool -Recurrence::parse(UnicodeString & s) - -{ - t_bool bParseError = FALSE; - - DateGenerator * dg; - JulianPtrArray * v; - - UnicodeString sErrorMsg = "InvalidByMinuteValue"; - - UnicodeString t, u; - t_int32 tempInterval = ms_iUNSET; - t_int32 iYearSpanConflict = 0; - t_bool bYearDay = FALSE; - t_bool bWeekNo = FALSE; - t_bool bByMonth = FALSE; - t_int32 i, j; - t_int32 retSize; - t_int32 byMonthDaySize = 0; - t_int32 byMonthSize = 0; - t_int32 temp = 0; - - // PARSES THE LINE AND FILLS IN PARAMETERS Vector - JulianPtrArray * parameters = new JulianPtrArray(); PR_ASSERT(parameters != 0); - if (parameters == 0) - { - // Ran out of memory, return FALSE. - return FALSE; - } - Recurrence::parsePropertyLine(s, parameters); - -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("\r\n----------------------------------------------------\r\n"); -#endif - - // First get FREQ value - ICalParameter * ip; - t_bool hasFreq = FALSE; - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - if (ip->getParameterName(u).compareIgnoreCase(nsCalKeyword::Instance()->ms_sFREQ) == 0) - { - t = ip->getParameterValue(t); -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("FREQ = %s\r\n", t.toCString("")); -#endif - m_iType = stringToType(t, bParseError); - hasFreq = TRUE; - } - } - - if (bParseError || !hasFreq) - { - // Parse Error: Invalid or Missing Frequency Parameter - // CLEANUP - deleteICalParameterVector(parameters); - delete parameters; - return FALSE; - } - - - v = new JulianPtrArray(); PR_ASSERT(v != 0); - - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - u = ip->getParameterName(u); - t = ip->getParameterValue(t); - - if (t.size() == 0) - { - - } - else - { -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("(key | value) = (%s | %s)\r\n", u.toCString(""), t.toCString("")); -#endif - //const char * tCharStar = t.toCString(""); - t_int32 tSize = t.size(); - JAtom atomParam(u); - - if (nsCalKeyword::Instance()->ms_ATOM_UNTIL == atomParam) - { - // TODO: ONLY accepts UTC time for now - m_Until.setTimeString(t); - // TODO: Log if m_Until is invalid or before start time - } - else if (nsCalKeyword::Instance()->ms_ATOM_COUNT == atomParam) - { - char * tcc = t.toCString(""); - PR_ASSERT(tcc != 0); - m_iCount = nsCalUtility::atot_int32(tcc, bParseError, tSize); - delete [] tcc; tcc = 0; - } - else if (nsCalKeyword::Instance()->ms_ATOM_INTERVAL == atomParam) - { - // TODO: if duration allowed, parse duration, then it to interval - char * tcc = t.toCString(""); - PR_ASSERT(tcc != 0); - tempInterval = nsCalUtility::atot_int32(tcc, bParseError, tSize); - delete [] tcc; tcc = 0; - } - else if (nsCalKeyword::Instance()->ms_ATOM_WKST == atomParam) - { - m_iWkSt = stringToDay(t, bParseError); - } - else if (nsCalKeyword::Instance()->ms_ATOM_BYSETPOS == atomParam) - { - parseDelimited(t, nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL, v); - m_aiBySetPos = verifyIntList(v, -366, 366, sErrorMsg, retSize, bParseError, TRUE); - m_iBySetPosLen = retSize; - m_iActiveGenerators++; - } - else if (nsCalKeyword::Instance()->ms_ATOM_BYMINUTE == atomParam) - { - dg = (DateGenerator *) m_GntrVctr->GetAt(ms_iByMinuteGntrIndex); - if (dg->getSpan() < m_iType) - { - // error FIMR (FreqIntervalMismatchRecurrence) - bParseError = TRUE; - } - else - { - parseDelimited(t, nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL, v); - m_aiByMinute = verifyIntList(v, 0, 59, sErrorMsg, retSize, bParseError); - dg->setParamsArray(m_aiByMinute, retSize); - m_iActiveGenerators++; - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_BYHOUR == atomParam) - { - dg = (DateGenerator *) m_GntrVctr->GetAt(ms_iByHourGntrIndex); - if (dg->getSpan() < m_iType) - { - // error FIMR (FreqIntervalMismatchRecurrence) - bParseError = TRUE; - } - else - { - parseDelimited(t, nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL, v); - m_aiByHour = verifyIntList(v, 0, 23, sErrorMsg, retSize, bParseError); - dg->setParamsArray(m_aiByHour, retSize); - m_iActiveGenerators++; - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_BYMONTHDAY == atomParam) - { - dg = (DateGenerator *) m_GntrVctr->GetAt(ms_iByMonthDayGntrIndex); - if (dg->getSpan() < m_iType) - { - // error FIMR (FreqIntervalMismatchRecurrence) - bParseError = TRUE; - } - else - { - parseDelimited(t, nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL, v); - m_aiByMonthDay = verifyIntList(v, -31, 31, sErrorMsg, retSize, bParseError, TRUE); - dg->setParamsArray(m_aiByMonthDay, retSize); - m_iActiveGenerators++; - byMonthDaySize = retSize; - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_BYYEARDAY == atomParam) - { - dg = (DateGenerator *) m_GntrVctr->GetAt(ms_iByYearDayGntrIndex); - if (dg->getSpan() < m_iType) - { - // error FIMR (FreqIntervalMismatchRecurrence) - bParseError = TRUE; - } - else - { - parseDelimited(t, nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL, v); - m_aiByYearDay = verifyIntList(v, -366, 366, sErrorMsg, retSize, bParseError, TRUE); - dg->setParamsArray(m_aiByYearDay, retSize); - m_iActiveGenerators++; - iYearSpanConflict++; - bYearDay = TRUE; - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_BYWEEKNO == atomParam) - { - dg = (DateGenerator *) m_GntrVctr->GetAt(ms_iByWeekNoGntrIndex); - if (dg->getSpan() < m_iType) - { - // error FIMR (FreqIntervalMismatchRecurrence) - bParseError = TRUE; - } - else - { - parseDelimited(t, nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL, v); - m_aiByWeekNo = verifyIntList(v, -53, 53, sErrorMsg, retSize, bParseError, TRUE); - dg->setParamsArray(m_aiByWeekNo, retSize); - m_iActiveGenerators++; - iYearSpanConflict++; - bWeekNo = TRUE; - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_BYMONTH == atomParam) - { - dg = (DateGenerator *) m_GntrVctr->GetAt(ms_iByMonthGntrIndex); - if (dg->getSpan() < m_iType) - { - // error FIMR (FreqIntervalMismatchRecurrence) - bParseError = TRUE; - } - else - { - parseDelimited(t, nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL, v); - m_aiByMonth = verifyIntList(v, 1, 12, sErrorMsg, retSize, bParseError, TRUE); - dg->setParamsArray(m_aiByMonth, retSize); - m_iActiveGenerators++; - iYearSpanConflict++; - bByMonth = TRUE; - byMonthSize = retSize; - } - } - else if (nsCalKeyword::Instance()->ms_ATOM_BYDAY == atomParam) - { - switch(m_iType) - { - case nsCalUtility::RT_WEEKLY: - dg = (DateGenerator *) m_GntrVctr->GetAt(ms_iByDayWeeklyGntrIndex); - break; - case nsCalUtility::RT_MONTHLY: - dg = (DateGenerator *) m_GntrVctr->GetAt(ms_iByDayMonthlyGntrIndex); - break; - case nsCalUtility::RT_YEARLY: - dg = (DateGenerator *) m_GntrVctr->GetAt(ms_iByDayYearlyGntrIndex); - break; - default: - bParseError = TRUE; - //return FALSE; - } - PR_ASSERT(dg != 0); - if (dg->getSpan() < m_iType) - { - bParseError = TRUE; - } - else - { - parseDelimited(t, nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL, v); - m_aaiByDay = createByDayList(v, m_iType, retSize, bParseError); - dg->setRDay(m_aaiByDay, retSize); - m_iActiveGenerators++; - } - } - - } - deleteUnicodeStringVector(v); - v->RemoveAll(); - } - //delete propEnum; propEnum = 0; - - // Check BYMONTH, BYMONTHDAY mismatch (i.e. BYMONTH=11,BYMONTHDAY=-31 or 31 is error) - // NOTE: TODO: Doesn't account for leap years!!!! - // THUS: (asking for BYMONTH=2,BYMONTHDAY=29 will succeed, even for bad years!!!) - if (m_aiByMonth != 0 && m_aiByMonthDay != 0 && !bParseError) - { - for (i = 0; i < byMonthSize; i++) - { - for (j = 0; j < byMonthDaySize; j++) - { - // NOTE: to fix HPUX compile problems with abs - temp = m_aiByMonthDay[j]; - if (temp < 0) - temp = 0 - temp; - - if (DateTime::getMonthLength(m_aiByMonth[i], 2000) < - //abs(m_aiByMonthDay[j]) // this line is replaced by below - temp) - { - bParseError = TRUE; - break; - } - } - } - } - - if (tempInterval == ms_iUNSET) - { - internalSetInterval(1); - } - else - { - internalSetInterval(tempInterval); - } - // Default Generator - // If there are no active generators, we have no BYxxx tags, so we must install a - // default generator to do the work. - if (m_iActiveGenerators == 0) - { - // NOTE: to make it work on HPUX. - t_int32 params[3]; - params[0] = m_iType; - if (tempInterval == ms_iUNSET) - params[1] = 1; - else - params[1] = tempInterval; - params[2] = m_iCount; - - // commented out line below so HPUX won't die. - //t_int32 params[] = {m_iType, (tempInterval == ms_iUNSET) ? 1 : tempInterval, m_iCount}; - - ((DateGenerator *) m_GntrVctr->GetAt(ms_iDefaultGntrIndex))->setParamsArray(params, 3); - m_iActiveGenerators++; - } - - // TODO: IF there is more than one BY tag with a yearly span, - // make sure they don't conflict. - // If they do, then only the start date should be returned - - - /* - if (iYearSpanConflict > 1) - { - - if (bByMonth && bYearDay) - { - } - - if (bByMonth && bWeekNo) - { - } - - if (bYearDay && bWeekNo) - { - } - } - */ - - if((dg = (DateGenerator *)m_GntrVctr->GetAt(ms_iByDayWeeklyGntrIndex))->active() || - (dg = (DateGenerator *)m_GntrVctr->GetAt(ms_iByDayMonthlyGntrIndex))->active() || - (dg = (DateGenerator *)m_GntrVctr->GetAt(ms_iByDayYearlyGntrIndex))->active()) - { - dg->setParams(m_iWkSt); - } - - // CLEANUP - deleteUnicodeStringVector(v); - v->RemoveAll(); - delete v; v = 0; - - deleteICalParameterVector(parameters); - delete parameters; parameters = 0; - - if (bParseError) - { - // PARSE ERROR ENCOUNTERED -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("ERROR: Parse error somewhere\r\n"); -#endif - return FALSE; - } - - return TRUE; - -} - -//--------------------------------------------------------------------- - -void Recurrence::internalSetInterval(t_int32 i) -{ - m_Interval = new nsCalDuration(); - - switch(m_iType) - { - case nsCalUtility::RT_MINUTELY: - //m_Interval->setMinute(i); - m_Interval->set(0,0,0,0,i,0); - break; - case nsCalUtility::RT_HOURLY: - //m_Interval->setHour(i); - m_Interval->set(0,0,0,i,0,0); - break; - case nsCalUtility::RT_DAILY: - //m_Interval->setDay(i); - m_Interval->set(0,0,i,0,0,0); - break; - case nsCalUtility::RT_WEEKLY: - //m_Interval->setWeek(i); - m_Interval->set(i); - break; - case nsCalUtility::RT_MONTHLY: - //m_Interval->setMonth(i); - m_Interval->set(0,i,0,0,0,0); - break; - case nsCalUtility::RT_YEARLY: - //m_Interval->setYear(i); - m_Interval->set(i,0,0,0,0,0); - break; - default: - break; - } -} -//--------------------------------------------------------------------- -// TODO: crash proof -void -Recurrence::stringEnforce(DateTime startDate, JulianPtrArray * srr, - JulianPtrArray * ser, JulianPtrArray * srd, - JulianPtrArray * sed, t_int32 bound, JulianPtrArray * out, - JLog * log) -{ - // rr and er are vector of Recurrence objects - // rd and ed are vector of DateTime objects - - // Vector of Recurrence objects - JulianPtrArray * rr = new JulianPtrArray(); PR_ASSERT(rr != 0); - JulianPtrArray * er = new JulianPtrArray(); PR_ASSERT(er != 0); - - // Vector of DateTimes - JulianPtrArray * rd = new JulianPtrArray(); PR_ASSERT(rd != 0); - JulianPtrArray * ed = new JulianPtrArray(); PR_ASSERT(ed != 0); - - t_int32 i = 0, size = 0; - UnicodeString u, t; - DateTime * dt; - - size = ((srr != 0) ? srr->GetSize() : 0); - if (size > 0) - { - for (i = 0; i < size; i++) - { - u = *((UnicodeString *) srr->GetAt(i)); -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("u = -%s-\r\n", u.toCString("")); -#endif - rr->Add(new Recurrence(startDate, u)); - } - } - - size = ((ser != 0) ? ser->GetSize() : 0); - if (size > 0) - { - for (i = 0; i < size; i++) - { - u = *((UnicodeString *) ser->GetAt(i)); -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("u = -%s-\r\n", u.toCString("")); -#endif - er->Add(new Recurrence(startDate, u)); - } - } - - size = ((srd != 0) ? srd->GetSize() : 0); - if (size > 0) - { - for (i = 0; i < size; i++) - { - u = * ((UnicodeString *) srd->GetAt(i)); -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("u = -%s-\r\n", u.toCString("")); -#endif - t = u; - if (Period::IsParseable(u)) - { - Period * p = new Period(u); PR_ASSERT(p != 0); - if (p != 0) - { - PR_ASSERT(p->isValid()); - DateTime d; - d = p->getStart(); - // create new period - // add the start time of the period to vector only if after start time - if (!(d.beforeDateTime(startDate))) - rd->Add(new DateTime(d)); - delete p; p = 0; - } - } - else if (DateTime::IsParseableDate(u)) - { - t += 'T'; - t += startDate.toISO8601LocalTimeOnly(); -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("t = -%s-\r\n", t.toCString("")); -#endif - dt = new DateTime(t); PR_ASSERT(dt != 0); - if (!(dt->beforeDateTime(startDate))) - { - rd->Add(dt); - } - else - { - delete dt; dt = 0; - } - } - else if (DateTime::IsParseableDateTime(u)) - { - dt = new DateTime(t); PR_ASSERT(dt != 0); - if (!(dt->beforeDateTime(startDate))) - { - rd->Add(dt); - } - else - { - delete dt; dt = 0; - } - } - else - { - // log an invalid rdate - if (log != 0) log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidRDate, 200); - } - } - } - size = ((sed != 0) ? sed->GetSize() : 0); - if (size > 0) - { - for (i = 0; i < size; i++) - { - u = * ((UnicodeString *) sed->GetAt(i)); -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("u = -%s-\r\n", u.toCString("")); -#endif - ed->Add(new DateTime(u)); - } - } - // NOTE: rd, ed ownership taken in enforce - enforce(rr, er, rd, ed, bound, out, log); - - // CLEANUP: NOTE: rd, ed are deleted in enforce already - deleteRecurrenceVector(rr); - delete rr; rr = 0; - deleteRecurrenceVector(er); - delete er; er = 0; -} - -//--------------------------------------------------------------------- -// TODO: crash proof -void -Recurrence::enforce(JulianPtrArray * rr, JulianPtrArray * er, - JulianPtrArray * rd, JulianPtrArray * ed, - t_int32 bound, JulianPtrArray * out, JLog * log) -{ - JulianPtrArray * dr = new JulianPtrArray(); // dr is a vector of vectors - PR_ASSERT(dr != 0); - - JulianPtrArray * de = new JulianPtrArray(); // de is a vector of vectors - PR_ASSERT(de != 0); - - JulianPtrArray * dates; - - Recurrence * recur; - t_int32 i; - - PR_ASSERT(rr != 0 && er != 0 && rd != 0 && ed != 0); - - // First, create all dates with instances - for (i = 0; i < rr->GetSize(); i++) - { - dates = new JulianPtrArray(); PR_ASSERT(dates != 0); - recur = (Recurrence *) rr->GetAt(i); - recur->unzip(bound, dates, log, TRUE); - dr->Add(dates); -#if JULIAN_DEBUGGING_RECURRENCE - TRACE_DATETIMEVECTOR(dates, "dates"); -#endif - } - dr->Add(rd); - - // SECOND, create all exception dates - for (i = 0; i < er->GetSize(); i++) - { - dates = new JulianPtrArray(); PR_ASSERT(dates != 0); - recur = (Recurrence *) er->GetAt(i); - recur->unzip(bound, dates, log, FALSE); - de->Add(dates); -#if JULIAN_DEBUGGING_RECURRENCE - TRACE_DATETIMEVECTOR(dates, "dates"); -#endif - } - de->Add(ed); - - // Now, flatten out dates, exdates - JulianPtrArray * sZero = new JulianPtrArray(); - JulianPtrArray * sOne = new JulianPtrArray(); - - concat(dr, sZero); - concat(de, sOne); - - // eliminate duplicates from dates, exdates - eliminateDuplicates(sZero); - eliminateDuplicates(sOne); - - // intersect dates with exdates, add them to out vector - JulianPtrArray * s = new JulianPtrArray(); - s->Add(sZero); - s->Add(sOne); - intersectDateList(s, TRUE, out); - - // cleanup - deleteDateTimeVectorVector(dr); // deletes rd - delete dr; dr = 0; - deleteDateTimeVectorVector(de); // deleted ed - delete de; de = 0; - - deleteDateTimeVectorVector(s); // should delete sZero, and sOne - delete s; s = 0; -} - -//--------------------------------------------------------------------- - -t_int32 Recurrence::getGenOrderIndexLength(t_int32 genOrderIndex) -{ - switch (genOrderIndex) - { - case 0: return ms_GenOrderZeroLen; - case 1: return ms_GenOrderOneLen; - case 2: return ms_GenOrderTwoLen; - case 3: return ms_GenOrderThreeLen; - case 4: return ms_GenOrderFourLen; - case 5: return ms_GenOrderFiveLen; - default: return 0; - } -} - -//--------------------------------------------------------------------- -// TODO: make crash proof -void -Recurrence::unzip(t_int32 bound, JulianPtrArray * out, JLog * log, - t_bool bAddStartDate) -{ - //PR_ASSERT(out != 0); - //PR_ASSERT(isValid()); - // return if only startDate if !isValid - if (!isValid()) - { - if (out != 0) - { - if (bAddStartDate) - out->Add(new DateTime(m_StartDate)); - } - if (log != 0) - { - log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidRecurrenceError, 200); - } - return; - } - - // u = returnDates, z = genDates, - - t_int32 i, j, k, temp; - t_int32 lastInterval = m_iType; - DateGenerator * dg; - JulianPtrArray * v; // vector of vector of dates for this span type, deleted - JulianPtrArray * genDates; // vector of newly generated dates, deleted with v - t_bool done = FALSE; - DateTime t = m_StartDate; - DateTime * dt; - t_bool bSubGenerate = FALSE; - - // TODO: Known bug in handling UNTIL, if generating dates with UNTIL, - // it's possible that the generator exists the generate() method before - // generating all dates before until. - - t_int32 genOrderIndexLength = 0; - - JulianPtrArray * x = 0; // vector of dates for this interval, deleted - JulianPtrArray * returnDateVector = 0; // vector of dates to return, deleted - - if (m_iCount != ms_iUNSET && (!m_Until.isValid())) - bound = m_iCount; - - // TODO: prevent generator from running if previous generator ran with - // no dates generated - t_bool bPrevGenRan = FALSE; - - // If the default generator is active, twiddle it with the new count value. - - if((dg = (DateGenerator *)m_GntrVctr->GetAt(ms_iDefaultGntrIndex))->active()) - { - dg->setParams(bound); - } - - do - { - x = new JulianPtrArray(); PR_ASSERT(x != 0); - //bPrevGenRan = FALSE; - for (i = 0; i < ms_GenOrderLen; i++) - { - v = new JulianPtrArray(); - - genOrderIndexLength = getGenOrderIndexLength(i); - - for (j = 0; j < genOrderIndexLength; j++) - { - temp = ms_aaiGenOrder[i][j]; dg = (DateGenerator *) m_GntrVctr->GetAt(temp); - - // Make sure we have an active generator, and perform a strange test - // to see if a previous generator ran, but didn't find any dates. - // (If a previous generator ran and went dateless, we don't want to run.) - - if (dg->active() && (!(bPrevGenRan != FALSE && (x->GetSize() == 0)))) - { - genDates = new JulianPtrArray(); PR_ASSERT(genDates != 0); - - dg->setSpan(lastInterval); - // If previous generator has been run and produced dates, then run this test - if (x != 0 && x->GetSize() > 0) - { - for (k = 0; k < x->GetSize(); k++) - { - done = done || dg->generate((DateTime *) x->GetAt(k), *genDates, &m_Until); -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("1) i = %d, j = %d, done = %d, genDates = ", i, j, done); - //if (FALSE) TRACE_DATETIMEVECTOR(genDates, "genDates"); -#endif - } - } - else - { - done = done || dg->generate(&t, *genDates, &m_Until); -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("2) i = %d, j = %d, done = %d, genDates = ", i, j, done); - //if (FALSE) TRACE_DATETIMEVECTOR(genDates, "genDates"); -#endif - } - - lastInterval = dg->getInterval(); - - v->Add(genDates); - //bPrevGenRan = TRUE; - } - } - bSubGenerate = (i > 2); - - if (v->GetSize() > 0) - { - //bPrevGenRan = TRUE; -#if JULIAN_DEBUGGING_RECURRENCE - TRACE_DATETIMEVECTORVECTOR(v, "v"); - TRACE_DATETIMEVECTOR(x, "x"); -#endif - JulianPtrArray * vFlat = new JulianPtrArray(); - - if (v->GetSize() > 1) - { - if (x->GetSize() == 0) - { - intersectDateList(v, FALSE, x); - } - else - { - intersectDateList(v, FALSE, vFlat); - intersectOutList(x, vFlat); - } - } - else - { - // If no previous dates generated, just cat. - if (x->GetSize() == 0) - { - concat(v, x); - } - else - { - // Hours, Minutes, Seconds can be applied to a any date. - // That is why call replace. - // Day Of Week, Day Of Month, Day Of Year, Week Number - // cannot be applied to any date. Thus must intersect. - if (bSubGenerate) - { - // WORKS FOR BYHOUR, BYMINUTE, ELECTION DAYS FAIL - // replace on byhour, byminute, bysecond - //concat(v, x); - replace(v, x); - } - else - { - // FAILS FOR BYHOUR, BYMINUTE, ELECTION DAYS WORK - // intersect on bymonth, byday, bymonthday, byyearday, byweekno - // Have x. - concat(v, vFlat); - intersectOutList(x, vFlat); // ?? FAILS for BYHOUR, BYMINUTE - } - } - } -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE_DATETIMEVECTOR(vFlat, "vFlat"); - //if (FALSE) TRACE("After concat: x = "); - //if (FALSE) TRACE_DATETIMEVECTOR(x, "x"); -#endif - deleteDateTimeVector(vFlat); - delete vFlat; vFlat = 0; - } - deleteDateTimeVectorVector(v); // genDates deleted here as well - delete v; v = 0; - } - - // MUST sort before handling SETPOS - x->QuickSort(DateTime::CompareDateTimes); - - handleSetPos(x); - - // ADD newest created dates to overall dateVector - - if (x != 0 && x->GetSize() > 0) - { - t = *((DateTime*)x->GetAt(x->GetSize() - 1)); - - if (returnDateVector == 0) - { - returnDateVector = new JulianPtrArray(); PR_ASSERT(returnDateVector != 0); - } - for (i = 0; i < x->GetSize(); i++) - { - dt = (DateTime *) x->GetAt(i); - returnDateVector->Add(new DateTime(*dt)); - } - } - - if (m_iType == nsCalUtility::RT_MONTHLY) - { - t_int32 interval = m_Interval->getMonth(); - while (interval > 0) - { - t.nextMonth(); - interval--; - } - } - else - { - PR_ASSERT(m_Interval != 0); - t.add(*m_Interval); - } - - reset(t, m_iType, m_iWkSt); - - deleteDateTimeVector(x); - delete x; x = 0; // delete x; - - lastInterval = m_iType; - - } - while (!done && (returnDateVector == 0 || returnDateVector->GetSize() < bound)); - cleanup(returnDateVector, bound, out, bAddStartDate); - if (returnDateVector != 0) - { - deleteDateTimeVector(returnDateVector); - delete returnDateVector; returnDateVector = 0; - } - //return; -} - -//--------------------------------------------------------------------- - -void -Recurrence::cleanup(JulianPtrArray * vDatesIn, t_int32 length, - JulianPtrArray * out, t_bool bAddStartDate) -{ - t_bool pushStart = FALSE; - t_int32 i; - t_int32 newLength = 0; - DateTime * dt; - t_int32 size = 0; - if (vDatesIn != 0) - { - size = vDatesIn->GetSize(); - } - if ((vDatesIn == 0 || size == 0) && bAddStartDate) - { - out->Add(new DateTime(m_StartDate)); - return; - } - dt = (DateTime *) vDatesIn->GetAt(0); - if (dt->afterDateTime(m_StartDate) || dt->beforeDateTime(m_StartDate)) - pushStart = TRUE; - - if (size < length) - { - newLength = size + (pushStart ? 1 : 0); - } - else - newLength = length; - - if ((size != length) || pushStart) - { - t_int32 startIndex = 0; - if (pushStart) - { - out->Add(new DateTime(m_StartDate)); - newLength = newLength - 1; - } - for (i = 0; i < newLength; i++) - { - dt = (DateTime *) vDatesIn->GetAt(i); - //if ((!m_Until.isValid()) || (!(dt->afterDateTime(m_Until)))) - //{ - out->Add(new DateTime(*dt)); - //} - } - } - else - { - for (i = 0; i < newLength; i++) - { - dt = (DateTime *) vDatesIn->GetAt(i); - //if ((!m_Until.isValid()) || (!(dt->afterDateTime(m_Until)))) - //{ - out->Add(new DateTime(*dt)); - //} - } - } -} - -//--------------------------------------------------------------------- - -void -Recurrence::reset(DateTime & t, t_int32 type, t_int32 wkSt) -{ - t_int32 temp = 0; - switch(type) - { - case nsCalUtility::RT_YEARLY: - t.add(Calendar::DAY_OF_YEAR, -t.get(Calendar::DAY_OF_YEAR) + 1); - break; - case nsCalUtility::RT_MONTHLY: - t.add(Calendar::DAY_OF_MONTH, -t.get(Calendar::DAY_OF_MONTH) + 1); - break; - case nsCalUtility::RT_WEEKLY: - t.moveTo(wkSt, -1, FALSE); - break; - case nsCalUtility::RT_DAILY: - - // this case is purposely empty. a daily rule can only contain a byhour, - // or a byminute tag. or it can have no tags. if it has a tag, then the - // assumed line: t.set(calendar.hour_of_day, 0); will be executed in the - // appropriate code. if it has no tags, then the reset() method will - // never be reached, since a defaultgenerator will be installed and will - //handle all of the work in one run. - break; - case nsCalUtility::RT_HOURLY: - t.set(Calendar::MINUTE, 0); - break; - case nsCalUtility::RT_MINUTELY: - t.set(Calendar::SECOND, 0); - break; - } - // a given rule either has or doesn't have a BYHOUR and/or BYMINUTE tag. - // if it doesn't, then the specific time in each recurrence is based entirely - // on the time provided in the startDate. if it does then either the hour - // or the minute is based on the parameter to the BYHOUR or BYMINUTE tag. - // thus, if the tags exist, we need to reset those values. in the case of - // the BYMINUTE tag, we must also reset the hourly value, but only if we - // are not in an hourly rule. confusing.. - - temp = ms_iByHourGntrIndex; - if (((DateGenerator *) (m_GntrVctr->GetAt(temp)))->active()) - { - t.set(Calendar::HOUR_OF_DAY, 0); - } - temp = ms_iByMinuteGntrIndex; - if (((DateGenerator *) (m_GntrVctr->GetAt(temp)))->active()) - { - if (type != nsCalUtility::RT_HOURLY) - t.set(Calendar::HOUR_OF_DAY, 0); - t.set(Calendar::MINUTE, 0); - } -} - -//--------------------------------------------------------------------- - -void -Recurrence::handleSetPos(JulianPtrArray * vDates) -{ - // If no set pos, just return, leave vDates alone. - if (m_iBySetPosLen == 0) - return; - - t_int32 i; - DateTime * dt; - JulianPtrArray * vBySetPosDates; - t_int32 oldSize = vDates->GetSize(); - t_int32 temp = 0; - - if (vDates != 0 && oldSize > 0) - { - vBySetPosDates = new JulianPtrArray(); - - // First get the dates that satisfy the BYSETPOS tag. - for (i = 0; i < m_iBySetPosLen; i++) - { - if(m_aiBySetPos[i] == 0) - { - // An parse error should already have been thrown. - PR_ASSERT(FALSE); - break; - } - // NOTE: to handle HPUX compile problems with abs - temp = m_aiBySetPos[i]; - if (temp < 0) - temp = 0 - temp; - - // replacing this line with next line to avoid HPUX compile problems - //if(abs(m_aiBySetPos[i]) > oldSize) - if (temp > oldSize) - { - // No such element to add. - continue; - } - if (m_aiBySetPos[i] > 0) - { - temp = m_aiBySetPos[i] - 1; - dt = new DateTime( - *( (DateTime*)vDates->GetAt(temp))); - vBySetPosDates->Add(dt); - } - else - { - dt = new DateTime( - *( (DateTime *)vDates->GetAt(m_aiBySetPos[i] + oldSize))); - vBySetPosDates->Add(dt); - } - } - // delete elements from vDates - deleteDateTimeVector(vDates); - vDates->RemoveAll(); - - // copy elements from vBySetPosDates to vDates. - for (i = 0; i < vBySetPosDates->GetSize(); i++) - { - dt = (DateTime *) vBySetPosDates->GetAt(i); - vDates->Add(dt); - } - delete vBySetPosDates; vBySetPosDates = 0; - } -} - -//--------------------------------------------------------------------- - -t_int32 Recurrence::stringToDay(UnicodeString & s, t_bool & error) -{ - t_int32 i = (t_int32) Calendar::SUNDAY; - - if (s.size() == 0) - { - error = TRUE; - } - else - { - if (s == nsCalKeyword::Instance()->ms_sSU) i = Calendar::SUNDAY; - else if (s == nsCalKeyword::Instance()->ms_sMO) i = Calendar::MONDAY; - else if (s == nsCalKeyword::Instance()->ms_sTU) i = Calendar::TUESDAY; - else if (s == nsCalKeyword::Instance()->ms_sWE) i = Calendar::WEDNESDAY; - else if (s == nsCalKeyword::Instance()->ms_sTH) i = Calendar::THURSDAY; - else if (s == nsCalKeyword::Instance()->ms_sFR) i = Calendar::FRIDAY; - else if (s == nsCalKeyword::Instance()->ms_sSA) i = Calendar::SATURDAY; - else - { - error = TRUE; - } - } - return i; -} - -//--------------------------------------------------------------------- - -void -Recurrence::parseDelimited(UnicodeString & us, UnicodeString & strDelim, - JulianPtrArray * vectorToFillIn) -{ - UnicodeStringTokenizer * st = new UnicodeStringTokenizer(us, strDelim); - PR_ASSERT(st != 0); - if (st != 0) - { - UnicodeString u; - ErrorCode status = ZERO_ERROR; - while (st->hasMoreTokens()) - { - u = st->nextToken(u, status); -#if JULIAN_DEBUGGING_RECURRENCE - //if (FALSE) TRACE("u = %s", u.toCString("")); -#endif - vectorToFillIn->Add(new UnicodeString(u)); - } - delete st; st = 0; - } -} -//--------------------------------------------------------------------- - -// replaces contents of vOut with contents of vvIn -void -Recurrence::replace(JulianPtrArray * vvIn, JulianPtrArray * vOut) -{ - deleteDateTimeVector(vOut); - vOut->RemoveAll(); - concat(vvIn, vOut); -} - -//--------------------------------------------------------------------- -/* concatenates a multidimensional array of dates into a single list */ -void -Recurrence::concat(JulianPtrArray * vvIn, JulianPtrArray * vOut) -{ - int i, j; - - JulianPtrArray * vvInIndex; - DateTime * dt; - if (vvIn != 0) - { - PR_ASSERT(vOut != 0); - if (vOut != 0) - { - for(i = 0; i < vvIn->GetSize(); i++) - { - vvInIndex = (JulianPtrArray *) vvIn->GetAt(i); - for (j = 0; j < vvInIndex->GetSize(); j++) - { - dt = (DateTime *) vvInIndex->GetAt(j); - vOut->Add(new DateTime(*dt)); - } - } - } - } -} -//--------------------------------------------------------------------- -void -Recurrence::intersectOutList(JulianPtrArray * vDatesOut, JulianPtrArray * vDatesIn) -{ - t_int32 i; - PR_ASSERT(vDatesOut != 0 && vDatesIn != 0); - DateTime * dt; - t_int32 oldSize = vDatesOut->GetSize(); - - for (i = oldSize - 1; i >= 0; i--) - { - dt = (DateTime *) vDatesOut->GetAt(i); - if (!contains(vDatesIn, dt)) - { - vDatesOut->RemoveAt(i); - delete dt; dt = 0; - } - } -} -//--------------------------------------------------------------------- -// todo: crash proof - /* subtracts or intersects datelists: - * - * subtract mode: subtracts lists 1..n from list 0 - * intersect mode: intersects lists 0..n - */ -void -Recurrence::intersectDateList(JulianPtrArray * vvDates, t_bool subtract, - JulianPtrArray * out) -{ - t_int32 i, j; - DateTime * bi; - PR_ASSERT(vvDates != 0 && out != 0); - PR_ASSERT(vvDates->GetSize() > 0); - - // remove all elements already in out vector - if (out->GetSize() != 0) - { - deleteDateTimeVector(out); - out->RemoveAll(); - } - - PR_ASSERT(out->GetSize() == 0); - JulianPtrArray * vvDatesIndex = ((JulianPtrArray *) vvDates->GetAt(0)); - - for (i = 0; i < vvDatesIndex->GetSize(); i++) - { - for (j = 1; j < vvDates->GetSize(); j++) - { - bi = (DateTime *)vvDatesIndex->GetAt(i); - if (contains((JulianPtrArray *)vvDates->GetAt(j), bi)) - { - if (!subtract) - out->Add(new DateTime(*bi)); - } - else if (subtract) - { - out->Add(new DateTime(*bi)); - } - } - } -} - -//--------------------------------------------------------------------- -// checks to see if date b is in date array a, currently masks out milliseconds when it compares - -t_bool -Recurrence::contains(JulianPtrArray * datetimes, DateTime * date) -{ - t_int32 i; - PR_ASSERT(datetimes != 0 && date != 0); - if (datetimes != 0 && date != 0) - { - DateTime * ai; - for (i = 0; i < datetimes->GetSize(); i++) - { - ai = (DateTime *) datetimes->GetAt(i); - - //if (ai != 0 && ((ai->getTime() - (ai->getTime() % 1000)) == - // date->getTime() - (date->getTime() % 1000))) - if (ai != 0 && - ((ai->getTime() / 1000.0) == (date->getTime() / 1000.0))) - { - return TRUE; - } - } - } - return FALSE; -} - -//--------------------------------------------------------------------- - - -t_int32 Recurrence::stringToType(UnicodeString & s, t_bool & bParseError) -{ - t_int32 iType; - - if (s.size() > 0) - { - if (s == nsCalKeyword::Instance()->ms_sMINUTELY) iType = nsCalUtility::RT_MINUTELY; - else if (s == nsCalKeyword::Instance()->ms_sHOURLY) iType = nsCalUtility::RT_HOURLY; - else if (s == nsCalKeyword::Instance()->ms_sDAILY) iType = nsCalUtility::RT_DAILY; - else if (s == nsCalKeyword::Instance()->ms_sWEEKLY) iType = nsCalUtility::RT_WEEKLY; - else if (s == nsCalKeyword::Instance()->ms_sMONTHLY) iType = nsCalUtility::RT_MONTHLY; - else if (s == nsCalKeyword::Instance()->ms_sYEARLY) iType = nsCalUtility::RT_YEARLY; - else bParseError = TRUE; - } - else - { - bParseError = TRUE; - } - return iType; -} - -//--------------------------------------------------------------------- -// TODO: crash proof -// bZero, allow zero to pass or not? -t_int32 * -Recurrence::verifyIntList(JulianPtrArray * v, t_int32 lowerBound, - t_int32 upperBound, UnicodeString & error, - t_int32 & retSize, t_bool & bParseError, - t_bool bZero) -{ - UnicodeString s, into; - t_int32 * i = new t_int32[v->GetSize()]; - t_int32 j; - t_int32 k; - retSize = 0; - t_int8 bMinusOrPlus = 0; - t_int32 startIndex = 0; - - // NOTE: to remove compiler warning - if (error.size() > 0) {} - - PR_ASSERT(v != 0); - for (j = 0; j < v->GetSize(); j++) - { - s = *((UnicodeString *) v->GetAt(j)); - startIndex = 0; - bMinusOrPlus = 0; - // If minus or plus in front, remove before extracting number - if (s[(TextOffset)0] == '-') - { - bMinusOrPlus = -1; - startIndex = 1; - } - else if (s[(TextOffset)0] == '+') - { - bMinusOrPlus = 1; - startIndex = 1; - } - char * kcc = s.extractBetween(startIndex, s.size(), into).toCString(""); - PR_ASSERT(kcc != 0); - k = nsCalUtility::atot_int32(kcc, - bParseError, (s.size() - startIndex)); - delete [] kcc; kcc = 0; - - // if Minus sign, set to inverse - if (bMinusOrPlus < 0) - { - k = 0 - k; - } - //k = nsCalUtility::atot_int32(s.toCString(""), bParseError, s.size()); - - if (bZero && k == 0) - bParseError = TRUE; - if ((k <= upperBound) && (k >= lowerBound)) - { - i[j] = k; - retSize++; - } - else - { - // TODO: log and error - bParseError = TRUE; - } - } - - // TODO: remove duplicates and sort int list HERE - - return i; -} - -//--------------------------------------------------------------------- -// TODO: crash proof -RRDay * -Recurrence::createByDayList(JulianPtrArray * v, t_int32 type, - t_int32 & retSize, - t_bool & bParseError) -{ - t_int32 i; - t_int32 day, modifier; - PR_ASSERT(v != 0); - - RRDay * l = new RRDay[v->GetSize()]; - UnicodeString * sPtr; - retSize = v->GetSize(); - - for (i = 0; i < v->GetSize(); i++) - { - sPtr = (UnicodeString *) v->GetAt(i); - - // get the day and modifier from the string - createByDayListHelper(*sPtr, day, modifier, bParseError); - - // if modifier out of bounds, set bParseError to TRUE - if ((type == nsCalUtility::RT_YEARLY) && - (modifier < -53 || modifier > 53)) - { - bParseError = TRUE; - } - else if ((type == nsCalUtility::RT_MONTHLY) && - (modifier < -5 || modifier > 5)) - { - bParseError = TRUE; - } - l[i].fields[0] = day; - l[i].fields[1] = modifier; - } - return l; -} -//--------------------------------------------------------------------- -void Recurrence::createByDayListHelper(UnicodeString & in, - t_int32 & day, - t_int32 & modifier, - t_bool & bParseError) -{ - if (in.size() < 2) - bParseError = TRUE; - else - { - t_int8 bMinusOrPlus = 0, startIndex = 0; - UnicodeString into; - into = in.extractBetween(in.size() - 2, in.size(), into); - day = stringToDay(into, bParseError); - if (in.size() > 2) - { - // If minus or plus in front, remove before extracting number - if (in[(TextOffset)0] == '-') - { - bMinusOrPlus = -1; - startIndex = 1; - } - else if (in[(TextOffset)0] == '+') - { - bMinusOrPlus = 1; - startIndex = 1; - } - - char * incc = in.extractBetween(startIndex, - in.size() - 2, into).toCString(""); - PR_ASSERT(incc != 0); - modifier = - nsCalUtility::atot_int32(incc, - bParseError, (in.size() - 2 - startIndex)); - delete [] incc; incc = 0; - // if Minus sign, set to inverse - if (bMinusOrPlus < 0) - { - modifier = 0 - modifier; - } - } - else - { - modifier = 0; - } - } -} -//--------------------------------------------------------------------- - -void Recurrence::eliminateDuplicates(JulianPtrArray * datetimes) -{ - t_int32 i; - if (datetimes != 0) - { - // NOTE: Order NlogN + N, (sort, then compare consective elements) - datetimes->QuickSort(DateTime::CompareDateTimes); - t_int32 size = datetimes->GetSize(); - DateTime * dt, * dt2; - - for (i = size - 1; i >= 1; i--) - { - dt = (DateTime *) datetimes->GetAt(i); - dt2 = (DateTime *) datetimes->GetAt(i - 1); - if (dt->equalsDateTime(*dt2)) - { - delete dt; dt = 0; - datetimes->RemoveAt(i); - } - } - } -} - -//--------------------------------------------------------------------- -void Recurrence::deleteUnicodeStringVector(JulianPtrArray * strings) -{ - t_int32 i; - if (strings != 0) - { - for (i = strings->GetSize() - 1; i >= 0; i--) - { - delete ((UnicodeString *)strings->GetAt(i)); - } - } -} -//--------------------------------------------------------------------- -void Recurrence::deleteDateTimeVector(JulianPtrArray * datetimes) -{ - t_int32 i; - if (datetimes != 0) - { - for (i = datetimes->GetSize() - 1; i >= 0; i--) - { - delete ((DateTime *)datetimes->GetAt(i)); - } - } -} -//--------------------------------------------------------------------- -void Recurrence::deleteRecurrenceVector(JulianPtrArray * recurrences) -{ - t_int32 i; - if (recurrences != 0) - { - for (i = recurrences->GetSize() - 1; i >= 0; i--) - { - delete ((Recurrence *)recurrences->GetAt(i)); - } - } -} -//--------------------------------------------------------------------- -void -Recurrence::deleteICalParameterVector(JulianPtrArray * parameters) -{ - ICalParameter * ip; - t_int32 i; - if (parameters != 0) - { - for (i = parameters->GetSize() - 1; i >= 0; i--) - { - ip = (ICalParameter *) parameters->GetAt(i); - delete ip; ip = 0; - } - } -} -//--------------------------------------------------------------------- -void Recurrence::deleteDateTimeVectorVector(JulianPtrArray * vDateTimes) -{ - t_int32 i; - JulianPtrArray * xp; - if (vDateTimes != 0) - { - for (i = vDateTimes->GetSize() - 1; i >= 0; i--) - { - xp = (JulianPtrArray *) vDateTimes->GetAt(i); - deleteDateTimeVector(xp); - xp->RemoveAll(); - delete xp; xp = 0; - } - } -} -//--------------------------------------------------------------------- -#if 0 -void -Recurrence::copyDateTimesInto(JulianPtrArray * from, - DateTime * to) -{ - t_int32 i; - PR_ASSERT(to != 0 && from != 0); - DateTime d; - for (i = 0; i < from->GetSize(); i++) - { - d = *((DateTime *) from->GetAt(i)); - to[i] = d; - } -} -#endif -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/recid.cpp b/mozilla/calendar/modules/core/ical/src/recid.cpp deleted file mode 100644 index 80ce9d03a4e..00000000000 --- a/mozilla/calendar/modules/core/ical/src/recid.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// recid.cpp -// John Sun -// 3/20/98 5:18:34 PM - -#include "stdafx.h" -#include "jdefines.h" -#include "recid.h" -#include "keyword.h" -#include "jlog.h" -//--------------------------------------------------------------------- - -// private never use -#if 0 -nsCalRecurrenceID::nsCalRecurrenceID() -{ - PR_ASSERT(FALSE); -} -#endif -//--------------------------------------------------------------------- - -nsCalRecurrenceID::nsCalRecurrenceID(JLog * initLog) -: m_DateTime(-1), m_Range(nsCalRecurrenceID::RANGE_NONE), - m_Log(initLog) -{ - //PR_ASSERT(initLog != 0); -} - -//--------------------------------------------------------------------- - -nsCalRecurrenceID::nsCalRecurrenceID(nsCalRecurrenceID & that) -: m_Range(that.m_Range) -{ - m_DateTime = that.m_DateTime; -} - -//--------------------------------------------------------------------- - -nsCalRecurrenceID::nsCalRecurrenceID(DateTime datetime, - JLog * initLog, - RANGE range) - -: m_Range(range), m_Log(initLog) -{ - m_DateTime = datetime; - //PR_ASSERT(initLog != 0); -} - -//--------------------------------------------------------------------- - -nsCalRecurrenceID::~nsCalRecurrenceID() {} - -//--------------------------------------------------------------------- - -ICalProperty * nsCalRecurrenceID::clone(JLog * initLog) -{ - m_Log = initLog; - //PR_ASSERT(m_Log != 0); - return new nsCalRecurrenceID(*this); -} - -//--------------------------------------------------------------------- - -void nsCalRecurrenceID::setParameters(JulianPtrArray * parameters) -{ - t_int32 i; - ICalParameter * ip; - UnicodeString pName; - UnicodeString pVal; - if (parameters != 0) - { - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - setParam(ip->getParameterName(pName), ip->getParameterValue(pVal)); - } - } -} - -//--------------------------------------------------------------------- - -void nsCalRecurrenceID::setParam(UnicodeString & paramName, UnicodeString & paramVal) -{ - t_int32 i; - if (paramName.size() == 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName, - nsCalKeyword::Instance()->ms_sRECURRENCEID, paramName, 200); - } - else - { - t_int32 hashCode = paramName.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_RANGE == hashCode) - { - i = nsCalRecurrenceID::stringToRange(paramVal); - if (i < 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue, - nsCalKeyword::Instance()->ms_sRECURRENCEID, paramName, paramVal, 200); - } - else - { - if (getRange() >= 0) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter, - nsCalKeyword::Instance()->ms_sRECURRENCEID, paramName, 100); - } - setRange((nsCalRecurrenceID::RANGE) i); - } - } - else if (ICalProperty::IsXToken(paramName)) - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iXTokenParamIgnored, - nsCalKeyword::Instance()->ms_sRECURRENCEID, paramName, 100); - } - else - { - // NOTE: what about optional parameters?? THERE ARE NONE. - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName, - nsCalKeyword::Instance()->ms_sRECURRENCEID, paramName, 200); - } - } -} - -//--------------------------------------------------------------------- - -t_bool nsCalRecurrenceID::isValid() -{ - return m_DateTime.isValid(); -} - -//--------------------------------------------------------------------- - -UnicodeString & -nsCalRecurrenceID::toString(UnicodeString & strFmt, UnicodeString & out) -{ - // NOTE: Remove later - if (strFmt.size() > 0) {} - - return toString(out); -} - -//--------------------------------------------------------------------- - -void -nsCalRecurrenceID::setValue(void * value) -{ - PR_ASSERT(value != 0); - if (value != 0) - { - setDateTime(*((DateTime *) value)); - } -} - -//--------------------------------------------------------------------- - -void * -nsCalRecurrenceID::getValue() const -{ - return (void *) &m_DateTime; -} - -//--------------------------------------------------------------------- - -UnicodeString & -nsCalRecurrenceID::toString(UnicodeString & out) -{ - UnicodeString u; - out = ""; - out += nsCalKeyword::Instance()->ms_sRANGE; - out += nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - out += rangeToString(m_Range, u); - out += nsCalKeyword::Instance()->ms_sDATE; - out += nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - out += m_DateTime.toISO8601(); - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -nsCalRecurrenceID::toICALString(UnicodeString & sProp, UnicodeString & out) -{ - out = ""; - out += sProp; - if (m_Range != nsCalRecurrenceID::RANGE_NONE) - { - UnicodeString u; - out += ';'; - out += nsCalKeyword::Instance()->ms_sRANGE; - out += '='; - out += rangeToString(m_Range, u); - } - out += ':'; - out += m_DateTime.toISO8601(); - out += nsCalKeyword::Instance()->ms_sLINEBREAK; - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -nsCalRecurrenceID::toICALString(UnicodeString & out) -{ - UnicodeString u; - return toICALString(u, out); -} - -//--------------------------------------------------------------------- - -nsCalRecurrenceID::RANGE -nsCalRecurrenceID::stringToRange(UnicodeString & sRange) -{ - t_int32 hashCode = sRange.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_THISANDPRIOR == hashCode) - return RANGE_THISANDPRIOR; - else if (nsCalKeyword::Instance()->ms_ATOM_THISANDFUTURE == hashCode) - return RANGE_THISANDFUTURE; - else return RANGE_NONE; -} - -//--------------------------------------------------------------------- - -UnicodeString & -nsCalRecurrenceID::rangeToString(nsCalRecurrenceID::RANGE range, - UnicodeString & out) -{ - out = ""; - switch(range) - { - case RANGE_THISANDPRIOR: out = nsCalKeyword::Instance()->ms_sTHISANDPRIOR; break; - case RANGE_THISANDFUTURE: out = nsCalKeyword::Instance()->ms_sTHISANDFUTURE; break; - default: - // NONE case - out = ""; - } - return out; -} - -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/rrday.cpp b/mozilla/calendar/modules/core/ical/src/rrday.cpp deleted file mode 100644 index 27a8fe4f42f..00000000000 --- a/mozilla/calendar/modules/core/ical/src/rrday.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// rrday.cpp -// John Sun -// 7:54 PM February 4 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include -#include "rrday.h" - -//--------------------------------------------------------------------- - -RRDay::RRDay() -{ - fields[0] = 0; - fields[1] = 0; -} - -//--------------------------------------------------------------------- - -RRDay::RRDay(t_int32 aDay, t_int32 aModifier) -{ - fields[0] = aDay; - fields[1] = aModifier; -} - -//--------------------------------------------------------------------- - -t_int32 RRDay::operator[](t_int32 index) const -{ - PR_ASSERT(index >= 0 && index < 2); - // Pin args in index is invalid - if (index < 0) - index = 0; - else if (index > 1) - index = 1; - - return fields[index]; -} - -//--------------------------------------------------------------------- - -void RRDay::operator=(RRDay & that) -{ - fields[0] = that.fields[0]; - fields[1] = that.fields[1]; -} - -//--------------------------------------------------------------------- - -t_bool RRDay::operator==(RRDay & that) -{ - return (fields[0] == that.fields[0]) && (fields[1] == that.fields[1]); -} - -//--------------------------------------------------------------------- - -t_bool RRDay::operator!=(RRDay & that) -{ - return (fields[0] != that.fields[0]) || (fields[1] != that.fields[1]); -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/sdprprty.cpp b/mozilla/calendar/modules/core/ical/src/sdprprty.cpp deleted file mode 100644 index d8b6f5a7815..00000000000 --- a/mozilla/calendar/modules/core/ical/src/sdprprty.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// sdprprty.cpp -// John Sun -// 4:11 PM February 10 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "jlog.h" -#include "sdprprty.h" -#include "keyword.h" -#include - -//--------------------------------------------------------------------- -StandardProperty::StandardProperty() -: m_vParameters(0) -{ -} -//--------------------------------------------------------------------- -StandardProperty::StandardProperty(JulianPtrArray * parameters) -: m_vParameters(0) -{ - setParameters(parameters); -} -//--------------------------------------------------------------------- -StandardProperty::~StandardProperty() -{ - if (m_vParameters != 0) - { - ICalProperty::deleteICalParameterVector(m_vParameters); - delete m_vParameters; m_vParameters = 0; - } -} -//--------------------------------------------------------------------- -UnicodeString & -StandardProperty::getParameterValue(UnicodeString & paramName, - UnicodeString & paramValue, - ErrorCode & status) -{ - t_int32 i; - ICalParameter * param; - UnicodeString into; - status = ZERO_ERROR; - if (m_vParameters == 0) - { - status = 1; - paramValue = ""; - return paramValue; - } - else - { - for (i = 0; i < m_vParameters->GetSize(); i++) - { - param = (ICalParameter *) m_vParameters->GetAt(i); - if (param->getParameterName(into).compareIgnoreCase(paramName) == 0) - { - // a match - paramValue = param->getParameterValue(into); - return paramValue; - } - } - status = 2; - paramValue = ""; - return paramValue; - } -} -//--------------------------------------------------------------------- - -void StandardProperty::addParameter(ICalParameter * aParameter) -{ - // TODO: check for duplicates? - m_vParameters->Add(aParameter); -} -//--------------------------------------------------------------------- - -void StandardProperty::parse(UnicodeString & in) -{ -#if 0 - UnicodeString name, value; - - if (m_vParameters != 0) { - ICalProperty::deleteICalParameterVector(m_vParameters); - delete m_vParameters; - } - m_vParameters = 0; - - JulianPtrArray * parameters = new JulianPtrArray(); - PR_ASSERT(parameters != 0); - if (parameters != 0) - { - // parse in a a line, it will fill in vector - parsePropertyLine(in, name, value, parameters); - - // TODO: fix. need to cast value to correct type, but I - // can't find out type here. - setValue((void *) m_vParameters->GetAt(1)); - setParameters(parameters); - - ICalProperty::deleteICalParameterVector(parameters); - delete parameters; parameters = 0; - } -#else - // don't use for now - PR_ASSERT(FALSE); -#endif /* #if 0 */ -} -//--------------------------------------------------------------------- - -void StandardProperty::setParameters(JulianPtrArray * parameters) -{ - if (m_vParameters != 0) - { - ICalProperty::deleteICalParameterVector(m_vParameters); - delete m_vParameters; m_vParameters = 0; - } - - // NOTE: I am making a copy of the parameters - // I am not storing the ptr. - if (parameters != 0) - { - t_int32 i; - ICalParameter * ip, * ip2; - m_vParameters = new JulianPtrArray(); - PR_ASSERT(m_vParameters != 0); - if (m_vParameters != 0) - { - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - PR_ASSERT(ip != 0); - if (ip != 0) - { - ip2 = ip->clone(); - PR_ASSERT(ip2 != 0); - if (ip2 != 0) - { - m_vParameters->Add(ip2); - } - } - } - } - } -} - -//--------------------------------------------------------------------- - -UnicodeString & -StandardProperty::toICALString(UnicodeString & out) -{ - UnicodeString u, name; - u = toExportString(u); - return propertyToICALString(name, u, m_vParameters, out); -} - -//--------------------------------------------------------------------- - -UnicodeString & -StandardProperty::toICALString(UnicodeString & sProp, - UnicodeString & out) -{ - UnicodeString u; - u = toExportString(u); - return propertyToICALString(sProp, u, m_vParameters, out); -} - -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/sprpty.cpp b/mozilla/calendar/modules/core/ical/src/sprpty.cpp deleted file mode 100644 index 65244ada81d..00000000000 --- a/mozilla/calendar/modules/core/ical/src/sprpty.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// sprprty.cpp -// John Sun -// 5:10 PM February 10 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "sprprty.h" - -//--------------------------------------------------------------------- - -// private never use -StringProperty::StringProperty() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -StringProperty::StringProperty(const StringProperty & that) -{ - setParameters(that.m_vParameters); - m_string = that.m_string; -} - -//--------------------------------------------------------------------- - -//StringProperty::StringProperty(UnicodeString * value, JulianPtrArray * parameters) -StringProperty::StringProperty(UnicodeString value, JulianPtrArray * parameters) -: StandardProperty(parameters) -{ - //PR_ASSERT(value != 0); - //m_string = *((UnicodeString *) value); - m_string = value; -} - -//--------------------------------------------------------------------- - -StringProperty::~StringProperty() -{ - //delete m_string; - ////deleteICalParameterVector(m_vParameters); - ////delete m_vParameters; m_vParameters = 0; -} - -//--------------------------------------------------------------------- - -void * StringProperty::getValue() const -{ - //return (void *) m_string; - return (void *) &m_string; -} - -//--------------------------------------------------------------------- - -void StringProperty::setValue(void * value) -{ - PR_ASSERT(value != 0); - //if (m_string != 0) { delete m_string; m_string = 0; } - //m_string = ((UnicodeString *) value); - if (value != 0) - { - m_string = *(UnicodeString *) value; - } -} - -//--------------------------------------------------------------------- - -ICalProperty * StringProperty::clone(JLog * initLog) -{ - // NOTE: Remove later to avoid warnings - if (initLog) {} - return new StringProperty(*this); -} - -//--------------------------------------------------------------------- - -t_bool StringProperty::isValid() -{ - return TRUE; -} - -//--------------------------------------------------------------------- - -UnicodeString & StringProperty::toString(UnicodeString & out) -{ - //PR_ASSERT(m_string != 0); - //out = *m_string; - out = m_string; - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -StringProperty::toString(UnicodeString & dateFmt, UnicodeString & out) -{ - // NOTE: remove it later, gets rid of compiler warning - if (dateFmt.size() > 0) {} - return toString(out); -} - -//--------------------------------------------------------------------- - -UnicodeString & StringProperty::toExportString(UnicodeString & out) -{ - return toString(out); -} -//--------------------------------------------------------------------- - - diff --git a/mozilla/calendar/modules/core/ical/src/tmbevent.cpp b/mozilla/calendar/modules/core/ical/src/tmbevent.cpp deleted file mode 100644 index ef9439e7223..00000000000 --- a/mozilla/calendar/modules/core/ical/src/tmbevent.cpp +++ /dev/null @@ -1,3250 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// tmbevent.cpp -// John Sun -// 3:21 PM February 6 1998 - -#define TIMING 1 - -#include "stdafx.h" -#include "jdefines.h" - -#include "icalcomp.h" -#include "tmbevent.h" -#include "attendee.h" -#include "jutility.h" -#include "prprty.h" -#include "prprtyfy.h" -#include "unistrto.h" -#include "jlog.h" -#include "vtimezne.h" -#include "keyword.h" - -#include "rcrrence.h" -#include "period.h" -#include "sprprty.h" -#include "recid.h" -#include "orgnzr.h" -#include "valarm.h" - -#include "functbl.h" -//--------------------------------------------------------------------- - -t_int32 TimeBasedEvent::ms_iBound = 60; - -//--------------------------------------------------------------------- - -// private never use -#if 0 -TimeBasedEvent::TimeBasedEvent() -{ - PR_ASSERT(FALSE); -} -#endif - -//--------------------------------------------------------------------- - -TimeBasedEvent::TimeBasedEvent(JLog * initLog) -: m_bAllDayEvent(FALSE), - m_AlarmsVctr(0), m_AttachVctr(0), m_AttendeesVctr(0), - m_CategoriesVctr(0), m_CommentVctr(0), m_Created(0), m_DTStart(0), - m_DTStamp(0), m_ExDateVctr(0), m_ExRuleVctr(0), - m_LastModified(0), m_RDateVctr(0), m_RRuleVctr(0), - m_RecurrenceID(0), - m_RelatedToVctr(0), - m_Sequence(0), m_ContactVctr(0), m_XTokensVctr(0), - m_Description(0), m_Class(0), m_URL(0), m_Summary(0), m_Status(0), - m_RequestStatusVctr(0), m_UID(0), m_Organizer(0), - m_Log(initLog) -{ -} - -//--------------------------------------------------------------------- - -TimeBasedEvent::TimeBasedEvent(TimeBasedEvent & that) -: m_bAllDayEvent(FALSE), - m_AlarmsVctr(0), m_AttachVctr(0), m_AttendeesVctr(0), - m_CategoriesVctr(0), m_CommentVctr(0), m_Created(0), m_DTStart(0), - m_DTStamp(0), m_ExDateVctr(0), m_ExRuleVctr(0), - m_LastModified(0), m_RDateVctr(0), m_RRuleVctr(0), - m_RecurrenceID(0), - m_RelatedToVctr(0), - m_Sequence(0), m_ContactVctr(0), m_XTokensVctr(0), - m_Description(0), m_Class(0), m_URL(0), m_Summary(0), m_Status(0), - m_RequestStatusVctr(0), m_UID(0), m_Organizer(0) -{ - m_sMethod = that.m_sMethod; - m_sFileName = that.m_sFileName; - m_origDTStart = that.m_origDTStart; - m_origMyDTStart = that.m_origMyDTStart; - m_bAllDayEvent = that.m_bAllDayEvent; - - if (that.m_AlarmsVctr != 0) - { - m_AlarmsVctr = new JulianPtrArray(); PR_ASSERT(m_AlarmsVctr != 0); - if (m_AlarmsVctr != 0) - { - ICalComponent::cloneICalComponentVector(m_AlarmsVctr, that.m_AlarmsVctr); - } - } - - // copy properties - if (that.m_AttachVctr != 0) - { - m_AttachVctr = new JulianPtrArray(); PR_ASSERT(m_AttachVctr != 0); - if (m_AttachVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_AttachVctr, m_AttachVctr, m_Log); - } - } - if (that.m_AttendeesVctr != 0) - { - m_AttendeesVctr = new JulianPtrArray(); PR_ASSERT(m_AttendeesVctr != 0); - if (m_AttendeesVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_AttendeesVctr, m_AttendeesVctr, m_Log); - } - } - if (that.m_CategoriesVctr != 0) - { - m_CategoriesVctr = new JulianPtrArray(); PR_ASSERT(m_CategoriesVctr != 0); - if (m_CategoriesVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_CategoriesVctr, m_CategoriesVctr, m_Log); - } - } - if (that.m_Class != 0) { m_Class = that.m_Class->clone(m_Log); } - - if (that.m_CommentVctr != 0) - { - m_CommentVctr = new JulianPtrArray(); PR_ASSERT(m_CommentVctr != 0); - if (m_CommentVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_CommentVctr, m_CommentVctr, m_Log); - } - } - if (that.m_ContactVctr != 0) - { - m_ContactVctr = new JulianPtrArray(); PR_ASSERT(m_ContactVctr != 0); - if (m_ContactVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_ContactVctr, m_ContactVctr, m_Log); - } - } - if (that.m_Created != 0) - { - m_Created = that.m_Created->clone(m_Log); - } - if (that.m_Description != 0) - { - m_Description = that.m_Description->clone(m_Log); - } - if (that.m_DTStart != 0) - { - m_DTStart = that.m_DTStart->clone(m_Log); - } - if (that.m_DTStamp != 0) - { - m_DTStamp = that.m_DTStamp->clone(m_Log); - } - - if (that.m_ExDateVctr != 0) - { - m_ExDateVctr = new JulianPtrArray(); PR_ASSERT(m_ExDateVctr != 0); - if (m_ExDateVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_ExDateVctr, m_ExDateVctr, m_Log); - } - } - if (that.m_ExRuleVctr != 0) - { - m_ExRuleVctr = new JulianPtrArray(); PR_ASSERT(m_ExRuleVctr != 0); - if (m_ExRuleVctr != 0) - { - // note: unicodestring vector not ICALPropertyVector - ICalProperty::CloneUnicodeStringVector(that.m_ExRuleVctr, m_ExRuleVctr); - } - } - - if (that.m_LastModified != 0) - { - m_LastModified = that.m_LastModified->clone(m_Log); - } - if (that.m_Organizer != 0) - { - m_Organizer = that.m_Organizer->clone(m_Log); - } - if (that.m_RecurrenceID != 0) - { - m_RecurrenceID = that.m_RecurrenceID->clone(m_Log); - } - - if (that.m_RDateVctr != 0) - { - m_RDateVctr = new JulianPtrArray(); PR_ASSERT(m_RDateVctr != 0); - if (m_RDateVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_RDateVctr, m_RDateVctr, m_Log); - } - } - if (that.m_RRuleVctr != 0) - { - m_RRuleVctr = new JulianPtrArray(); PR_ASSERT(m_RRuleVctr != 0); - if (m_RRuleVctr != 0) - { - // note: unicodestring vector not ICALPropertyVector - ICalProperty::CloneUnicodeStringVector(that.m_RRuleVctr, m_RRuleVctr); - } - } - if (that.m_RelatedToVctr != 0) - { - m_RelatedToVctr = new JulianPtrArray(); PR_ASSERT(m_RelatedToVctr != 0); - if (m_RelatedToVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_RelatedToVctr, m_RelatedToVctr, m_Log); - } - } - - if (that.m_RequestStatusVctr != 0) - { - m_RequestStatusVctr = new JulianPtrArray(); PR_ASSERT(m_RequestStatusVctr != 0); - if (m_RequestStatusVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_RequestStatusVctr, m_RequestStatusVctr, m_Log); - } - } - if (that.m_Sequence != 0) - { - m_Sequence = that.m_Sequence->clone(m_Log); - } - if (that.m_Status != 0) - { - m_Status = that.m_Status->clone(m_Log); - } - if (that.m_Summary != 0) - { - m_Summary = that.m_Summary->clone(m_Log); - } - if (that.m_UID != 0) - { - m_UID = that.m_UID->clone(m_Log); - } - if (that.m_URL != 0) - { - m_URL = that.m_URL->clone(m_Log); - } - - if (that.m_XTokensVctr != 0) - { - m_XTokensVctr = new JulianPtrArray(); PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - ICalProperty::CloneUnicodeStringVector(that.m_XTokensVctr, m_XTokensVctr); - } - } -} -//--------------------------------------------------------------------- - -TimeBasedEvent::~TimeBasedEvent() -{ - if (m_AlarmsVctr != 0) - { - ICalComponent::deleteICalComponentVector(m_AlarmsVctr); - delete m_AlarmsVctr; m_AlarmsVctr = 0; - } - - // datetime properties - if (m_Created != 0) - { - delete m_Created; m_Created = 0; - } - if (m_DTStart != 0) - { - delete m_DTStart; m_DTStart = 0; - } - if (m_DTStamp != 0) - { - delete m_DTStamp; m_DTStamp = 0; - } - if (m_LastModified != 0) - { - delete m_LastModified; m_LastModified = 0; - } - - // string properties - if (m_Description != 0) - { - delete m_Description; m_Description = 0; - } - if (m_Class != 0) - { - delete m_Class ; m_Class = 0; - } - if (m_Summary != 0) - { - delete m_Summary; m_Summary = 0; - } - if (m_Status != 0) - { - delete m_Status; m_Status = 0; - } - if (m_RequestStatusVctr != 0) - { - //delete m_RequestStatus; m_RequestStatus = 0; - ICalProperty::deleteICalPropertyVector(m_RequestStatusVctr); - delete m_RequestStatusVctr; m_RequestStatusVctr = 0; - } - - if (m_UID != 0) - { - delete m_UID; m_UID = 0; - } - if (m_URL != 0) - { - delete m_URL; m_URL = 0; - } - if (m_Organizer != 0) - { - delete m_Organizer; m_Organizer = 0; - } - if (m_RecurrenceID != 0) - { - delete m_RecurrenceID ; m_RecurrenceID = 0; - } - - // integer properties - if (m_Sequence != 0) - { - delete m_Sequence; m_Sequence = 0; - } - - // attendees - if (m_AttendeesVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_AttendeesVctr); - delete m_AttendeesVctr; m_AttendeesVctr = 0; - } - - // string vectors - if (m_AttachVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_AttachVctr); - delete m_AttachVctr; m_AttachVctr = 0; - } - if (m_CategoriesVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_CategoriesVctr); - delete m_CategoriesVctr; m_CategoriesVctr = 0; - } - if (m_CommentVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_CommentVctr); - delete m_CommentVctr; m_CommentVctr = 0; - } - if (m_ExDateVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_ExDateVctr); - delete m_ExDateVctr; m_ExDateVctr = 0; - } - if (m_ExRuleVctr != 0) - { - ICalComponent::deleteUnicodeStringVector(m_ExRuleVctr); - delete m_ExRuleVctr; m_ExRuleVctr = 0; - } - if (m_RDateVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_RDateVctr); - delete m_RDateVctr; m_RDateVctr = 0; - } - if (m_RRuleVctr != 0) - { - ICalComponent::deleteUnicodeStringVector(m_RRuleVctr); - delete m_RRuleVctr; m_RRuleVctr = 0; - } - if (m_RelatedToVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_RelatedToVctr); - delete m_RelatedToVctr; m_RelatedToVctr = 0; - } - if (m_ContactVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_ContactVctr); - delete m_ContactVctr; m_ContactVctr = 0; - } - if (m_XTokensVctr != 0) - { - ICalComponent::deleteUnicodeStringVector(m_XTokensVctr); - delete m_XTokensVctr; m_XTokensVctr = 0; - } -} - -//--------------------------------------------------------------------- - - -UnicodeString -TimeBasedEvent::toStringChar(t_int32 c, UnicodeString & dateFmt) -{ - JulianPtrArray * v = 0; - UnicodeString s; - - // TODO: handle x-tokens - // exdate, exrules, rdates, rrules - - switch ( c ) - { - - case ms_cAlarms: - v = getAlarms(); - if (v != 0) - { - VAlarm * va = 0; - t_int32 i; - for (i = 0; i < v->GetSize(); i++) - { - va = (VAlarm *) v->GetAt(i); - s += va->toString(); - } - } - return s; - case ms_cAttach: - return ICalProperty::propertyVectorToString(getAttach(), dateFmt, s); - case ms_cAttendees: - return ICalProperty::propertyVectorToString(getAttendees(), dateFmt, s); - case ms_cCategories: - return ICalProperty::propertyVectorToString(getCategories(), dateFmt, s); - case ms_cComment: - return ICalProperty::propertyVectorToString(getComment(), dateFmt, s); - case ms_cClass: - return ICalProperty::propertyToString(getClassProperty(), dateFmt, s); - case ms_cURL: - return ICalProperty::propertyToString(getURLProperty(), dateFmt, s); - case ms_cCreated: - return ICalProperty::propertyToString(getCreatedProperty(), dateFmt, s); - case ms_cDescription: - return ICalProperty::propertyToString(getDescriptionProperty(), dateFmt, s); - case ms_cDTStart: - return ICalProperty::propertyToString(getDTStartProperty(), dateFmt, s); - case ms_cDTStamp: - return ICalProperty::propertyToString(getDTStampProperty(), dateFmt, s); - case ms_cLastModified: - return ICalProperty::propertyToString(getLastModifiedProperty(), dateFmt, s); - case ms_cRelatedTo: - return ICalProperty::propertyVectorToString(getRelatedTo(), dateFmt, s); - case ms_cRequestStatus: - return ICalProperty::propertyVectorToString(getRequestStatus(), dateFmt, s); - case ms_cSequence: - return ICalProperty::propertyToString(getSequenceProperty(), dateFmt, s); - case ms_cStatus: - return ICalProperty::propertyToString(getStatusProperty(), dateFmt, s); - case ms_cSummary: - return ICalProperty::propertyToString(getSummaryProperty(), dateFmt, s); - case ms_cUID: - return ICalProperty::propertyToString(getUIDProperty(), dateFmt, s); - case ms_cOrganizer: - return ICalProperty::propertyToString(getOrganizerProperty(), dateFmt, s); - case ms_cRecurrenceID: - return ICalProperty::propertyToString(getRecurrenceIDProperty(), dateFmt, s); - case ms_cContact: - return ICalProperty::propertyVectorToString(getContact(), dateFmt, s); - default: - return ""; - } -} - -//--------------------------------------------------------------------- - -UnicodeString -TimeBasedEvent::formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString sResult, s; - t_int32 i; - JulianPtrArray * v; - - switch ( c ) - { - case ms_cAlarms: - v = getAlarms(); - if (v != 0) - { - VAlarm * va; - for (i = 0; i < v->GetSize(); i++) - { - va = (VAlarm *) v->GetAt(i); - s = va->toICALString(); - sResult += s; - } - } - return sResult; - case ms_cAttach: - s = nsCalKeyword::Instance()->ms_sATTACH; - return ICalProperty::propertyVectorToICALString(s, getAttach(), sResult); - case ms_cAttendees: - { - v = getAttendees(); - if (v != 0) - { - if (delegateRequest) - { - for (i = 0; i < v->GetSize(); i++) - { - Attendee * a = (Attendee *) v->GetAt(i); - if (a != 0) - { - if ( - //(a->getRole() == Attendee::ROLE_OWNER) || - //(a->getRole() == Attendee::ROLE_ORGANIZER) || - (a->getStatus() == Attendee::STATUS_DELEGATED) - // || (a->getRole() == Attendee::ROLE_DELEGATE) - ) - { - s = a->toICALString(s); - //sResult += s; - sResult += ICalProperty::multiLineFormat(s); - } - } - } - } - else if (sFilterAttendee.size() > 0) - { - Attendee * a = getAttendee(sFilterAttendee); - if (a != 0) - s = a->toICALString(s); - else - s = ""; - //sResult += s; - sResult += ICalProperty::multiLineFormat(s); - } - else - { - for (i = 0; i < v->GetSize(); i++) - { - s = ((Attendee * ) v->GetAt(i))->toICALString(s); - //sResult += s; - sResult += ICalProperty::multiLineFormat(s); - } - } - } - return sResult; - // return sResult.toString(); - } - case ms_cCategories: - s = nsCalKeyword::Instance()->ms_sCATEGORIES; - return ICalProperty::propertyVectorToICALString(s, getCategories(), sResult); - case ms_cClass: - s = nsCalKeyword::Instance()->ms_sCLASS; - return ICalProperty::propertyToICALString(s, getClassProperty(), sResult); - case ms_cComment: - s = nsCalKeyword::Instance()->ms_sCOMMENT; - return ICalProperty::propertyVectorToICALString(s, getComment(), sResult); - case ms_cURL: - s = nsCalKeyword::Instance()->ms_sURL; - return ICalProperty::propertyToICALString(s, getURLProperty(), sResult); - case ms_cCreated: - s = nsCalKeyword::Instance()->ms_sCREATED; - return ICalProperty::propertyToICALString(s, getCreatedProperty(), sResult); - case ms_cDescription: - s = nsCalKeyword::Instance()->ms_sDESCRIPTION; - return ICalProperty::propertyToICALString(s, getDescriptionProperty(), sResult); - case ms_cDTStart: - s = nsCalKeyword::Instance()->ms_sDTSTART; - return ICalProperty::propertyToICALString(s, getDTStartProperty(), sResult); - case ms_cDTStamp: - s = nsCalKeyword::Instance()->ms_sDTSTAMP; - return ICalProperty::propertyToICALString(s, getDTStampProperty(), sResult); - case ms_cExDate: - s = nsCalKeyword::Instance()->ms_sEXDATE; - return ICalProperty::propertyVectorToICALString(s, getExDates(), sResult); - case ms_cExRule: - if (getExRules() != 0) - { - //s = nsCalKeyword::Instance()->ms_sEXRULE; - //return ICalComponent::propertyVToCalString(s, getExRules(), sResult); - return ICalProperty::vectorToICALString(getExRules(), sResult); - } - return ""; - case ms_cLastModified: - s = nsCalKeyword::Instance()->ms_sLASTMODIFIED; - return ICalProperty::propertyToICALString(s, getLastModifiedProperty(), sResult); - case ms_cRDate: - s = nsCalKeyword::Instance()->ms_sRDATE; - return ICalProperty::propertyVectorToICALString(s, getRDates(), sResult); - case ms_cRRule: - if (getRRules() != 0) - { - //s = nsCalKeyword::Instance()->ms_sRRULE; - //return ICalComponent::propertyVToCalString(s, getRRules(), sResult); - return ICalProperty::vectorToICALString(getRRules(), sResult); - } - return ""; - case ms_cRecurrenceID: - s = nsCalKeyword::Instance()->ms_sRECURRENCEID; - return ICalProperty::propertyToICALString(s, getRecurrenceIDProperty(), sResult); - case ms_cRelatedTo: - s = nsCalKeyword::Instance()->ms_sRELATEDTO; - return ICalProperty::propertyVectorToICALString(s, getRelatedTo(), sResult); - case ms_cRequestStatus: - s = nsCalKeyword::Instance()->ms_sREQUESTSTATUS; - return ICalProperty::propertyVectorToICALString(s, getRequestStatus(), sResult); - case ms_cSequence: - s = nsCalKeyword::Instance()->ms_sSEQUENCE; - return ICalProperty::propertyToICALString(s, getSequenceProperty(), sResult); - case ms_cStatus: - s = nsCalKeyword::Instance()->ms_sSTATUS; - return ICalProperty::propertyToICALString(s, getStatusProperty(), sResult); - case ms_cSummary: - s = nsCalKeyword::Instance()->ms_sSUMMARY; - return ICalProperty::propertyToICALString(s, getSummaryProperty(), sResult); - case ms_cUID: - s = nsCalKeyword::Instance()->ms_sUID; - return ICalProperty::propertyToICALString(s, getUIDProperty(), sResult); - case ms_cOrganizer: - s = nsCalKeyword::Instance()->ms_sORGANIZER; - return ICalProperty::propertyToICALString(s, getOrganizerProperty(), sResult); - case ms_cContact: - s = nsCalKeyword::Instance()->ms_sCONTACT; - return ICalProperty::propertyVectorToICALString(s, getContact(), sResult); - case ms_cXTokens: - return ICalProperty::vectorToICALString(getXTokens(), sResult); - default: - return ""; - } -} - -//--------------------------------------------------------------------- -// TODO: make crash proof -UnicodeString & -TimeBasedEvent::parseType(UnicodeString & sType, ICalReader * brFile, - UnicodeString & sMethod, - UnicodeString & parseStatus, - JulianPtrArray * vTimeZones, t_bool bIgnoreBeginError, - nsCalUtility::MimeEncoding encoding) -{ - t_bool bNewEvent = FALSE; - t_bool bNextAlarm = FALSE; - - UnicodeString sOK; - t_bool parseError = FALSE; - UnicodeString strLine, propName, propVal; - - JulianPtrArray * parameters = new JulianPtrArray(); - - parseStatus = nsCalKeyword::Instance()->ms_sOK; - PR_ASSERT(parameters != 0 && brFile != 0); - if (parameters == 0 || brFile == 0) - { - // Return an invalid event - return parseStatus; - } - //UnicodeString end = nsCalKeyword::Instance()->ms_sEND_WITH_COLON; end += sType; - //UnicodeString begin = nsCalKeyword::Instance()->ms_sBEGIN_WITH_COLON; begin += sType; - - ErrorCode status = ZERO_ERROR; - - // set method - setMethod(sMethod); - - while (TRUE) - { - PR_ASSERT(brFile != 0); - brFile->readFullLine(strLine, status); - ICalProperty::Trim(strLine); - - if (FAILURE(status) && strLine.size() == 0) - break; - - //////////////////////////////////////////////////////// - // I've made it so parameters are now - // copied. Only need to worry about deleting parameter - // contents here now. The ICalProperty, Attendee, Freebusy - // DO NOT take ownership of parameters pointer - ///////////////////////////////////////////////////////// -//#ifdef TIMING - //clock_t cstart, cfinish; - //cstart = clock(); -//#endif - ICalProperty::parsePropertyLine(strLine, propName, propVal, parameters); - -//#ifdef TIMING - //cfinish = clock(); - //double d = cfinish - cstart; - //if (FALSE) TRACE("parsePropertyLine took %f ms.\r\n", strLine.toCString(""), d); -//#endif - //if (FALSE) TRACE("TMB: propName (size = %d) = --%s--, propVal (size = %d) = --%s--, paramSize = %d\r\n", - // propName.size(), propName.toCString(""), - // propVal.size(), propVal.toCString(""), parameters->GetSize()); - - // TRACE_ICalParameterVector(parameters, FALSE); - // ICalProperty::propertyToICALString(outName, outVal, - // parameters, printOut); - - - if (strLine.size() == 0) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - continue; - } - // break on END:type (where type is matching VEVENT, VTODO, VJOURNAL) - if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - (propVal.compareIgnoreCase(sType) == 0)) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - break; - } - if ( - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - ((propVal.compareIgnoreCase(sType) == 0) && !bIgnoreBeginError )|| - ((propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) || - (ICalProperty::IsXToken(propVal))) - ) || - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - ( - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) || - (ICalProperty::IsXToken(propVal))) - )) - { - // END:VCALENDAR, VFREEBUSY, VJOURNAL, VEVENT, VTODO, VTIMEZONE, x-token - // BEGIN:VEVENT, VTODO, VJOURNAL, VTIMEZONE, VFREEBUSY, x-token, VCALENDAR - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - parseStatus = strLine; - - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iAbruptEndOfParsing, - sType, strLine, 300); - - bNewEvent = TRUE; - break; - } - else - { - if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVALARM) == 0)) - { - - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - - // only add alarm to alarm-vector if alarm is valid and this - // is a VEVENT or VTODO. - bNextAlarm = TRUE; - VAlarm * alarm = 0; - while (bNextAlarm) - { - alarm = new VAlarm(m_Log); - if (alarm != 0) - { - sOK = alarm->parse(brFile, sMethod, sOK, vTimeZones); - if (alarm->isValid() && (GetType() != ICAL_COMPONENT_VJOURNAL)) - addAlarm(alarm); - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidAlarm, 300); - delete alarm; alarm = 0; - } - } - if (sOK.compareIgnoreCase(nsCalKeyword::Instance()->ms_sOK) == 0) - bNextAlarm = FALSE; - else - { - // TODO: make it handle "BEGIN : VALARM"; - if (sOK.compareIgnoreCase("BEGIN:VALARM") == 0) - bNextAlarm = TRUE; - else - bNextAlarm = FALSE; - } - } - if (sOK.compareIgnoreCase(nsCalKeyword::Instance()->ms_sOK) != 0) - { - parseStatus = sOK; - break; - } - } - else - { -//#ifdef TIMING - //clock_t start, end; - //start = clock(); -//#endif - storeData(strLine, propName, propVal, parameters, vTimeZones); - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); -//#ifdef TIMING - //end = clock(); - //double d = end - start; - //if (FALSE) TRACE("storeData on %s took %f ms.\r\n", propName.toCString(""), d); -//#endif - } - } - } - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - delete parameters; parameters = 0; - - selfCheck(); - //checkRecurrence(); - return parseStatus; -} - -//--------------------------------------------------------------------- -void TimeBasedEvent::storeAttach(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters (binary, uri), todo: checkEncoding range - // todo: check FMTTYPE so it doesn't complain. - t_bool bParamValid = ICalProperty::CheckParamsWithValueRangeCheck(parameters, - nsCalAtomRange::Instance()->ms_asEncodingValueFMTTypeParamRange, - nsCalAtomRange::Instance()->ms_asEncodingValueFMTTypeParamRangeSize, - nsCalAtomRange::Instance()->ms_asBinaryURIValueRange, - nsCalAtomRange::Instance()->ms_asBinaryURIValueRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - addAttach(propVal, parameters); -} -void TimeBasedEvent::storeAttendees(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - Attendee * attendee = new Attendee(GetType(), m_Log); - PR_ASSERT(attendee != 0); - if (attendee != 0) - { - attendee->parse(propVal, parameters); - if (!attendee->isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidAttendee, 200); - - UnicodeString u; - u = nsCalLogErrorMessage::Instance()->ms_sRS202; - u += '.'; u += ' '; - u += strLine; - //setRequestStatus(nsCalLogErrorMessage::Instance()->ms_iRS202); - addRequestStatus(u); - delete attendee; attendee = 0; - } - else - { - addAttendee(attendee); - } - } -} -void TimeBasedEvent::storeCategories(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asLanguageParamRange, - nsCalAtomRange::Instance()->ms_asLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - addCategoriesPropertyVector(propVal, parameters); -} -void TimeBasedEvent::storeClass(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getClassProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sCLASS, 100); - } - setClass(propVal, parameters); -} -void TimeBasedEvent::storeComment(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRange, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRangeSize); - - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - addComment(propVal, parameters); -} -void TimeBasedEvent::storeContact(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRange, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - addContact(propVal, parameters); -} -void TimeBasedEvent::storeCreated(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters (MUST BE IN UTC) - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getCreatedProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sCREATED, 100); - } - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setCreated(d, parameters); -} -void TimeBasedEvent::storeDescription(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRange, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRangeSize); - - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - // check for duplicates - if (getDescriptionProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sDESCRIPTION, 100); - } - - setDescription(propVal, parameters); -} -void TimeBasedEvent::storeDTStart(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters (date, datetime), TZID - t_bool bParamValid = ICalProperty::CheckParamsWithValueRangeCheck(parameters, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRange, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRangeSize, - nsCalAtomRange::Instance()->ms_asDateDateTimeValueRange, - nsCalAtomRange::Instance()->ms_asDateDateTimeValueRangeSize); - - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getDTStartProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sDTSTART, 100); - } - - UnicodeString u, out; - u = nsCalKeyword::Instance()->ms_sVALUE; - out = ICalParameter::GetParameterFromVector(u, out, parameters); - - t_bool bIsDate = DateTime::IsParseableDate(propVal); - - if (bIsDate) - { - // if there is a VALUE=X parameter, make sure X is DATE - if (out.size() != 0 && (nsCalKeyword::Instance()->ms_ATOM_DATE != out.hashCode())) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iPropertyValueTypeMismatch, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - setAllDayEvent(TRUE); - } - else - { - // if there is a VALUE=X parameter, make sure X is DATETIME - if (out.size() != 0 && (nsCalKeyword::Instance()->ms_ATOM_DATETIME != out.hashCode())) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iPropertyValueTypeMismatch, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - setAllDayEvent(FALSE); - } - - DateTime d; - //UnicodeString u, out; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setDTStart(d, parameters); -} -void TimeBasedEvent::storeDTStamp(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters (MUST BE IN UTC) - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getDTStampProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sDTSTAMP, 100); - } - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setDTStamp(d, parameters); -} -void TimeBasedEvent::storeExDate(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters (date, datetime) - t_bool bParamValid = ICalProperty::CheckParamsWithValueRangeCheck(parameters, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRange, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRangeSize, - nsCalAtomRange::Instance()->ms_asDateDateTimeValueRange, - nsCalAtomRange::Instance()->ms_asDateDateTimeValueRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - // DONE:?TODO: finish - addExDate(propVal, parameters); -} -void TimeBasedEvent::storeExRule(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - // TODO: finish, pass timezones. - addExRuleString(strLine); -} -void TimeBasedEvent::storeLastModified(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters (MUST BE IN UTC) - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getLastModifiedProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sLASTMODIFIED, 100); - } - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setLastModified(d, parameters); -} -void TimeBasedEvent::storeOrganizer(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asSentByParamRange, - nsCalAtomRange::Instance()->ms_asSentByParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getOrganizerProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sORGANIZER, 100); - } - setOrganizer(propVal, parameters); -} -void TimeBasedEvent::storeRDate(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters (date, datetime, period) - t_bool bParamValid = ICalProperty::CheckParamsWithValueRangeCheck(parameters, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRange, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRangeSize, - nsCalAtomRange::Instance()->ms_asDateDateTimePeriodValueRange, - nsCalAtomRange::Instance()->ms_asDateDateTimePeriodValueRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - // TODO: finish - addRDate(propVal, parameters); -} -void TimeBasedEvent::storeRRule(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - // TODO: finish, pass timezones. - addRRuleString(strLine); -} -void TimeBasedEvent::storeRecurrenceID(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // TODO: CHECK PARAMETERS - if (getRecurrenceIDProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sRECURRENCEID, 100); - } - DateTime d(propVal); - - // NOTE: only set recurrenceID if datetime is of a valid datetime format - if (d.isValid()) - { - setRecurrenceID(d, parameters); - } -} -void TimeBasedEvent::storeRelatedTo(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters: todo: check reltype - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asReltypeParamRange, - nsCalAtomRange::Instance()->ms_asReltypeParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - addRelatedTo(propVal, parameters); -} -void TimeBasedEvent::storeRequestStatus(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asLanguageParamRange, - nsCalAtomRange::Instance()->ms_asLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - /* - if (getRequestStatusProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, nsCalKeyword::Instance()->ms_s, 100); - } - */ - //setRequestStatus(propVal, parameters); - addRequestStatus(propVal, parameters); -} -void TimeBasedEvent::storeSequence(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParseError = FALSE; - t_int32 i; - - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - char * pcc = propVal.toCString(""); - PR_ASSERT(pcc != 0); - i = nsCalUtility::atot_int32(pcc, bParseError, propVal.size()); - delete [] pcc; pcc = 0; - - if (getSequenceProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sSEQUENCE, 100); - } - if (!bParseError) - { - setSequence(i, parameters); - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidNumberFormat, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sSEQUENCE, - propVal, 200); - } -} -void TimeBasedEvent::storeStatus(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getStatusProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sSTATUS, 100); - } - setStatus(propVal, parameters); -} -void TimeBasedEvent::storeSummary(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asLanguageParamRange, - nsCalAtomRange::Instance()->ms_asLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getSummaryProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sSUMMARY, 100); - } - setSummary(propVal, parameters); -} -void TimeBasedEvent::storeUID(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getUIDProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sUID, 100); - } - setUID(propVal, parameters); -} -void TimeBasedEvent::storeURL(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, strLine, 100); - } - - if (getURLProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTIMEBASEDEVENT, - nsCalKeyword::Instance()->ms_sURL, 100); - } - - setURL(propVal, parameters); -} -//--------------------------------------------------------------------- -t_bool -TimeBasedEvent::storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters, - JulianPtrArray * vTimeZones) -{ - t_int32 hashCode = propName.hashCode(); - t_int32 i; - - for (i = 0; 0 != (JulianFunctionTable::Instance()->tbeStoreTable[i]).op; i++) - { - if ((JulianFunctionTable::Instance()->tbeStoreTable[i]).hashCode == hashCode) - { - ApplyStoreOp(((JulianFunctionTable::Instance())->tbeStoreTable[i]).op, - strLine, propVal, parameters, vTimeZones); - return TRUE; - } - } - if (ICalProperty::IsXToken(propName)) - { - addXTokens(strLine); - return TRUE; - } - return FALSE; -} -//--------------------------------------------------------------------- - -t_bool TimeBasedEvent::isValid() -{ - return TRUE; -} - -//--------------------------------------------------------------------- - -UnicodeString TimeBasedEvent::toICALString() -{ - return allMessage(); -} - -//--------------------------------------------------------------------- - -UnicodeString TimeBasedEvent::toICALString(UnicodeString sMethod, UnicodeString sName, - t_bool isRecurring) -{ - UnicodeString s; - - t_int32 hashCode = sMethod.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_PUBLISH == hashCode) - s = publishMessage(); - else if (nsCalKeyword::Instance()->ms_ATOM_REQUEST == hashCode) - s = requestMessage(); - else if (nsCalKeyword::Instance()->ms_ATOM_CANCEL == hashCode) - s = cancelMessage(); - else if (nsCalKeyword::Instance()->ms_ATOM_REPLY == hashCode) - s = replyMessage(sName); - else if (nsCalKeyword::Instance()->ms_ATOM_REFRESH == hashCode) - s = refreshMessage(sName); - else if (nsCalKeyword::Instance()->ms_ATOM_COUNTER == hashCode) - s = counterMessage(); - else if (nsCalKeyword::Instance()->ms_ATOM_DECLINECOUNTER == hashCode) - s = declineCounterMessage(); - else if (nsCalKeyword::Instance()->ms_ATOM_ADD == hashCode) - s = addMessage(); - /* - else if (nsCalKeyword::Instance()->ms_ATOM_DELEGATEREQUEST == hashCode) - s = delegateRequestMessage(sName, sDelegatedTo, isRecurring); - else if (nsCalKeyword::Instance()->ms_ATOM_DELEGATEREPLY == hashCode) - s = delegateReplyMessage(sName, sDelegatedTo, isRecurring); - */ - return s; -} - -//--------------------------------------------------------------------- -/* -UnicodeString -TimeBasedEvent::delegateReplyMessage(UnicodeString sAttendeeFilter, - UnicodeString sDelegateTo, t_bool bRecur) -{ - // NOTE: remove later, avoid warning - if (bRecur) {} - addDelegate(sAttendeeFilter, sDelegateTo); - return replyMessage(sAttendeeFilter); -} -*/ -//--------------------------------------------------------------------- -/* -UnicodeString -TimeBasedEvent::delegateRequestMessage(UnicodeString sAttendeeFilter, - UnicodeString sDelegateTo, t_bool bRecur) -{ - // NOTE: remove later, avoid warning - if (bRecur) {} - addDelegate(sAttendeeFilter, sDelegateTo); - return requestMessage(); -} -*/ -//--------------------------------------------------------------------- -/* -void -TimeBasedEvent::addDelegate(UnicodeString & sAttendeeFilter, - UnicodeString & sDelegateTo) -{ - Attendee * me; - me = getAttendee(sAttendeeFilter); - if (me != 0) - { - // set my attendee status to delegated, add delegateTo variable - me->setStatus(Attendee::STATUS_DELEGATED); - me->addDelegatedTo(sDelegateTo); - - // add new attendee, setting name, role = req_part, delfrom = me, - // rsvp = TRUE, expect = request, status = needs-action - Attendee * delegate = Attendee::getDefault(m_Log); - PR_ASSERT(delegate != 0); - if (delegate != 0) - { - delegate->setName(sDelegateTo); - delegate->setRole(Attendee::ROLE_REQ_PARTICIPANT); - delegate->addDelegatedFrom(sAttendeeFilter); - delegate->setRSVP(Attendee::RSVP_TRUE); - delegate->setExpect(Attendee::EXPECT_REQUEST); - delegate->setStatus(Attendee::STATUS_NEEDSACTION); - addAttendee(delegate); - } - } -} -*/ -//--------------------------------------------------------------------- - -void -TimeBasedEvent::setAttendeeStatus(UnicodeString & sAttendeeFilter, - Attendee::STATUS status, - JulianPtrArray * delegatedTo) -{ - Attendee * a; - a = getAttendee(sAttendeeFilter); - if (a == 0) - { - // add a new attendee to this event (a partycrasher) - a = Attendee::getDefault(GetType()); - PR_ASSERT(a != 0); - if (a != 0) - { - a->setName(sAttendeeFilter); - addAttendee(a); - } - } - PR_ASSERT(a != 0); - if (a != 0) - { - a->setStatus(status); - if (status == Attendee::STATUS_DELEGATED) - { - if (delegatedTo != 0) - { - t_int32 i; - UnicodeString u; - // for each new attendee, set name, role = req_part, delfrom = me, - // rsvp = TRUE, expect = request, status = needs-action. - for (i = 0; i < delegatedTo->GetSize(); i++) - { - u = *((UnicodeString *) delegatedTo->GetAt(i)); - a->addDelegatedTo(u); - - Attendee * delegate = Attendee::getDefault(GetType(), m_Log); - PR_ASSERT(delegate != 0); - if (delegate != 0) - { - delegate->setName(u); - delegate->setRole(Attendee::ROLE_REQ_PARTICIPANT); - delegate->addDelegatedFrom(sAttendeeFilter); - delegate->setRSVP(Attendee::RSVP_TRUE); - delegate->setExpect(Attendee::EXPECT_REQUEST); - delegate->setStatus(Attendee::STATUS_NEEDSACTION); - addAttendee(delegate); - } - } - } - } - } -} -//--------------------------------------------------------------------- - -void -TimeBasedEvent::setAttendeeStatusInt(UnicodeString & sAttendeeFilter, - t_int32 status, - JulianPtrArray * delegatedTo) -{ - Attendee::STATUS i; - i = (Attendee::STATUS) status; - setAttendeeStatus(sAttendeeFilter, i, delegatedTo); -} - -//--------------------------------------------------------------------- - -void -TimeBasedEvent::updateComponentHelper(TimeBasedEvent * updatedComponent) -{ - DateTime d; - // update each property - // clear and set attach, attendees, categories, comment, contact, exdate, - // exrule, rdate, rrule, related-to, req-stat, x-token - // no need: created, last-modified, UID, rec-id. - // vectors if different - ICalComponent::internalSetPropertyVctr(&m_AttachVctr, updatedComponent->getAttach()); - ICalComponent::internalSetPropertyVctr(&m_AttendeesVctr, updatedComponent->getAttendees()); - ICalComponent::internalSetPropertyVctr(&m_CategoriesVctr, updatedComponent->getCategories()); - ICalComponent::internalSetPropertyVctr(&m_CommentVctr, updatedComponent->getComment()); - ICalComponent::internalSetPropertyVctr(&m_ContactVctr, updatedComponent->getContact()); - ICalComponent::internalSetPropertyVctr(&m_ExDateVctr, updatedComponent->getExDates()); - ICalComponent::internalSetPropertyVctr(&m_ExRuleVctr, updatedComponent->getExRules()); - ICalComponent::internalSetPropertyVctr(&m_RDateVctr, updatedComponent->getRDates()); - ICalComponent::internalSetPropertyVctr(&m_RRuleVctr, updatedComponent->getRRules()); - ICalComponent::internalSetPropertyVctr(&m_RelatedToVctr, updatedComponent->getRelatedTo()); - //ICalComponent::internalSetAllRequestStatusVctr(updatedComponent->getRequestStatus()); - // set class, created, dtstart, dtstamp, organizer, sequence, url - ICalComponent::internalSetProperty(&m_Class, updatedComponent->m_Class); - ICalComponent::internalSetProperty(&m_Description, updatedComponent->m_Description); - ICalComponent::internalSetProperty(&m_DTStamp, updatedComponent->m_DTStamp); - ICalComponent::internalSetProperty(&m_DTStart, updatedComponent->m_DTStart); - ICalComponent::internalSetProperty(&m_Organizer, updatedComponent->m_Organizer); - ICalComponent::internalSetProperty(&m_Sequence, updatedComponent->m_Sequence); - ICalComponent::internalSetProperty(&m_Status, updatedComponent->m_Status); - ICalComponent::internalSetProperty(&m_Summary, updatedComponent->m_Summary); - ICalComponent::internalSetProperty(&m_URL, updatedComponent->m_URL); - ICalComponent::internalSetXTokensVctr(&m_XTokensVctr, updatedComponent->m_XTokensVctr); - - ICalComponent::internalSetProperty(&m_LastModified, updatedComponent->m_LastModified); - //setLastModified(d); -} - -//--------------------------------------------------------------------- - -t_bool -TimeBasedEvent::updateComponent(ICalComponent * updatedComponent) -{ - // TODO: doesn't do smart overriding for now - if (updatedComponent != 0) - { - ICAL_COMPONENT ucType = updatedComponent->GetType(); - - // only call updateComponentHelper if it's a TimeBasedEvent and - // it is an exact matching ID (uid, recid) and updatedComponent - // is more recent than this component - if (ucType == ICAL_COMPONENT_VEVENT || ucType == ICAL_COMPONENT_VTODO || - ucType == ICAL_COMPONENT_VJOURNAL) - { - // should be a safe cast with check above. - TimeBasedEvent * uctbe = (TimeBasedEvent *) updatedComponent; - - //if (ucType == GetType() && isExactMatchingID(uctbe) && !isMoreRecent(uctbe)) - if (ucType == GetType() && isExactMatchingID(uctbe)) - { - updateComponentHelper(uctbe); - return TRUE; - } - } - } - return FALSE; -} - -//--------------------------------------------------------------------- - -t_bool -TimeBasedEvent::isExactMatchingID(TimeBasedEvent * component) -{ - // component is not NULL - PR_ASSERT(component != 0); - // both have a valid UID - PR_ASSERT(getUID().size() > 0 && component->getUID().size() > 0); - - if (component != 0 && getUID().size() > 0 && component->getUID().size() > 0) - { - if (getUID() != component->getUID()) - { - return FALSE; - } - else - { - if (getRecurrenceIDProperty() == 0 && component->getRecurrenceIDProperty() == 0) - { - return TRUE; - } - else if (getRecurrenceIDProperty() != 0 && component->getRecurrenceIDProperty() != 0) - { - if (getRecurrenceID() == component->getRecurrenceID()) - return TRUE; - } - else - { - // one or the other is missing RecurrenceID. - return FALSE; - } - } - } - // failed assertion - // PR_ASSERT(FALSE); - return FALSE; -} - -//--------------------------------------------------------------------- -#if 0 -t_bool -TimeBasedEvent::isMoreRecent(TimeBasedEvent * component) -{ - // component is not NULL - PR_ASSERT(component != 0); - - if (component != 0) - { - t_bool bHasSeq; - t_bool bHasDTStamp; - - t_int32 iSeq, jSeq; - DateTime idts, jdts; - - iSeq = getSequence(); - idts = getDTStamp(); - - jSeq = component->getSequence(); - jdts = component->getDTStamp(); - - // both components must have sequence and DTSTAMP - bHasSeq = (iSeq >= 0 && jSeq >= 0); - bHasDTStamp = (idts.isValid() && jdts.isValid()); - - PR_ASSERT(bHasSeq); - PR_ASSERT(bHasDTStamp); - - // if iSeq > jSeq return TRUE - // else if iSeq < jSeq return FALSE - // else if iSeq == jSeq - // { - // else if jdts is after idts return FALSE - // else if jdts is before idts return TRUE - // else (dts is equal to idts) return TRUE - // } - - if (component != 0 && bHasSeq && bHasDTStamp) - { - if (iSeq > jSeq) - { - return TRUE; - } - else if (iSeq < jSeq) - { - return FALSE; - } - else - { - return !(jdts.afterDateTime(idts)); - } - } - } - // assert failed - return FALSE; -} -#endif -//--------------------------------------------------------------------- - -int -TimeBasedEvent::CompareTimeBasedEventsByUID(const void * a, - const void * b) -{ - PR_ASSERT(a != 0 && b != 0); - TimeBasedEvent * ta = *(TimeBasedEvent **) a; - TimeBasedEvent * tb = *(TimeBasedEvent **) b; - - return (int) ta->getUID().compare(tb->getUID()); -} - -//--------------------------------------------------------------------- - -int -TimeBasedEvent::CompareTimeBasedEventsByDTStart(const void * a, - const void * b) -{ - PR_ASSERT(a != 0 && b != 0); - TimeBasedEvent * ta = *(TimeBasedEvent **) a; - TimeBasedEvent * tb = *(TimeBasedEvent **) b; - - DateTime da, db; - da = ta->getDTStart(); - db = tb->getDTStart(); - - return (int) (da.compareTo(db)); -} - -//--------------------------------------------------------------------- - -// TODO: make delegate request work -/* -UnicodeString TimeBasedEvent::delegateRequestMessage(UnicodeString TimeBasedEvent::sAttendeeFilter) { - //return delegateRequestMessage(sAttendeeFilter, FALSE); - return ICalComponent::delegateRequestMessage(sAttendeeFilter, FALSE); -} - -//--------------------------------------------------------------------- - -UnicodeString TimeBasedEvent::delegateRecurRequestMessage(UnicodeString TimeBasedEvent::sAttendeeFilter) { - //return delegateRequestMessage(sAttendeeFilter, TRUE); - return ICalComponent::delegateRequestMessage(sAttendeeFilter, TRUE); -} -*/ -/** -* Adds delegate to delegatee attendee list -* Prints properties of an DELEGATE-REQUEST message -* @param sAttendeeFilter name of delegate -* @return string with delegateRequest message required properties -*/ -/* -UnicodeString TimeBasedEvent::delegateRequestMessage(UnicodeString sAttendeeFilter, - t_bool bRecur) -{ - // only required fields - // attendee-R if exists - // comment-R, dtstart?, dtend?, exdate?, exrule?, request-status-R, response-seq-R~0, seq-R~0, summary? - // uid-R, rec-R if exists - - Attendee * me = getAttendee(sAttendeeFilter); - JulianPtrArray * delegateTo; - - ///---PROBABLY SHOULD BE ASSERTIONS----------------- - if (me == 0) { - //LogStream.Instance().println(2, Utility.ErrorMsg("DelegateRequestError")); - //DebugMsg.Instance().println(0,"No such attendee"); - return ""; - } - if (me.getStatus().compareIgnoreCase(nsCalKeyword::Instance()->ms_sDELEGATED) != 0) { - //LogStream.Instance().println(2, Utility.ErrorMsg("DelegateRequestError")); - //DebugMsg.Instance().println(0,"I did not delegate yet"); - return ""; - } - delegateTo = me->getDelegatedTo(); - if (delegateTo == 0 || delegateTo->GetSize() == 0) { - - //LogStream.Instance().println(2, Utility.ErrorMsg("DelegateRequestError")); - //DebugMsg.Instance().println(0,"No delegated-to"); - return ""; - } - ///------------------------------------------------- - UnicodeString delegateName; - Attendee * delegate = Attendee.getDefault(); - - // set new attendee's name to last person in delegateTo vector, assuming that last person you delegated to in reply - // will be the next person you call delegate request, thus the request message should immediately be called after the delegation - // takes place - delegateName = *((UnicodeString)delegateTo.lastElement();) - - // according to spec, rsvp, expect should be set to exactly what delegate had - String sRSVP = PropertyKeywords.nsCalKeyword::Instance()->ms_sTRUE; - String sExpect = PropertyKeywords.nsCalKeyword::Instance()->ms_sREQUEST; - String sRole = PropertyKeywords.nsCalKeyword::Instance()->ms_sDELEGATE; - - delegate.setName(delegateName); - delegate.setRole(PropertyKeywords.nsCalKeyword::Instance()->ms_sDELEGATE); - delegate.setRSVP(PropertyKeywords.nsCalKeyword::Instance()->ms_sTRUE); - delegate.setDelegatedFrom(sAttendeeFilter); - //delegate.load("ATTENDEE;ROLE=DELEGATE;RSVP=" + sRSVP +";EXPECT="+ sExpect +";DELEGATED-FROM=" + sAttendeeFilter + ":" + delegateName); - - System.out.println("delegate.toICALString == "+ delegate.toICALString()); - Attendee * a2 = getAttendee(delegate.getName()); - if (a2 == 0) - addAttendee(delegate); - else { - DebugMsg.Instance().println(0,"Delegating to a person who is already on attendee list"); - } - //String attendeeparams = "%S%D%N"; - // UPDATE ATTENDEE PROPERTIES HERE (attendee status is accepted, declined, delegated) - // what about response-sequence ? (will we keep it) - if (bRecur) - return format(nsCalKeyword::Instance()->ms_sRecurDelegateRequestMessage, TRUE); // this is a delegate request - else - return format(nsCalKeyword::Instance()->ms_sDelegateRequestMessage, TRUE); // this is a delegate request -} -*/ - -//--------------------------------------------------------------------- - -t_bool TimeBasedEvent::MatchUID_seqNO(UnicodeString sUID, t_int32 iSeqNo) -{ - t_int32 seq = getSequence(); - UnicodeString uid = getUID(); - - if (seq == iSeqNo && uid.compareIgnoreCase(sUID) == 0) - return TRUE; - else - return FALSE; -} - -//--------------------------------------------------------------------- - -Attendee * TimeBasedEvent::getAttendee(UnicodeString sAttendee){ - return Attendee::getAttendee(getAttendees(), sAttendee); -} - -//--------------------------------------------------------------------- - -/** -* return vector of all attendees except organizer -* @param vAttendees vector of attendees -* @return vector of attendees except organizer -*/ -/* -JulianPtrArray * getAttendeesExceptOrganizer() { - JulianPtrArray * attendees = new JulianPtrArray(); - return Attendee.getAttendeesExceptOrganizer(getAttendees(), attendees); -} -*/ - -//--------------------------------------------------------------------- - -void TimeBasedEvent::stamp() -{ - DateTime d; - setDTStamp(d); -} - -//--------------------------------------------------------------------- - -t_bool -TimeBasedEvent::isExpandableEvent() const -{ - DateTime d; - d = getRecurrenceID(); - if (d.isValid()) - { - return FALSE; - } - else if ((getRRules() == 0 || getRRules()->GetSize() == 0) && - (getRDates() == 0 || getRDates()->GetSize() == 0)) - { - return FALSE; - } - else - { - return TRUE; - } -} - -//--------------------------------------------------------------------- - -void -TimeBasedEvent::createRecurrenceEvents(JulianPtrArray * vOut, - JulianPtrArray * vTimeZones) -{ - DateTime start; - start = getDTStart(); - - JulianPtrArray * vRRules = getRRules(); - JulianPtrArray * vExRules = getExRules(); - JulianPtrArray * vRDates = getRDates(); - JulianPtrArray * vExDates = getExDates(); - t_int32 iBound = getBound(); - - if (vRRules == 0 && vExRules == 0 && vRDates == 0 && vExDates == 0) - return; - - JulianPtrArray * dates = new JulianPtrArray(); PR_ASSERT(dates != 0); - - if (dates != 0) - { - // generate dates of instances - generateDates(dates, start, vRRules, vExRules, vRDates, vExDates, - iBound, vTimeZones, m_Log); - - // create events and set start,(end|due) to dates - populateDates(vOut, dates, start, vTimeZones); - - // CLEANUP - Recurrence::deleteDateTimeVector(dates); - delete dates; dates = 0; - } -} - -//--------------------------------------------------------------------- - -void -TimeBasedEvent::generateDates(JulianPtrArray * vOut, DateTime start, - JulianPtrArray * vRRules, - JulianPtrArray * vExRules, - JulianPtrArray * vRDatesProp, - JulianPtrArray * vExDatesProp, - t_int32 iBound, - JulianPtrArray * vTimeZones, JLog * log) -{ - // TODO: SET UNTIL in RRULE, EXRULE to ISO8601 UTC - - JulianPtrArray * vRDates = new JulianPtrArray(); - PR_ASSERT(vRDates != 0); - JulianPtrArray * vExDates = new JulianPtrArray(); - PR_ASSERT(vExDates != 0); - - if (vRDates != 0 && vExDates != 0) - { - // split RDATES, EXDATES properties into vector of Date, DateTime, or Period strings. - splitDates(vRDates, vRDatesProp, TRUE, vTimeZones); - splitDates(vExDates, vExDatesProp, FALSE, vTimeZones); - - Recurrence::stringEnforce(start, vRRules, vExRules, vRDates, - vExDates, iBound, vOut, log); - - ICalComponent::deleteUnicodeStringVector(vRDates); - ICalComponent::deleteUnicodeStringVector(vExDates); - delete vRDates; vRDates = 0; - delete vExDates; vExDates = 0; - } -} - -//--------------------------------------------------------------------- - -// TODO: Make crash proof -void -TimeBasedEvent::splitDates(JulianPtrArray * out, - JulianPtrArray * vDateProp, t_bool isRDate, - JulianPtrArray * vTimeZones) -{ - - if (vDateProp != 0) - { - t_int32 i; - StringProperty * ip; - UnicodeString u, startP, endP; - UnicodeStringTokenizer * st; - Period p; - DateTime d; - t_bool hasTimeZone = FALSE; - ErrorCode status = ZERO_ERROR; - VTimeZone * vtz; - TimeZone * tz; - - for (i = 0; i < vDateProp->GetSize(); i++) - { - ip = (StringProperty *) vDateProp->GetAt(i); - - tz = 0; - - // FIRST, get matching timezone if it exists - // getTZID from date, check for it from VTimezone vector. - // then get the the NLSTimeZone from that VTimeZone - u = ip->getParameterValue( - nsCalKeyword::Instance()->ms_sTZID, u, status); - - if (!FAILURE(status)) - { - vtz = VTimeZone::getTimeZone(u, vTimeZones); - if (vtz != 0) - { - tz = vtz->getNLSTimeZone(); - } - } - - // Get string, parse tokens seperated by comma - u = *((UnicodeString *)ip->getValue()); - - st = new UnicodeStringTokenizer(u, - nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL); - PR_ASSERT(st != 0); - if (st != 0) - { - while (st->hasMoreTokens()) - { - u = st->nextToken(u, status); - - if (isRDate) - { - if (Period::IsParseable(u)) - { - //adjust for timezones - //according to spec, a VALUE=PERIOD can't have a TZID with it - /* - if (tz != 0) - { - startP = u.extractBetween(0, u.indexOf('/'), - startP); - endP = u.extractBetween(u.indexOf('/') + 1, - u.size(), endP); - d.setTimeString(startP, tz); - startP = d.toISO8601(); - - if (DateTime::IsParseableDateTime(endP)) - { - d.setTimeString(endP, tz); - endP = d.toISO8601(); - } - u = startP; - u += '/'; - u += endP; - } - */ - out->Add(new UnicodeString(u)); - } - else if (DateTime::IsParseableDate(u)) - { - out->Add(new UnicodeString(u)); - } - else if (DateTime::IsParseableDateTime(u)) - { - //adjust for timezones - if (tz != 0) - { - d.setTimeString(u, tz); - u = d.toISO8601(); - } - out->Add(new UnicodeString(u)); - } - else - { - // TODO: Log bad rdate in rdate property vector - } - } - else - { - if (DateTime::IsParseableDateTime(u)) - { - //adjust for timezones - if (tz != 0) - { - d.setTimeString(u, tz); - u = d.toISO8601(); - } - out->Add(new UnicodeString(u)); - } - else - { - // TODO: Log bad exdate in exdate property vector - } - } - } - delete st; st = 0; - } - } - } -} - -//--------------------------------------------------------------------- - -void -TimeBasedEvent::getPeriodRDates(JulianPtrArray * out) -{ - if (getRDates() != 0) - { - t_int32 i; - ICalProperty * ip; - UnicodeString u; - UnicodeStringTokenizer * st; - ErrorCode status = ZERO_ERROR; - - for (i = 0; i < getRDates()->GetSize(); i++) - { - ip = (ICalProperty *) getRDates()->GetAt(i); - u = *((UnicodeString *)ip->getValue()); - st = new UnicodeStringTokenizer(u, - nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL); - PR_ASSERT(st != 0); - if (st != 0) - { - while (st->hasMoreTokens()) - { - u = st->nextToken(u, status); - if (Period::IsParseable(u)) - { - out->Add(new UnicodeString(u)); - } - } - delete st; st = 0; - } - } - } -} - -//--------------------------------------------------------------------- -// TODO: remove asserts, make crash proof -void -TimeBasedEvent::populateDates(JulianPtrArray * vOut, - JulianPtrArray * dates, - DateTime origStart, - JulianPtrArray * vTimeZones) -{ - if (dates == 0) - return; - - // NOTE: Remove later, to get rid of warnings - if (vTimeZones) {} - - TimeBasedEvent * tbeClone; - t_int32 i; - Date difference = 0; - DateTime d; - - // vector of strings of period form (i.e. 19980320T112233/PT1H) - JulianPtrArray * vPeriods = new JulianPtrArray(); - PR_ASSERT(vPeriods != 0); - - getPeriodRDates(vPeriods); - - difference = this->difference(); - - // TODO: handle alarms difference - - for (i = 0; i < dates->GetSize(); i++) - { - d = *((DateTime *) dates->GetAt(i)); - - //if (FALSE) TRACE("d = %s\r\n", d.toISO8601().toCString("")); - - tbeClone = (TimeBasedEvent *) this->clone(m_Log); - tbeClone->setDTStart(d); - tbeClone->setOrigStart(origStart); // set origDTStart to recurrence dtstart - tbeClone->setMyOrigStart(d); - tbeClone->populateDatesHelper(d, difference, vPeriods); - tbeClone->setRecurrenceID(d); - - // TODO: set alarms of clone - //if (tbeClone->getAlarms() != 0) - //{ - //} - - vOut->Add(tbeClone); - - } - - ICalComponent::deleteUnicodeStringVector(vPeriods); - delete vPeriods; vPeriods = 0; -} - -//--------------------------------------------------------------------- - -/** -* checks recurrence data (rrules, rdates, exrules, exdates) -* called after loading (postload check) -*/ -/* -void checkRecurrence() -{ - setRRules(Recurrence.rulesCheck(getRRules())); - setExRules(Recurrence.rulesCheck(getExRules())); - - setRDates(dateChecker(getRDates(), TRUE)); - setExDates(dateChecker(getExDates(), FALSE)); -} -*/ - -//--------------------------------------------------------------------- - -/** -* check the range of the property -* @param sPropName property names -* @param sPropValue property value -* @param sRange valid range of property values -*/ -/* -void checkRange(UnicodeString sPropName, UnicodeString sPropValue, UnicodeString sRange[]) { - t_boolean b = FALSE; - - if (sPropName.equalsIgnoreCase(PropertyKeywords.nsCalKeyword::Instance()->ms_sCLASS)) { - if (ParserUtil.isXToken(sPropValue)) - return; - else { - b = ParserUtil.checkRange(sPropValue, sRange); - if (!b) { - DebugMsg.Instance().println(0, "Bad value " + sPropValue + " for property " + sPropName); - LogStream.Instance().println(2, Utility.ErrorMsg("InvalidPropertyValue") + - " TimeBasedEvent:" + sPropValue); - setRequestStatus(Utility.ErrorMsg("RS201") + ";" + PropertyKeywords.nsCalKeyword::Instance()->ms_sCLASS); - setDefaultProps(sPropName); - } - return; - } - } - else { - b = ParserUtil.checkRange(sPropValue, sRange); - if (!b) { - DebugMsg.Instance().println(0, "Bad value: " + sPropValue + " for property " + sPropName); - LogStream.Instance().println(2, Utility.ErrorMsg("InvalidPropertyValue") + - " TimeBasedEvent:" + sPropValue); - setRequestStatus(Utility.ErrorMsg("RS201") + ";" + sPropName); - setDefaultProps(sPropName); - } - return; - } - } - - */ - -//--------------------------------------------------------------------- - -/** - * sets default of property - * @param sPropName property name - */ - /* -void TimeBasedEvent::setDefaultProps(UnicodeString sPropName) { - - UnicodeString u; - t_int32 hashCode = sPropName.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_DESCRIPTION == hashCode) { - //LogStream.Instance().println(0, Utility.ErrorMsg("DefaultTBEDescription")); - // Setting default Description to empty string - //if (getDescription( == hashCode) { - // initializeDescription(); - // Vector vDescLines = new Vector(); - // vDescLines.addElement(""); - // loadDescription(vDescLines); - //} - u = getSummary(); - setDescription(u); - } - else if (nsCalKeyword::Instance()->ms_ATOM_CLASS == hashCode) { - //LogStream.Instance().println(0, Utility.ErrorMsg("DefaultTBEClass")); - u = ""; - setClass(u); - } - else if (nsCalKeyword::Instance()->ms_ATOM_STATUS == hashCode) { - //LogStream.Instance().println(0, Utility.ErrorMsg("DefaultTBEStatus")); - u = ""; - setStatus(u); - } - //else if (sPropName.equalsIgnoreCase(PropertyKeywords.nsCalKeyword::Instance()->ms_sTRANSP)) { - // LogStream.Instance().println(0, Utility.ErrorMsg("DefaultTBETransp")); - // setTransp(PropertyKeywords.nsCalKeyword::Instance()->ms_sOPAQUE); - //} - else if (nsCalKeyword::Instance()->ms_ATOM_REQUESTSTATUS == hashCode) { - //LogStream.Instance().println(0, Utility.ErrorMsg("DefaultTBERequestStatus")); - u = ""; - setRequestStatus(u); - } -} -*/ -//--------------------------------------------------------------------- - -void TimeBasedEvent::selfCheck() -{ - if (getSummary().size() == 0) - { - // set summary to first 60 characters of description - if (getDescription().size() > 0) - { - UnicodeString u = getDescription(); - if (u.size() > 60) - u = u.removeBetween(60, u.size()); - setSummary(u); - } - } - - // if sequence is null, set to 0. - if (getSequence() == -1) - setSequence(0); - - // NOTE: setting default CLASS to PUBLIC if CLASS is invalid or not in range - if (getClass().size() == 0 || - (getClass().compareIgnoreCase(nsCalKeyword::Instance()->ms_sPRIVATE) != 0) && - (getClass().compareIgnoreCase(nsCalKeyword::Instance()->ms_sPUBLIC) != 0) && - (getClass().compareIgnoreCase(nsCalKeyword::Instance()->ms_sCONFIDENTIAL) != 0)) - - { - setClass(nsCalKeyword::Instance()->ms_sPUBLIC); - } -} - -//--------------------------------------------------------------------- -// GETTERS AND SETTERS here -//--------------------------------------------------------------------- -// method -void TimeBasedEvent::setMethod(UnicodeString & s) -{ - m_sMethod = s; -} -//--------------------------------------------------------------------- -// attendees -void TimeBasedEvent::addAttendee(Attendee * a) -{ - if (m_AttendeesVctr == 0) - m_AttendeesVctr = new JulianPtrArray(); - PR_ASSERT(m_AttendeesVctr != 0); - if (m_AttendeesVctr != 0) - { - m_AttendeesVctr->Add(a); - } -} -//--------------------------------------------------------------------- -// alarms -void TimeBasedEvent::addAlarm(VAlarm * a) -{ - if (m_AlarmsVctr == 0) - m_AlarmsVctr = new JulianPtrArray(); - PR_ASSERT(m_AlarmsVctr != 0); - if (m_AlarmsVctr != 0) - { - m_AlarmsVctr->Add(a); - } -} -//--------------------------------------------------------------------- -//LAST-MODIFIED -void TimeBasedEvent::setLastModified(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_LastModified == 0) - m_LastModified = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_LastModified->setValue((void *) &s); - m_LastModified->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_LastModified), s, parameters); -#endif -} - -DateTime TimeBasedEvent::getLastModified() const -{ -#if 1 - DateTime d(-1); - if (m_LastModified == 0) - return d; // return 0; - else - { - d = *((DateTime *) m_LastModified->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_LastModified), d); - return d; -#endif -} -//--------------------------------------------------------------------- -//Created -void TimeBasedEvent::setCreated(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_Created == 0) - m_Created = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_Created->setValue((void *) &s); - m_Created->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_Created), s, parameters); -#endif -} -DateTime TimeBasedEvent::getCreated() const -{ -#if 1 - DateTime d(-1); - if (m_Created == 0) - return d;//return 0; - else - { - d = *((DateTime *) m_Created->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_Created), d); - return d; -#endif -} -//--------------------------------------------------------------------- -//Organizer -void TimeBasedEvent::setOrganizer(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Organizer == 0) - { - //m_Organizer = ICalPropertyFactory::Make(ICalProperty::TEXT, - // (void *) &s, parameters); - - m_Organizer = (ICalProperty *) new nsCalOrganizer(m_Log); - PR_ASSERT(m_Organizer != 0); - if (m_Organizer != 0) - { - m_Organizer->setValue((void *) &s); - m_Organizer->setParameters(parameters); - } - } - else - { - m_Organizer->setValue((void *) &s); - m_Organizer->setParameters(parameters); - } -} -UnicodeString TimeBasedEvent::getOrganizer() const -{ - UnicodeString u; - if (m_Organizer == 0) - return ""; - else { - u = *((UnicodeString *) m_Organizer->getValue()); - return u; - } -} -//--------------------------------------------------------------------- - -//RecurrenceID -void TimeBasedEvent::setRecurrenceID(DateTime s, JulianPtrArray * parameters) -{ - if (m_RecurrenceID == 0) - { - m_RecurrenceID = (ICalProperty *) new nsCalRecurrenceID(s, m_Log); - PR_ASSERT(m_RecurrenceID != 0); - if (m_RecurrenceID != 0) - { - m_RecurrenceID->setParameters(parameters); - } - } - else - { - m_RecurrenceID->setValue((void *) &s); - m_RecurrenceID->setParameters(parameters); - } -} -DateTime TimeBasedEvent::getRecurrenceID() const -{ - - DateTime d(-1); - if (m_RecurrenceID == 0) - return d;//return 0; - else - { - d = *((DateTime *) m_RecurrenceID->getValue()); - return d; - } -} -//--------------------------------------------------------------------- -//DTStamp -void TimeBasedEvent::setDTStamp(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_DTStamp == 0) - m_DTStamp = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_DTStamp->setValue((void *) &s); - m_DTStamp->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_DTStamp), s, parameters); -#endif -} -DateTime TimeBasedEvent::getDTStamp() const -{ -#if 1 - DateTime d(-1); - if (m_DTStamp == 0) - return d;//return 0; - else - { - d = *((DateTime *) m_DTStamp->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_DTStamp), d); - return d; -#endif -} -//--------------------------------------------------------------------- -///DTStart -void TimeBasedEvent::setDTStart(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_DTStart == 0) - m_DTStart = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_DTStart->setValue((void *) &s); - m_DTStart->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_DTStart), s, parameters); -#endif -} - -DateTime TimeBasedEvent::getDTStart() const -{ -#if 1 - DateTime d(-1); - if (m_DTStart == 0) - return d; //return 0; - else - { - d = *((DateTime *) m_DTStart->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_DTStart), d); - return d; -#endif -} -//--------------------------------------------------------------------- -//Description -void TimeBasedEvent::setDescription(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); -#if 1 - if (m_Description == 0) - m_Description = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Description->setValue((void *) &s); - m_Description->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Description), s, parameters); -#endif -} -UnicodeString TimeBasedEvent::getDescription() const -{ -#if 1 - if (m_Description == 0) - return ""; - else - { - UnicodeString u; - u = *((UnicodeString *) m_Description->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Description), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//URL -void TimeBasedEvent::setURL(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); -#if 1 - if (m_URL == 0) - m_URL = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_URL->setValue((void *) &s); - m_URL->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_URL), s, parameters); -#endif -} -UnicodeString TimeBasedEvent::getURL() const -{ -#if 1 - if (m_URL == 0) - return ""; - else - { - UnicodeString u; - u = *((UnicodeString *) m_URL->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_URL), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//Summary -void TimeBasedEvent::setSummary(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); -#if 1 - if (m_Summary == 0) - m_Summary = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Summary->setValue((void *) &s); - m_Summary->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Summary), s, parameters); -#endif -} -UnicodeString TimeBasedEvent::getSummary() const -{ -#if 1 - if (m_Summary == 0) - return ""; - else - { - UnicodeString u; - u = *((UnicodeString *) m_Summary->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Summary), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//Class -void TimeBasedEvent::setClass(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Class == 0) - m_Class = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Class->setValue((void *) &s); - m_Class->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Class), s, parameters); -#endif -} -UnicodeString TimeBasedEvent::getClass() const -{ -#if 1 - if (m_Class == 0) - return ""; - else - { - UnicodeString u; - u = *((UnicodeString *) m_Class->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Class), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//Status -void TimeBasedEvent::setStatus(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Status == 0) - m_Status = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Status->setValue((void *) &s); - m_Status->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Status), s, parameters); -#endif -} - -UnicodeString TimeBasedEvent::getStatus() const -{ -#if 1 - UnicodeString u; - if (m_Status == 0) - return ""; - else - { - u = *((UnicodeString *) m_Status->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Status), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//RequestStatus -#if 0 -// TODO: become a vector -void TimeBasedEvent::setRequestStatus(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_RequestStatus == 0) - m_RequestStatus = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_RequestStatus->setValue((void *) &s); - m_RequestStatus->setParameters(parameters); - } -} -UnicodeString TimeBasedEvent::getRequestStatus() const -{ - UnicodeString u; - if (m_RequestStatus == 0) - return ""; - else - { - u = *((UnicodeString *) m_RequestStatus->getValue()); - return u; - } -} -#endif -void TimeBasedEvent::addRequestStatus(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - addRequestStatusProperty(prop); -} -void TimeBasedEvent::addRequestStatusProperty(ICalProperty * prop) -{ - if (m_RequestStatusVctr == 0) - m_RequestStatusVctr = new JulianPtrArray(); - PR_ASSERT(m_RequestStatusVctr != 0); - if (m_RequestStatusVctr != 0) - { - m_RequestStatusVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -//UID -void TimeBasedEvent::setUID(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_UID == 0) - m_UID = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_UID->setValue((void *) &s); - m_UID->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_UID), s, parameters); -#endif -} -UnicodeString TimeBasedEvent::getUID() const -{ -#if 1 - UnicodeString u; - if (m_UID == 0) - return ""; - else { - u = *((UnicodeString *) m_UID->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_UID), us); - return us; -#endif -} - - -//--------------------------------------------------------------------- -//Sequence -void TimeBasedEvent::setSequence(t_int32 i, JulianPtrArray * parameters) -{ -#if 1 - if (m_Sequence == 0) - m_Sequence = ICalPropertyFactory::Make(ICalProperty::INTEGER, - (void *) &i, parameters); - else - { - m_Sequence->setValue((void *) &i); - m_Sequence->setParameters(parameters); - } -#else - ICalComponent::setIntegerValue(((ICalProperty **) &m_Sequence), i, parameters); -#endif -} -t_int32 TimeBasedEvent::getSequence() const -{ -#if 1 - t_int32 i; - if (m_Sequence == 0) - return -1; - else - { - i = *((t_int32 *) m_Sequence->getValue()); - return i; - } -#else - t_int32 i = -1; - ICalComponent::getIntegerValue(((ICalProperty **) &m_Sequence), i); - return i; -#endif - -} -//--------------------------------------------------------------------- -//comment -void TimeBasedEvent::addComment(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - addCommentProperty(prop); -} -void TimeBasedEvent::addCommentProperty(ICalProperty * prop) -{ - if (m_CommentVctr == 0) - m_CommentVctr = new JulianPtrArray(); - PR_ASSERT(m_CommentVctr != 0); - if (m_CommentVctr != 0) - { - m_CommentVctr->Add(prop); - } -} -void TimeBasedEvent::setNewComments(UnicodeString s) -{ - // first delete old comments - if (m_CommentVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_CommentVctr); - delete m_CommentVctr; m_CommentVctr = 0; - } - addComment(s); -} -//--------------------------------------------------------------------- -// attach -void TimeBasedEvent::addAttach(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - addAttachProperty(prop); -} -void TimeBasedEvent::addAttachProperty(ICalProperty * prop) -{ - if (m_AttachVctr == 0) - m_AttachVctr = new JulianPtrArray(); - PR_ASSERT(m_AttachVctr != 0); - if (m_AttachVctr != 0) - { - m_AttachVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -// RelatedTo -void TimeBasedEvent::addRelatedTo(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - addRelatedToProperty(prop); -} -void TimeBasedEvent::addRelatedToProperty(ICalProperty * prop) -{ - if (m_RelatedToVctr == 0) - m_RelatedToVctr = new JulianPtrArray(); - PR_ASSERT(m_RelatedToVctr != 0); - if (m_RelatedToVctr != 0) - { - m_RelatedToVctr->Add(prop); - } -} -//void TimeBasedEvent::setRelatedTo(UnicodeString s, JulianPtrArray * parameters) -//{ -// //UnicodeString * s_ptr = new UnicodeString(s); -// //PR_ASSERT(s_ptr != 0); -// -// if (m_RelatedTo == 0) -// m_RelatedTo = ICalPropertyFactory::Make(ICalProperty::TEXT, -// (void *) &s, parameters); -// else -// { -// m_RelatedTo->setValue((void *) &s); -// m_RelatedTo->setParameters(parameters); -// } -//} -//UnicodeString TimeBasedEvent::getRelatedTo() const -//{ -// UnicodeString u; -// if (m_RelatedTo == 0) -// return ""; -// else { -// u = *((UnicodeString *) m_RelatedTo->getValue()); -// return u; -// } -//} -//--------------------------------------------------------------------- -// Contact -void TimeBasedEvent::addContact(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *)&s, parameters); - addContactProperty(prop); -} -void TimeBasedEvent::addContactProperty(ICalProperty * prop) -{ - if (m_ContactVctr == 0) - m_ContactVctr = new JulianPtrArray(); - PR_ASSERT(m_ContactVctr != 0); - if (m_ContactVctr != 0) - { - m_ContactVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -// RDate -void TimeBasedEvent::addRDate(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *)&s, parameters); - addRDateProperty(prop); -} -void TimeBasedEvent::addRDateProperty(ICalProperty * prop) -{ - if (m_RDateVctr == 0) - m_RDateVctr = new JulianPtrArray(); - PR_ASSERT(m_RDateVctr != 0); - if (m_RDateVctr != 0) - { - m_RDateVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -// ExDate -void TimeBasedEvent::addExDate(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *)&s, parameters); - addExDateProperty(prop); -} -void TimeBasedEvent::addExDateProperty(ICalProperty * prop) -{ - if (m_ExDateVctr == 0) - m_ExDateVctr = new JulianPtrArray(); - PR_ASSERT(m_ExDateVctr != 0); - if (m_ExDateVctr != 0) - { - m_ExDateVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -// Categories -void TimeBasedEvent::addCategories(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *)&s, parameters); - addCategoriesProperty(prop); -} -void TimeBasedEvent::addCategoriesProperty(ICalProperty * prop) -{ - if (m_CategoriesVctr == 0) - m_CategoriesVctr = new JulianPtrArray(); - PR_ASSERT(m_CategoriesVctr != 0); - if (m_CategoriesVctr != 0) - { - m_CategoriesVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -// XTOKENS -void TimeBasedEvent::addXTokens(UnicodeString s) -{ - if (m_XTokensVctr == 0) - m_XTokensVctr = new JulianPtrArray(); - PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - m_XTokensVctr->Add(new UnicodeString(s)); - } -} -/* -// RDate -void TimeBasedEvent::addRDateString(UnicodeString s) -{ - if (m_RDateVctr == 0) - m_RDateVctr = new JulianPtrArray(); - PR_ASSERT(m_RDateVctr != 0); - m_RDateVctr->Add(new UnicodeString(s)); -} -*/ -// RRule -void TimeBasedEvent::addRRuleString(UnicodeString s) -{ - if (m_RRuleVctr == 0) - m_RRuleVctr = new JulianPtrArray(); - PR_ASSERT(m_RRuleVctr != 0); - if (m_RRuleVctr != 0) - { - m_RRuleVctr->Add(new UnicodeString(s)); - } -} -/* -// ExDate -void TimeBasedEvent::addExDateString(UnicodeString s) -{ - if (m_ExDateVctr == 0) - m_ExDateVctr = new JulianPtrArray(); - PR_ASSERT(m_ExDateVctr != 0); - m_ExDateVctr->Add(new UnicodeString(s)); -} -*/ -// ExRule -void TimeBasedEvent::addExRuleString(UnicodeString s) -{ - if (m_ExRuleVctr == 0) - m_ExRuleVctr = new JulianPtrArray(); - PR_ASSERT(m_ExRuleVctr != 0); - if (m_ExRuleVctr != 0) - { - m_ExRuleVctr->Add(new UnicodeString(s)); - } -} -//--------------------------------------------------------------------- - -/* -void -TimeBasedEvent::setDateTimeValue(ICalProperty ** dateTimePropertyPtr, - DateTime inVal, - JulianPtrArray * inParameters) -{ - PR_ASSERT(dateTimePropertyPtr != 0); - if (dateTimePropertyPtr != 0) - { - if (((ICalProperty *) (*dateTimePropertyPtr)) == 0) - { - ((ICalProperty *) (*dateTimePropertyPtr)) = - ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &inVal, inParameters); - } - else - { - ((ICalProperty *) (*dateTimePropertyPtr))->setValue((void *) &inVal); - ((ICalProperty *) (*dateTimePropertyPtr))->setParameters(inParameters); - } - } - //setDateTimeProperty(dateTimeProperty, s, 0); -} - -void -TimeBasedEvent::setDateTimeProperty(ICalProperty * dateTimeProperty, - DateTime * s, JulianPtrArray * parameters) -{ - if (dateTimeProperty == 0) - dateTimeProperty = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) s, parameters); - else - dateTimeProperty->setValue((void *) s); -} - -void TimeBasedEvent::getDateTimeValue(ICalProperty ** dateTimePropertyPtr, - DateTime & dtOut) -{ - PR_ASSERT(dateTimePropertyPtr != 0); - if (dateTimePropertyPtr != 0) - { - if ((ICalProperty *)(*dateTimePropertyPtr) == 0) - dtOut.setTime(-1); - else - dtOut = *((DateTime *) ((ICalProperty *)(*dateTimePropertyPtr))->getValue()); - } - else - { - dtOut.setTime(-1); - } -} -/* -//--------------------------------------------------------------------- - -void -TimeBasedEvent::setStringValue(ICalProperty * stringProperty, - UnicodeString * s) -{ - setStringProperty(stringProperty, s, 0); -} - -void -TimeBasedEvent::setStringProperty(ICalProperty * stringProperty, - UnicodeString * s, JulianPtrArray * parameters) -{ - if (stringProperty == 0) - stringProperty = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) s, parameters); - else - stringProperty->setValue((void *) s); -} - -UnicodeString TimeBasedEvent::getStringValue(ICalProperty * stringProperty) const -{ - if (stringProperty == 0) - return ""; - else - return *((UnicodeString *) stringProperty->getValue()); -} -//--------------------------------------------------------------------- - -void -TimeBasedEvent::setIntegerValue(ICalProperty * integerProperty, - t_int32 i) -{ setIntegerProperty(integerProperty, i, 0); } - -void -TimeBasedEvent::setIntegerProperty(ICalProperty * integerProperty, - t_int32 i, JulianPtrArray * parameters) -{ - if (integerProperty == 0) - integerProperty = ICalPropertyFactory::Make(ICalProperty::INTEGER, - (void *) &i, parameters); - else - integerProperty->setValue((void *) i); -} - -t_int32 TimeBasedEvent::getIntegerValue(ICalProperty * integerProperty) const -{ - if (integerProperty == 0) - return -1; - else - return *((t_int32 *) integerProperty->getValue()); -} -//--------------------------------------------------------------------- -void -TimeBasedEvent::setDurationValue(ICalProperty * durationProperty, - Duration * s) -{ - setDurationProperty(durationProperty, s, 0); -} - -void -TimeBasedEvent::setDurationProperty(ICalProperty * durationProperty, - Duration * s, JulianPtrArray * parameters) -{ - if (durationProperty == 0) - durationProperty = ICalPropertyFactory::Make(ICalProperty::DURATION, - (void *) s, parameters); - else - durationProperty->setValue((void *) s); -} - -Duration * TimeBasedEvent::getDurationValue(ICalProperty * durationProperty) const -{ - if (durationProperty == 0) - return 0; - else - return (Duration *) durationProperty->getValue(); -} -*/ -//--------------------------------------------------------------------- - -void -TimeBasedEvent::addCategoriesPropertyVector(UnicodeString & propVal, - JulianPtrArray * parameters) -{ - //ICalProperty * ip; - - // TODO: trying to break each comma seperated element into own property, but - // having trouble, for now, don't break up - //ip = ICalPropertyFactory::Make(ICalProperty::TEXT, new UnicodeString(propVal), - // parameters); - addCategories(propVal, parameters); - - /* - ErrorCode status = ZERO_ERROR; - UnicodeStringTokenizer * st; - UnicodeString us; - UnicodeString sDelim = ","; - - st = new UnicodeStringTokenizer(propVal, sDelim); - - while (st->hasMoreTokens()) - { - us = st->nextToken(us, status); - us.trim(); - //TRACE("us = %s, status = %d", us.toCString(""), status); - // TODO: if us is in categories range then add, else, log and error, - // should I make copies of parameters or not??? - - ip = ICalPropertyFactory::Make(ICalProperty::TEXT, new UnicodeString(us), - parameters); - PR_ASSERT(ip != 0); - addCategoriesProperty(ip); - ip = 0; - } - delete st; st = 0;; - */ -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/tzpart.cpp b/mozilla/calendar/modules/core/ical/src/tzpart.cpp deleted file mode 100644 index f17b2d32d3a..00000000000 --- a/mozilla/calendar/modules/core/ical/src/tzpart.cpp +++ /dev/null @@ -1,1025 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// tzpart.cpp -// John Sun -// 10:04 AM February 24 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "tzpart.h" -#include "prprtyfy.h" -#include "rcrrence.h" -#include "jlog.h" -#include "keyword.h" - -#include "functbl.h" -//--------------------------------------------------------------------- - -// private never use -#if 0 -TZPart::TZPart() -{ - PR_ASSERT(FALSE); -} -#endif -//--------------------------------------------------------------------- - -TZPart::TZPart(JLog * initLog) -: m_CommentVctr(0), m_DTStart(0), m_TZNameVctr(0), m_TZOffsetTo(0), - m_TZOffsetFrom(0), m_RDate(0), m_RRule(0), - m_StartMonth(-1), m_StartDay(-1), m_StartWeek(0), m_StartTime(0), - m_XTokensVctr(0), - m_iStartYear(0), m_iStartMonth(0), m_iStartDay(0), m_iStartHour(0), m_iStartMinute(0), m_iStartSecond(0), - m_iRDateYear(0), m_iRDateMonth(0), m_iRDateDay(0), m_iRDateHour(0), m_iRDateMinute(0), m_iRDateSecond(0), - m_Log(initLog) -{ - - m_Until.setTime(-1); -} - -//--------------------------------------------------------------------- - -TZPart::TZPart(TZPart & that) -: m_CommentVctr(0), m_DTStart(0), m_TZNameVctr(0), m_TZOffsetTo(0), - m_TZOffsetFrom(0), m_RDate(0), m_RRule(0), - m_iStartYear(0), m_iStartMonth(0), m_iStartDay(0), m_iStartHour(0), m_iStartMinute(0), m_iStartSecond(0), - m_iRDateYear(0), m_iRDateMonth(0), m_iRDateDay(0), m_iRDateHour(0), m_iRDateMinute(0), m_iRDateSecond(0), - m_XTokensVctr(0) -{ - m_StartMonth = that.m_StartMonth; - m_StartDay = that.m_StartDay; - m_StartWeek = that.m_StartWeek; - m_StartTime = that.m_StartTime; - m_Until = that.m_Until; - m_Name = that.m_Name; - - m_iStartYear = that.m_iStartYear; - m_iStartMonth = that.m_iStartMonth; - m_iStartDay = that.m_iStartDay; - m_iStartHour = that.m_iStartHour; - m_iStartMinute = that.m_iStartMinute; - m_iStartSecond = that.m_iStartSecond; - - m_iRDateYear = that.m_iRDateYear; - m_iRDateMonth = that.m_iRDateMonth; - m_iRDateDay = that.m_iRDateDay; - m_iRDateHour = that.m_iRDateHour; - m_iRDateMinute = that.m_iRDateMinute; - m_iRDateSecond = that.m_iRDateSecond; - - if (that.m_CommentVctr != 0) - { - m_CommentVctr = new JulianPtrArray(); PR_ASSERT(m_CommentVctr != 0); - if (m_CommentVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_CommentVctr, m_CommentVctr, m_Log); - } - } - - if (that.m_DTStart != 0) { m_DTStart = that.m_DTStart->clone(m_Log); } - - if (that.m_TZNameVctr != 0) - { - m_TZNameVctr = new JulianPtrArray(); PR_ASSERT(m_TZNameVctr != 0); - if (m_TZNameVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_TZNameVctr, m_TZNameVctr, m_Log); - } - } - if (that.m_TZOffsetTo != 0) - { - m_TZOffsetTo = that.m_TZOffsetTo->clone(m_Log); - } - if (that.m_TZOffsetFrom != 0) - { - m_TZOffsetFrom = that.m_TZOffsetFrom->clone(m_Log); - } - if (that.m_RDate != 0) - { - m_RDate = that.m_RDate->clone(m_Log); - } - if (that.m_RRule != 0) - { - m_RRule = that.m_RRule->clone(m_Log); - } - if (that.m_XTokensVctr != 0) - { - m_XTokensVctr = new JulianPtrArray(); PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - ICalProperty::CloneUnicodeStringVector(that.m_XTokensVctr, m_XTokensVctr); - } - } -} -//--------------------------------------------------------------------- -ICalComponent * -TZPart::clone(JLog * initLog) -{ - m_Log = initLog; - //PR_ASSERT(m_Log != 0); - return new TZPart(*this); -} -//--------------------------------------------------------------------- - -TZPart::~TZPart() -{ - if (m_CommentVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_CommentVctr); - delete m_CommentVctr; m_CommentVctr = 0; - } - if (m_TZNameVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_TZNameVctr); - delete m_TZNameVctr; m_TZNameVctr = 0; - } - if (m_DTStart != 0) - { - delete m_DTStart; m_DTStart = 0; - } - if (m_RDate != 0) - { - delete m_RDate; m_RDate = 0; - } - if (m_RRule != 0) - { - delete m_RRule; m_RRule = 0; - } - if (m_TZOffsetTo != 0) - { - delete m_TZOffsetTo; m_TZOffsetTo = 0; - } - if (m_TZOffsetFrom != 0) - { - delete m_TZOffsetFrom; m_TZOffsetFrom = 0; - } - if (m_XTokensVctr != 0) - { - ICalComponent::deleteUnicodeStringVector(m_XTokensVctr); - delete m_XTokensVctr; m_XTokensVctr = 0; - } -} - -//--------------------------------------------------------------------- -UnicodeString & -TZPart::parse(ICalReader * brFile, UnicodeString & sType, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones, - t_bool bIgnoreBeginError, - nsCalUtility::MimeEncoding encoding) -{ - UnicodeString strLine, propName, propVal; - JulianPtrArray * parameters = new JulianPtrArray(); - parseStatus = nsCalKeyword::Instance()->ms_sOK; - - PR_ASSERT(parameters != 0 && brFile != 0); - if (parameters == 0 || brFile == 0) - { - // ran out of memory, return invalid tzpart - return parseStatus; - } - ErrorCode status = ZERO_ERROR; - - setName(sType); - - // NOTE: Remove later to remove a stupid compile warning - if (vTimeZones && bIgnoreBeginError){} - - while (TRUE) - { - PR_ASSERT(brFile != 0); - brFile->readFullLine(strLine, status); - ICalProperty::Trim(strLine); - - if (FAILURE(status) && strLine.size() == 0) - break; - - ICalProperty::parsePropertyLine(strLine, propName, propVal, parameters); - - if (strLine.size() == 0) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - continue; - } - // END:STANDARD OR END:DAYLIGHT (sType = daylight or standard) - else if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - (propVal.compareIgnoreCase(sType) == 0)) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - break; - } - else if ( - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - ( - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) || - (ICalProperty::IsXToken(propVal)) - )) - || - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - ( - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sDAYLIGHT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sSTANDARD) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) || - (ICalProperty::IsXToken(propVal)) - ))) - { - // abrupt end - // BEGIN:DAYLIGHT or BEGIN:STANDARD - // BEGIN:VEVENT, VTODO, VJOURNAL, VTIMEZONE, VFREEBUSY, xtoken - // END:VTIMEZONE, END:VCALENDAR - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iAbruptEndOfParsing, - nsCalKeyword::Instance()->ms_sTZPART, strLine, 300); - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - parseStatus = strLine; - break; - } - else - { - storeData(strLine, propName, propVal, parameters); - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - } - } - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - delete parameters; parameters = 0; - - selfCheck(); - return parseStatus; -} - -//--------------------------------------------------------------------- -void TZPart::storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters) -{ - t_int32 hashCode = propName.hashCode(); - t_int32 i; - for (i = 0; 0 != (JulianFunctionTable::Instance()->tzStoreTable[i]).op; i++) - { - if ((JulianFunctionTable::Instance()->tzStoreTable[i]).hashCode == hashCode) - { - ApplyStoreOp(((JulianFunctionTable::Instance())->tzStoreTable[i]).op, - strLine, propVal, parameters, 0); - return; - } - } - if (ICalProperty::IsXToken(propName)) - { - addXTokens(strLine); - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyName, - nsCalKeyword::Instance()->ms_sTZPART, propName, 200); - } -} -//--------------------------------------------------------------------- -void TZPart::storeComment(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRange, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRangeSize); - - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTZPART, strLine, 100); - } - - addComment(propVal, parameters); -} -void TZPart::storeTZName(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asLanguageParamRange, - nsCalAtomRange::Instance()->ms_asLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTZPART, strLine, 100); - } - - addTZName(propVal, parameters); -} -void TZPart::storeDTStart(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // assert in local time - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTZPART, strLine, 100); - } - - if (getDTStartProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTZPART, - nsCalKeyword::Instance()->ms_sDTSTART, 100); - } - DateTime d(propVal); - if (DateTime::IsParseable(propVal, m_iStartYear, m_iStartMonth, m_iStartDay, - m_iStartHour, m_iStartMinute, m_iStartSecond)) - { - m_StartTime = (t_int32) ((m_iStartHour * 3600 + m_iStartMinute * 60) * 1000); // set start time in millis - } - setDTStart(d, parameters); -} -void TZPart::storeRDate(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // assert in local time - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTZPART, strLine, 100); - } - - if (getRDateProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTZPART, - nsCalKeyword::Instance()->ms_sRDATE, 100); - } - // DONE:?TODO: Finish - DateTime d(propVal); - DateTime::IsParseable(propVal, m_iRDateYear, m_iRDateMonth, m_iRDateDay, - m_iRDateHour, m_iRDateMinute, m_iRDateSecond); - setRDate(d, parameters); -} -void TZPart::storeRRule(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTZPART, strLine, 100); - } - - if (getRRuleProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTZPART, - nsCalKeyword::Instance()->ms_sRRULE, 100); - } - setRRule(propVal, parameters); -} -void TZPart::storeTZOffsetTo(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTZPART, strLine, 100); - } - - if (getTZOffsetToProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTZPART, - nsCalKeyword::Instance()->ms_sTZOFFSETTO, 100); - } - setTZOffsetTo(propVal, parameters); -} -void TZPart::storeTZOffsetFrom(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sTZPART, strLine, 100); - } - - if (getTZOffsetFromProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sTZPART, - nsCalKeyword::Instance()->ms_sTZOFFSETFROM, 100); - } - setTZOffsetFrom(propVal, parameters); -} -//--------------------------------------------------------------------- -void TZPart::selfCheck() -{ - //if (FALSE) TRACE("starttime = %d, startmonth = %d, startday = %d, startweek = %d\r\n", m_StartTime, m_StartMonth, m_StartDay, m_StartWeek); - // TODO: finish - //parseRule(); -} -//--------------------------------------------------------------------- -t_bool TZPart::isValid() -{ - UnicodeString u; - - // TODO: log that if not parseable TZOFFSETTO:, TZOFFSETFROM: - // required to have valid dtstart, tzoffsetTo, tzoffsetFrom - if (!getDTStart().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingStartingTime, - nsCalKeyword::Instance()->ms_sTZPART, u, 300); - return FALSE; - } - u = getTZOffsetTo(); - if (!DateTime::IsParseableUTCOffset(u)) - return FALSE; - - u = getTZOffsetFrom(); - if (!DateTime::IsParseableUTCOffset(u)) - return FALSE; - - return TRUE; -} - -//--------------------------------------------------------------------- - -UnicodeString TZPart::toICALString() -{ - return ICalComponent::format(m_Name, nsCalFormatString::Instance()->ms_sTZPartAllMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString TZPart::toICALString(UnicodeString method, - UnicodeString name, - t_bool isRecurring) -{ - // NOTE: remove later avoid warnings - if (isRecurring) {} - return toICALString(); -} - -//--------------------------------------------------------------------- -UnicodeString TZPart::formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString s, sResult; - // NOTE: remove here is get rid of compiler warnings - if (sFilterAttendee.size() > 0 || delegateRequest) - { - } - - switch (c) - { - case ms_cComment: - s = nsCalKeyword::Instance()->ms_sCOMMENT; - return ICalProperty::propertyVectorToICALString(s, getComment(), sResult); - case ms_cTZName: - s = nsCalKeyword::Instance()->ms_sTZNAME; - return ICalProperty::propertyVectorToICALString(s, getTZName(), sResult); - case ms_cDTStart: -#if 0 - s = nsCalKeyword::Instance()->ms_sDTSTART; - return ICalProperty::propertyToICALString(s, getDTStartProperty(), sResult); -#else - if (getDTStartProperty() != 0) - { - sResult += nsCalKeyword::Instance()->ms_sDTSTART; - sResult += nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - DateTime::ToISO8601String(m_iStartYear, m_iStartMonth, m_iStartDay, - m_iStartHour, m_iStartMinute, m_iStartSecond, s); - sResult += s; - sResult += nsCalKeyword::Instance()->ms_sLINEBREAK; - } - return sResult; -#endif - case ms_cRDate: -#if 0 - s = nsCalKeyword::Instance()->ms_sRDATE; - return ICalProperty::propertyToICALString(s, getRDateProperty(), sResult); -#else - if (getRDateProperty() != 0) - { - sResult += nsCalKeyword::Instance()->ms_sRDATE; - sResult += nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - DateTime::ToISO8601String(m_iRDateYear, m_iRDateMonth, m_iRDateDay, - m_iRDateHour, m_iRDateMinute, m_iRDateSecond, s); - sResult += s; - sResult += nsCalKeyword::Instance()->ms_sLINEBREAK; - } - return sResult; -#endif - case ms_cRRule: - s = nsCalKeyword::Instance()->ms_sRRULE; - return ICalProperty::propertyToICALString(s, getRRuleProperty(), sResult); - case ms_cTZOffsetTo: - s = nsCalKeyword::Instance()->ms_sTZOFFSETTO; - return ICalProperty::propertyToICALString(s, getTZOffsetToProperty(), sResult); - case ms_cTZOffsetFrom: - s = nsCalKeyword::Instance()->ms_sTZOFFSETFROM; - return ICalProperty::propertyToICALString(s, getTZOffsetFromProperty(), sResult); - case ms_cXTokens: - return ICalProperty::vectorToICALString(getXTokens(), sResult); - default: - return ""; - } -} - -//--------------------------------------------------------------------- -UnicodeString TZPart::toStringChar(t_int32 c, UnicodeString & dateFmt) -{ - UnicodeString s; - switch (c) - { - case ms_cComment: - return ICalProperty::propertyVectorToString(getComment(), s); - case ms_cTZName: - return ICalProperty::propertyVectorToString(getTZName(), s); - case ms_cDTStart: - return ICalProperty::propertyToString(getDTStartProperty(), dateFmt, s); - case ms_cRDate: - return ICalProperty::propertyToString(getRDateProperty(), dateFmt, s); - case ms_cRRule: - return ICalProperty::propertyToString(getRRuleProperty(), dateFmt, s); - case ms_cTZOffsetTo: - return ICalProperty::propertyToString(getTZOffsetToProperty(), dateFmt, s); - case ms_cTZOffsetFrom: - return ICalProperty::propertyToString(getTZOffsetFromProperty(), dateFmt, s); - default: - return ""; - } -} -//--------------------------------------------------------------------- - -UnicodeString TZPart::toString() -{ - return ICalComponent::toStringFmt( - nsCalFormatString::Instance()->ms_TZPartStrDefaultFmt); -} - -//--------------------------------------------------------------------- -void TZPart::setName(UnicodeString s) -{ - m_Name = s; -} -//--------------------------------------------------------------------- -#if 0 -t_bool TZPart::parseRule() -{ - if (getRDate().isValid()) - { - parseRDate(); - return TRUE; - } - else - { - return parseRRule(); - } -} -#endif -//--------------------------------------------------------------------- -void TZPart::parseRDate() -{ - PR_ASSERT(getRDate().isValid()); - if (getRDate().isValid()) - { - DateTime d; - d = getRDate(); - - m_StartMonth = d.get(Calendar::MONTH); - m_StartWeek = d.get(Calendar::DAY_OF_WEEK_IN_MONTH); - m_StartDay = d.get(Calendar::DAY_OF_WEEK); - } -} -//--------------------------------------------------------------------- -t_bool TZPart::parseRRule() -{ - t_int32 i; - UnicodeString pN, pV, s, strLine; - ICalParameter * ip; - t_bool bParseError = FALSE; - ErrorCode status = ZERO_ERROR; - - // TODO: insert assertion that Recurrence::isValidRRule(getRRule()); - strLine = getRRule(); - //if (FALSE) TRACE("line (size = %d) = ---%s---\r\n", strLine.size(), strLine.toCString("")); - - // manipulating string so I can use the parsePropertyLine method - strLine += ':'; //nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - strLine.insert(0, nsCalKeyword::Instance()->ms_sRRULE_WITH_SEMICOLON); - //if (FALSE) TRACE("line (size = %d) = ---%s---\r\n", strLine.size(), strLine.toCString("")); - - JulianPtrArray * parameters = new JulianPtrArray(); - PR_ASSERT(parameters != 0); - if (parameters == 0) - { - return FALSE; - } - - ICalProperty::parsePropertyLine(strLine, pN, pV, parameters); - //if (FALSE) TRACE("pN = --%s--, pV = --%s--, paramSize = %d\r\n", pN.toCString(""), pV.toCString(""), parameters->GetSize()); - - for (i = 0; i < parameters->GetSize(); i++) - { - ip = (ICalParameter *) parameters->GetAt(i); - - pN = ip->getParameterName(pN); - pV = ip->getParameterValue(pV); - //if (FALSE) TRACE("pN = --%s--, pV = --%s--, paramSize = %d\r\n", pN.toCString(""), pV.toCString(""), parameters->GetSize()); - - if (pN.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBYMONTH) == 0) - { - // since month is 0-based, must subtract 1 - char * pVcc = pV.toCString(""); - PR_ASSERT(pVcc != 0); - m_StartMonth = nsCalUtility::atot_int32(pVcc, bParseError, pV.size()) - 1; - delete [] pVcc; pVcc = 0; - } - else if (pN.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBYDAY) == 0) - { - if (pV.size() == 3) - { - // positive week - char * pVcc = pV.toCString(""); - PR_ASSERT(pVcc != 0); - m_StartWeek = nsCalUtility::atot_int32(pVcc, bParseError, 1); - delete [] pVcc; pVcc = 0; - m_StartDay = Recurrence::stringToDay(pV.extract(1, 2, s), bParseError); - } - else - { - PR_ASSERT(pV.size() == 4); // note: assumption is pV.size() == 4 - - char * pVcc = pV.toCString(""); - PR_ASSERT(pVcc != 0); - m_StartWeek = nsCalUtility::atot_int32(pVcc + 1, bParseError, 1); // (always len = 1) - delete [] pVcc; pVcc = 0; - m_StartDay = Recurrence::stringToDay(pV.extract(2, 2, s), bParseError); // SU, MO, TU, etc. (always len = 2) - - if (pV[(TextOffset) 0] == '-') - m_StartWeek = 0 - m_StartWeek; - else if (pV[(TextOffset) 0] == '+') { } - else { bParseError = TRUE; } - - // ugly way to handle sign handling - //s = pV.extract(0, 1, s); - //if (s == "-") m_StartWeek = - m_StartWeek; - //else if (s == "+") {} - //else { bParseError = TRUE; } - } - } - else if (pN.compareIgnoreCase(nsCalKeyword::Instance()->ms_sUNTIL) == 0) - { - m_Until.setTimeString(pV); - } - } - ICalProperty::deleteICalParameterVector(parameters); - delete parameters; parameters = 0; - // if assertion failed return FALSE. - if(!(m_StartMonth != -1 && m_StartDay != -1 && m_StartWeek != 0)) - { - return FALSE; - } - if (bParseError || FAILURE(status)) - { - // BAD RRULE was parsed - m_StartMonth = -1; - m_StartDay = -1; - m_StartWeek = 0; - return FALSE; - } - return TRUE; -} -//--------------------------------------------------------------------- -float TZPart::UTCOffsetToFloat(UnicodeString & utcOffset) -{ - t_int32 hour = 0, minute = 0; - if (DateTime::IsParseableUTCOffset(utcOffset, hour, minute)) - { - return (float) (hour + (minute / 60)); - } - PR_ASSERT(FALSE); // all calls should return from above return statement - return 0; -} - -//--------------------------------------------------------------------- - -void -TZPart::updateComponentHelper(TZPart * updatedComponent) -{ - // no need: TZName - ICalComponent::internalSetProperty(&m_DTStart, updatedComponent->m_DTStart); - ICalComponent::internalSetProperty(&m_RDate, updatedComponent->m_RDate); - ICalComponent::internalSetProperty(&m_RRule, updatedComponent->m_RRule); - ICalComponent::internalSetProperty(&m_TZOffsetTo, updatedComponent->m_TZOffsetTo); - ICalComponent::internalSetProperty(&m_TZOffsetFrom, updatedComponent->m_TZOffsetFrom); - ICalComponent::internalSetXTokensVctr(&m_XTokensVctr, updatedComponent->m_XTokensVctr); -} - -//--------------------------------------------------------------------- - -t_bool -TZPart::updateComponent(ICalComponent * updatedComponent) -{ - if (updatedComponent != 0) - { - ICAL_COMPONENT ucType = updatedComponent->GetType(); - - // only call updateComponentHelper if it's a TZPart and - // it is an exact matching Name (STANDARD or DAYLIGHT) - // basically always overwrite - if (ucType == ICAL_COMPONENT_TZPART) - { - // should be a safe cast with check above. - TZPart * uctzp = (TZPart *) updatedComponent; - - // only if TZID's match and are not empty - if (uctzp->getName().size() > 0 && getName().size() > 0) - { - if (uctzp->getName() == getName()) - { - updateComponentHelper(uctzp); - selfCheck(); - return TRUE; - } - } - } - } - return FALSE; -} -//--------------------------------------------------------------------- - -//Comment -void TZPart::addComment(UnicodeString s, JulianPtrArray * parameters) -{ - //ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - // new UnicodeString(s), 0); - - ICalProperty * prop = - ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - - addCommentProperty(prop); -} -void TZPart::addCommentProperty(ICalProperty * prop) -{ - if (m_CommentVctr == 0) - m_CommentVctr = new JulianPtrArray(); - PR_ASSERT(m_CommentVctr != 0); - if (m_CommentVctr != 0) - { - m_CommentVctr->Add(prop); - } -} - -//--------------------------------------------------------------------- -//TZName -void TZPart::addTZName(UnicodeString s, JulianPtrArray * parameters) -{ - //ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - // new UnicodeString(s), 0); - - ICalProperty * prop = - ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - - addTZNameProperty(prop); -} -void TZPart::addTZNameProperty(ICalProperty * prop) -{ - if (m_TZNameVctr == 0) - m_TZNameVctr = new JulianPtrArray(); - PR_ASSERT(m_TZNameVctr != 0); - if (m_TZNameVctr != 0) - { - m_TZNameVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -// DTStart -void TZPart::setDTStart(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_DTStart == 0) - m_DTStart = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_DTStart->setValue((void *) &s); - m_DTStart->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_DTStart), s, parameters); -#endif -} - -DateTime TZPart::getDTStart() const -{ -#if 1 - DateTime d(-1); - if (m_DTStart == 0) - return d; //return 0; - else - { - d = *((DateTime *) m_DTStart->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_DTStart), d); - return d; -#endif -} -//--------------------------------------------------------------------- -// RDate -// TODO: become a vector -void TZPart::setRDate(DateTime s, JulianPtrArray * parameters) -{ - if (m_RDate == 0) - m_RDate = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_RDate->setValue((void *) &s); - m_RDate->setParameters(parameters); - } - parseRDate(); -} - -DateTime TZPart::getRDate() const -{ - DateTime d(-1); - if (m_RDate == 0) - return d; //return 0; - else - { - d = *((DateTime *) m_RDate->getValue()); - return d; - } -} -//--------------------------------------------------------------------- -//RRule -// TODO: become a vector -void TZPart::setRRule(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_RRule == 0) - m_RRule = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_RRule->setValue((void *) &s); - m_RRule->setParameters(parameters); - } - parseRRule(); -} -UnicodeString TZPart::getRRule() const -{ - UnicodeString u; - if (m_RRule == 0) - return ""; - else - { - u = *((UnicodeString *) m_RRule->getValue()); - return u; - } -} -//--------------------------------------------------------------------- -//TZOffsetTo -void TZPart::setTZOffsetTo(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_TZOffsetTo == 0) - m_TZOffsetTo = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_TZOffsetTo->setValue((void *) &s); - m_TZOffsetTo->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_TZOffsetTo), s, parameters); -#endif -} -UnicodeString TZPart::getTZOffsetTo() const -{ -#if 1 - UnicodeString u; - if (m_TZOffsetTo == 0) - return ""; - else - { - u = *((UnicodeString *) m_TZOffsetTo->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_TZOffsetTo), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//TZOffsetFrom -void TZPart::setTZOffsetFrom(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_TZOffsetFrom == 0) - m_TZOffsetFrom = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_TZOffsetFrom->setValue((void *) &s); - m_TZOffsetFrom->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_TZOffsetFrom), s, parameters); -#endif -} -UnicodeString TZPart::getTZOffsetFrom() const -{ -#if 1 - UnicodeString u; - if (m_TZOffsetFrom == 0) - return ""; - else - { - u = *((UnicodeString *) m_TZOffsetFrom->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_TZOffsetFrom), us); - return us; -#endif -} -//--------------------------------------------------------------------- -// XTOKENS -void TZPart::addXTokens(UnicodeString s) -{ - if (m_XTokensVctr == 0) - m_XTokensVctr = new JulianPtrArray(); - PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - m_XTokensVctr->Add(new UnicodeString(s)); - } -} -//--------------------------------------------------------------------- - - - diff --git a/mozilla/calendar/modules/core/ical/src/unistrto.cpp b/mozilla/calendar/modules/core/ical/src/unistrto.cpp deleted file mode 100644 index 19696da1260..00000000000 --- a/mozilla/calendar/modules/core/ical/src/unistrto.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * unistrto.cpp - * John Sun - * 2/3/98 12:07:12 PM - */ - -#include "stdafx.h" -#include "jdefines.h" - -#include "unistring.h" -#include "unistrto.h" -#include "keyword.h" - -//static UnicodeString s_DefaultDelims = "\t\n\r"; -//--------------------------------------------------------------------- - -void -UnicodeStringTokenizer::skipDelimeters() -{ - while ((m_CurrentPosition < m_MaxPosition) && - (m_StringDelimeters.indexOf(m_String[(TextOffset)m_CurrentPosition]) >= 0)) - { - m_CurrentPosition++; - } -} -//--------------------------------------------------------------------- - -UnicodeStringTokenizer::UnicodeStringTokenizer(UnicodeString & str, - UnicodeString & delim) -: m_CurrentPosition(0) -{ - m_String = str; - m_MaxPosition = m_String.size(); - m_StringDelimeters = delim; -} -//--------------------------------------------------------------------- -#if 0 -UnicodeStringTokenizer::UnicodeStringTokenizer(UnicodeString & str) -: m_CurrentPosition (0) -{ - m_String = str; - m_MaxPosition = m_String.size(); - m_StringDelimeters = nsCalKeyword::Instance()->ms_sDEFAULT_DELIMS; -} -#endif -//--------------------------------------------------------------------- - -t_bool -UnicodeStringTokenizer::hasMoreTokens() -{ - skipDelimeters(); - return (m_CurrentPosition < m_MaxPosition); -} - -//--------------------------------------------------------------------- - -UnicodeString & -UnicodeStringTokenizer::nextToken(UnicodeString & out, - ErrorCode & status) -{ - t_int32 start; - - skipDelimeters(); - if (m_CurrentPosition >= m_MaxPosition) - { - status = 1; - return out; - } - start = m_CurrentPosition; - while ((m_CurrentPosition < m_MaxPosition) && - (m_StringDelimeters.indexOf(m_String[(TextOffset) m_CurrentPosition]) < 0)) - { - m_CurrentPosition++; - } - out = m_String.extractBetween(start, m_CurrentPosition, out); - return out; -} - -//--------------------------------------------------------------------- -#if 0 -UnicodeString & -UnicodeStringTokenizer::nextToken(UnicodeString & out, - UnicodeString & sDelim, - ErrorCode & status) -{ - status = ZERO_ERROR; - m_StringDelimeters = sDelim; - return nextToken(out, status); -} -#endif -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/uri.cpp b/mozilla/calendar/modules/core/ical/src/uri.cpp deleted file mode 100644 index 9a961e6fe94..00000000000 --- a/mozilla/calendar/modules/core/ical/src/uri.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * uri.cpp - * John Sun - * 4/3/98 11:33:48 AM - */ - -#include "stdafx.h" -#include "uri.h" -#include "nspr.h" - -//--------------------------------------------------------------------- - -URI::URI() -{ -} - -//--------------------------------------------------------------------- - -URI::URI(UnicodeString fulluri) -{ - m_URI = fulluri; -} - -//--------------------------------------------------------------------- - -URI::URI(char * fulluri) -{ - m_URI = fulluri; -} - -//--------------------------------------------------------------------- - -UnicodeString URI::getName() -{ - t_int32 i; - - i = m_URI.indexOf(':'); - //PR_ASSERT(i != 0); - if (i < 0) - { - return m_URI; - } - else - { - UnicodeString u; - u = m_URI.extractBetween(i + 1, m_URI.size(), u); - return u; - } -} - -//--------------------------------------------------------------------- - -t_bool URI::IsValidURI(UnicodeString & s) -{ - if (s.indexOf(':') > 0) - return PR_TRUE; - else - return PR_FALSE; -} - -//--------------------------------------------------------------------- diff --git a/mozilla/calendar/modules/core/ical/src/valarm.cpp b/mozilla/calendar/modules/core/ical/src/valarm.cpp deleted file mode 100644 index dbe1dcae5ed..00000000000 --- a/mozilla/calendar/modules/core/ical/src/valarm.cpp +++ /dev/null @@ -1,1020 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -/* - * valarm.cpp - * John Sun - * 7/22/98 11:15:46 AM - */ - -#include "stdafx.h" -#include "jdefines.h" - -#include "icalredr.h" -#include "valarm.h" -#include "unistrto.h" -#include "keyword.h" -#include "prprtyfy.h" - -#include "functbl.h" -//--------------------------------------------------------------------- - -// private never use -#if 0 -VAlarm::VAlarm() -{ - PR_ASSERT(FALSE); -} -#endif -//--------------------------------------------------------------------- - -VAlarm::VAlarm(JLog * initLog) -: m_Trigger(0), m_Duration(0), m_Repeat(0), - m_XTokensVctr(0), - m_AttachVctr(0), m_Description(0), m_AttendeesVctr(0), - m_Summary(0), - m_Log(initLog) -{ - m_Action = ACTION_INVALID; - m_TriggerDateTime.setTime(-1); -} - -//--------------------------------------------------------------------- - -VAlarm::VAlarm(VAlarm & that) -: m_Trigger(0), m_Duration(0), m_Repeat(0), - m_XTokensVctr(0), - m_AttachVctr(0), m_Description(0), m_AttendeesVctr(0), - m_Summary(0) -{ - m_Action = that.m_Action; - m_TriggerDateTime = that.m_TriggerDateTime; - - if (that.m_Trigger != 0) - { - m_Trigger = that.m_Trigger->clone(m_Log); - } - if (that.m_Duration != 0) - { - m_Duration = that.m_Duration->clone(m_Log); - } - if (that.m_Repeat != 0) - { - m_Repeat = that.m_Repeat->clone(m_Log); - } - if (that.m_XTokensVctr != 0) - { - m_XTokensVctr = new JulianPtrArray(); PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - ICalProperty::CloneUnicodeStringVector(that.m_XTokensVctr, m_XTokensVctr); - } - } - if (that.m_AttachVctr != 0) - { - m_AttachVctr = new JulianPtrArray(); PR_ASSERT(m_AttachVctr != 0); - if (m_AttachVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_AttachVctr, m_AttachVctr, m_Log); - } - } - if (that.m_Description != 0) - { - m_Description = that.m_Description->clone(m_Log); - } - if (that.m_AttendeesVctr != 0) - { - m_AttendeesVctr = new JulianPtrArray(); PR_ASSERT(m_AttendeesVctr != 0); - if (m_AttendeesVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_AttendeesVctr, m_AttendeesVctr, m_Log); - } - } - if (that.m_Summary != 0) - { - m_Summary = that.m_Summary->clone(m_Log); - } -} - -//--------------------------------------------------------------------- -ICalComponent * -VAlarm::clone(JLog * initLog) -{ - m_Log = initLog; - return new VAlarm(*this); -} -//--------------------------------------------------------------------- - -VAlarm::~VAlarm() -{ - // trigger, duration, repeat - if (m_Trigger != 0) - { - delete m_Trigger; m_Trigger = 0; - } - if (m_Duration != 0) - { - delete m_Duration; m_Duration = 0; - } - if (m_Repeat != 0) - { - delete m_Repeat; m_Repeat = 0; - } - // x-tokens - if (m_XTokensVctr != 0) - { - ICalComponent::deleteUnicodeStringVector(m_XTokensVctr); - delete m_XTokensVctr; m_XTokensVctr = 0; - } - // attach, description, attendees - if (m_AttachVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_AttachVctr); - delete m_AttachVctr; m_AttachVctr = 0; - } - if (m_Description != 0) - { - delete m_Description; m_Description = 0; - } - if (m_AttendeesVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_AttendeesVctr); - delete m_AttendeesVctr; m_AttendeesVctr = 0; - } - if (m_Summary != 0) - { - delete m_Summary; m_Summary = 0; - } -} - -//--------------------------------------------------------------------- - -UnicodeString & -VAlarm::parse(ICalReader * brFile, UnicodeString & sType, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones, - t_bool bIgnoreBeginError, - nsCalUtility::MimeEncoding encoding) -{ - UnicodeString strLine, propName, propVal; - JulianPtrArray * parameters = new JulianPtrArray(); - parseStatus = nsCalKeyword::Instance()->ms_sOK; - - PR_ASSERT(parameters != 0 && brFile != 0); - if (parameters == 0 || brFile == 0) - { - // ran out of memory, return invalid VAlarm - return parseStatus; - } - ErrorCode status = ZERO_ERROR; - - while (TRUE) - { - PR_ASSERT(brFile != 0); - brFile->readFullLine(strLine, status); - ICalProperty::Trim(strLine); - - if (FAILURE(status) && strLine.size() == 0) - break; - - ICalProperty::parsePropertyLine(strLine, propName, propVal, parameters); - - if (strLine.size() == 0) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - continue; - } - // END:STANDARD OR END:DAYLIGHT (sType = daylight or standard) - else if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVALARM) == 0)) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - break; - } - else if ( - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - ( (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) || - (ICalProperty::IsXToken(propVal))) - ) || - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - ((propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (ICalProperty::IsXToken(propVal)) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVALARM) == 0)))) - { - // END:VEVENT, VTODO, VCALENDAR, VJOURNAL, VFREEBUSY, VTIMEZONE, x-token - // BEGIN:VEVENT, VTODO, VJOURNAL, VFREEBUSY, VTIMEZONE, VCALENDAR, VALARM, xtoken - // abrupt end - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iAbruptEndOfParsing, - nsCalKeyword::Instance()->ms_sVALARM, strLine, 300); - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - parseStatus = strLine; - break; - } - else - { - storeData(strLine, propName, propVal, parameters, vTimeZones); - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - } - } - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - delete parameters; parameters = 0; - - selfCheck(); - return parseStatus; -} -//--------------------------------------------------------------------- -void VAlarm::storeAction(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_int32 i; - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVALARM, strLine, 100); - } - i = stringToAction(propVal); - if (i < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyValue, - nsCalKeyword::Instance()->ms_sVALARM, - nsCalKeyword::Instance()->ms_sACTION, propVal, 200); - } - else - { - if (getAction() >= 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVALARM, - nsCalKeyword::Instance()->ms_sACTION, propVal, 100); - } - setAction((VAlarm::ACTION) i); - } -} -//--------------------------------------------------------------------- - -void VAlarm::storeAttach(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParamValid; - bParamValid = ICalProperty::CheckParamsWithValueRangeCheck(parameters, - nsCalAtomRange::Instance()->ms_asEncodingValueFMTTypeParamRange, - nsCalAtomRange::Instance()->ms_asEncodingValueFMTTypeParamRangeSize, - nsCalAtomRange::Instance()->ms_asBinaryURIValueRange, - nsCalAtomRange::Instance()->ms_asBinaryURIValueRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVALARM, strLine, 100); - } - addAttach(propVal, parameters); -} -//--------------------------------------------------------------------- - -void VAlarm::storeAttendee(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - Attendee * attendee = new Attendee(GetType(), m_Log); - PR_ASSERT(attendee != 0); - if (attendee != 0) - { - attendee->parse(propVal, parameters); - if (!attendee->isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidAttendee, 200); - delete attendee; attendee = 0; - } - else - { - addAttendee(attendee); - } - } -} -//--------------------------------------------------------------------- -void VAlarm::storeDescription(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid; - bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRange, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRangeSize); - - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVALARM, strLine, 100); - } - - // check for duplicates - if (getDescriptionProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVALARM, - nsCalKeyword::Instance()->ms_sDESCRIPTION, 100); - } - - setDescription(propVal, parameters); -} -//--------------------------------------------------------------------- -void VAlarm::storeDuration(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVALARM, strLine, 100); - } - - if (getDurationProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVALARM, - nsCalKeyword::Instance()->ms_sDURATION, 100); - } - nsCalDuration d(propVal); - setDuration(d, parameters); -} -//--------------------------------------------------------------------- -void VAlarm::storeRepeat(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParseError = FALSE; - t_int32 i; - - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVALARM, strLine, 100); - } - - char * pcc = propVal.toCString(""); - PR_ASSERT(pcc != 0); - i = nsCalUtility::atot_int32(pcc, bParseError, propVal.size()); - delete [] pcc; pcc = 0; - - if (getRepeatProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVALARM, - nsCalKeyword::Instance()->ms_sREPEAT, 100); - } - if (!bParseError) - { - setRepeat(i, parameters); - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidNumberFormat, - nsCalKeyword::Instance()->ms_sVALARM, - nsCalKeyword::Instance()->ms_sREPEAT, propVal, 200); - } -} -//--------------------------------------------------------------------- -void VAlarm::storeSummary(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid; - bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asLanguageParamRange, - nsCalAtomRange::Instance()->ms_asLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVALARM, strLine, 100); - } - - if (getSummaryProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVALARM, - nsCalKeyword::Instance()->ms_sSUMMARY, 100); - } - setSummary(propVal, parameters); -} - -//--------------------------------------------------------------------- -void VAlarm::storeTrigger(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid; - bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asRelatedValueParamRange, - nsCalAtomRange::Instance()->ms_asRelatedValueParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVALARM, strLine, 100); - } - // if propVal is a datetime, store trigger as a datetime, otherwise store is as a duration - if (getDurationProperty() != 0 || m_TriggerDateTime.isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVALARM, - nsCalKeyword::Instance()->ms_sDURATION, 100); - } - - DateTime dt(propVal); - if (dt.isValid()) - { - setTriggerAsDateTime(dt); - } - else - { - nsCalDuration d(propVal); - setTriggerAsDuration(d, parameters); - } -} - - -//--------------------------------------------------------------------- -void -VAlarm::storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters, - JulianPtrArray * vTimeZones) -{ - t_int32 hashCode = propName.hashCode(); - t_int32 i; - for (i = 0; 0 != (JulianFunctionTable::Instance()->alarmStoreTable[i]).op; i++) - { - if ((JulianFunctionTable::Instance()->alarmStoreTable[i]).hashCode == hashCode) - { - ApplyStoreOp(((JulianFunctionTable::Instance())->alarmStoreTable[i]).op, - strLine, propVal, parameters, vTimeZones); - return; - } - } - if (ICalProperty::IsXToken(propName)) - { - addXTokens(strLine); - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyName, - nsCalKeyword::Instance()->ms_sVALARM, propName, 200); - } -} - -//--------------------------------------------------------------------- -void VAlarm::selfCheck() -{ - UnicodeString u; - - switch(m_Action) - { - case ACTION_AUDIO: - break; - case ACTION_DISPLAY: - - // if display prop, make sure description there. - // if not add a default description - - if (getDescription().size() == 0) - { - // TODO: make this localized; - //u = nsCalLogErrorMessage::Instance()->ms_iDefaultAlarmDescriptionString; - u = "DEFAULT"; - setDescription(u); - } - break; - case ACTION_EMAIL: - - // if email prop, make sure description and summary - // if not add a default description and summary - - if (getDescription().size() == 0) - { - // TODO: make this localized; - //u = nsCalLogErrorMessage::Instance()->ms_iDefaultAlarmDescriptionString; - u = "DEFAULT"; - setDescription(u); - } - if (getSummary().size() == 0) - { - // TODO: make this localized; - //u = nsCalLogErrorMessage::Instance()->ms_iDefaultAlarmSummaryString; - u = "DEFAULT"; - setSummary(u); - } - break; - case ACTION_PROCEDURE: - break; - default: - break; - } -} -//--------------------------------------------------------------------- -t_bool VAlarm::isValid() -{ - - // action must be set to valid value - if (m_Action == ACTION_INVALID) - return FALSE; - - // trigger must be valid duration or datetime. - if (m_Trigger == 0 && !m_TriggerDateTime.isValid()) - return FALSE; - - switch (m_Action) - { - case ACTION_AUDIO: - // if action == audio: must ONLY one attach if it has an attach - if (getAttach() != 0 && getAttach()->GetSize() != 1) - return FALSE; - - // MAKE SURE certain properties are empty. may remove later - if (getDescription().size() > 0) - return FALSE; - if (getSummary().size() > 0) - return FALSE; - if (getAttendees() != 0) - return FALSE; - break; - case ACTION_DISPLAY: - // if action == display: must have description - if (getDescription().size() == 0) - return FALSE; - - // MAKE SURE certain properties are empty. may remove later - if (getSummary().size() > 0) - return FALSE; - if (getAttendees() != 0) - return FALSE; - if (getAttach() != 0) - return FALSE; - break; - case ACTION_EMAIL: - // if action == email: must have description, summary, at least ONE attendee - if (getDescription().size() == 0 || getSummary().size() == 0 || - getAttendees() == 0 || getAttendees()->GetSize() == 0) - return FALSE; - break; - case ACTION_PROCEDURE: - // if action == procedure: must have ONLY one attach - if (getAttach() == 0 || getAttach()->GetSize() != 1) - return FALSE; - - // MAKE SURE certain properties are empty. may remove later - if (getSummary().size() > 0) - return FALSE; - if (getAttendees() != 0) - return FALSE; - break; - default: - return FALSE; - } - - return TRUE; -} -//--------------------------------------------------------------------- -UnicodeString VAlarm::toICALString() -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sVALARM; - return ICalComponent::format(u, nsCalFormatString::Instance()->ms_sVAlarmAllMessage, ""); -} -//--------------------------------------------------------------------- -UnicodeString VAlarm::toICALString(UnicodeString method, - UnicodeString name, - t_bool isRecurring) -{ - // NOTE: remove later avoid warnings - if (isRecurring) {} - return toICALString(); -} -//--------------------------------------------------------------------- -UnicodeString VAlarm::toString() -{ - return ICalComponent::toStringFmt( - nsCalFormatString::Instance()->ms_VAlarmStrDefaultFmt); -} -//--------------------------------------------------------------------- -UnicodeString VAlarm::formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString s, sResult; - - // NOTE: remove here is get rid of compiler warnings - if (sFilterAttendee.size() > 0 || delegateRequest) - { - } - - switch (c) - { - case ms_cAction: - // print method enum - sResult += nsCalKeyword::Instance()->ms_sACTION; - sResult += nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - sResult += actionToString(getAction(), s); - sResult += nsCalKeyword::Instance()->ms_sLINEBREAK; - return sResult; - case ms_cAttendees: - s = nsCalKeyword::Instance()->ms_sATTENDEE; - return ICalProperty::propertyVectorToICALString(s, getAttendees(), sResult); - case ms_cAttach: - s = nsCalKeyword::Instance()->ms_sATTACH; - return ICalProperty::propertyVectorToICALString(s, getAttach(), sResult); - case ms_cDescription: - s = nsCalKeyword::Instance()->ms_sDESCRIPTION; - return ICalProperty::propertyToICALString(s, getDescriptionProperty(), sResult); - case ms_cDuration: - s = nsCalKeyword::Instance()->ms_sDURATION; - return ICalProperty::propertyToICALString(s, getDurationProperty(), sResult); - case ms_cRepeat: - s = nsCalKeyword::Instance()->ms_sREPEAT; - return ICalProperty::propertyToICALString(s, getRepeatProperty(), sResult); - case ms_cTrigger: - s = nsCalKeyword::Instance()->ms_sTRIGGER; - if (m_Trigger != 0) - { - return ICalProperty::propertyToICALString(s, getTriggerProperty(), sResult); - } - else - { - s += nsCalKeyword::Instance()->ms_sSEMICOLON_SYMBOL; - s += nsCalKeyword::Instance()->ms_sVALUE; - s += '='; - s += nsCalKeyword::Instance()->ms_sDATETIME; - s += nsCalKeyword::Instance()->ms_sCOLON_SYMBOL; - s += m_TriggerDateTime.toISO8601(); - s += nsCalKeyword::Instance()->ms_sLINEBREAK; - return s; - } - case ms_cSummary: - s = nsCalKeyword::Instance()->ms_sSUMMARY; - return ICalProperty::propertyToICALString(s, getSummaryProperty(), sResult); - case ms_cXTokens: - return ICalProperty::vectorToICALString(getXTokens(), sResult); - default: - return ""; - } -} -//--------------------------------------------------------------------- -UnicodeString VAlarm::toStringChar(t_int32 c, UnicodeString & dateFmt) -{ - UnicodeString s; - switch (c) - { - case ms_cAction: - return actionToString(getAction(), s); - case ms_cAttendees: - return ICalProperty::propertyVectorToString(getAttendees(), dateFmt, s); - case ms_cAttach: - return ICalProperty::propertyVectorToString(getAttach(), dateFmt, s); - case ms_cDescription: - return ICalProperty::propertyToString(getDescriptionProperty(), dateFmt, s); - case ms_cDuration: - return ICalProperty::propertyToString(getDurationProperty(), dateFmt, s); - case ms_cRepeat: - return ICalProperty::propertyToString(getRepeatProperty(), dateFmt, s); - case ms_cTrigger: - if (m_Trigger != 0) - { - return ICalProperty::propertyToString(getTriggerProperty(), dateFmt, s); - } - else - { - return m_TriggerDateTime.toString(); - } - case ms_cSummary: - return ICalProperty::propertyToString(getSummaryProperty(), dateFmt, s); - case ms_cXTokens: - default: - return ""; - } -} -//--------------------------------------------------------------------- - -void -VAlarm::updateComponentHelper(VAlarm * updatedComponent) -{ - // todo: finish -} - -//--------------------------------------------------------------------- - -t_bool -VAlarm::updateComponent(ICalComponent * updatedComponent) -{ - if (updatedComponent != 0) - { - ICAL_COMPONENT ucType = updatedComponent->GetType(); - - // only call updateComponentHelper if it's a VAlarm and - // it is an exact matching Name (STANDARD or DAYLIGHT) - // basically always overwrite - if (ucType == ICAL_COMPONENT_VALARM) - { - // todo: finish - } - } - return FALSE; -} - -//--------------------------------------------------------------------- - -VAlarm::ACTION -VAlarm::stringToAction(UnicodeString & action) -{ - t_int32 hashCode = action.hashCode(); - - if (nsCalKeyword::Instance()->ms_ATOM_AUDIO == hashCode) return ACTION_AUDIO; - else if (nsCalKeyword::Instance()->ms_ATOM_DISPLAY == hashCode) return ACTION_DISPLAY; - else if (nsCalKeyword::Instance()->ms_ATOM_EMAIL == hashCode) return ACTION_EMAIL; - else if (nsCalKeyword::Instance()->ms_ATOM_PROCEDURE == hashCode) return ACTION_PROCEDURE; - else return ACTION_INVALID; - // ??? is AUDIO to be default, or should I have invalid state? -} - -//--------------------------------------------------------------------- - -UnicodeString & VAlarm::actionToString(VAlarm::ACTION action, UnicodeString & out) -{ - switch(action) - { - case ACTION_AUDIO: out = nsCalKeyword::Instance()->ms_sAUDIO; break; - case ACTION_DISPLAY: out = nsCalKeyword::Instance()->ms_sDISPLAY; break; - case ACTION_EMAIL: out = nsCalKeyword::Instance()->ms_sEMAIL; break; - case ACTION_PROCEDURE: out = nsCalKeyword::Instance()->ms_sPROCEDURE; break; - default: - out = ""; - break; - } - return out; -} -//--------------------------------------------------------------------- -//--------------------------------------------------------------------- -///nsCalDuration -void VAlarm::setDuration(nsCalDuration s, JulianPtrArray * parameters) -{ - if (m_Duration == 0) - m_Duration = ICalPropertyFactory::Make(ICalProperty::DURATION, - (void *) &s, parameters); - else - { - m_Duration->setValue((void *) &s); - m_Duration->setParameters(parameters); - } -} -nsCalDuration VAlarm::getDuration() const -{ - nsCalDuration d; d.set(-1,-1,-1,-1,-1,-1); - if (m_Duration == 0) - return d; // return 0; - else - { - d = *((nsCalDuration *) m_Duration->getValue()); - return d; - } -} -//--------------------------------------------------------------------- -///Trigger -void VAlarm::setTriggerAsDuration(nsCalDuration s, JulianPtrArray * parameters) -{ - if (m_Trigger == 0) - m_Trigger = ICalPropertyFactory::Make(ICalProperty::DURATION, - (void *) &s, parameters); - else - { - m_Trigger->setValue((void *) &s); - m_Trigger->setParameters(parameters); - } -} -nsCalDuration VAlarm::getTriggerAsDuration() const -{ - nsCalDuration d; d.set(-1,-1,-1,-1,-1,-1); - if (m_Trigger == 0) - return d; // return 0; - else - { - d = *((nsCalDuration *) m_Trigger->getValue()); - return d; - } -} -DateTime VAlarm::getTriggerAsDateTime(DateTime start) const -{ - DateTime d; - if (m_Trigger != 0) - { - nsCalDuration du = getTriggerAsDuration(); - start.add(du); - d = start; - } - else - d = m_TriggerDateTime; - return d; -} -void VAlarm::setTriggerAsDateTime(DateTime s) -{ - m_TriggerDateTime = s; - // clear trigger duration if it exists - if (m_Trigger != 0) - { - delete m_Trigger; m_Trigger = 0; - } -} -//--------------------------------------------------------------------- -//Repeat -void VAlarm::setRepeat(t_int32 i, JulianPtrArray * parameters) -{ -#if 1 - if (m_Repeat == 0) - m_Repeat = ICalPropertyFactory::Make(ICalProperty::INTEGER, - (void *) &i, parameters); - else - { - m_Repeat->setValue((void *) &i); - m_Repeat->setParameters(parameters); - } -#else - ICalComponent::setIntegerValue(((ICalProperty **) &m_Repeat), i, parameters); -#endif -} -t_int32 VAlarm::getRepeat() const -{ -#if 1 - t_int32 i; - if (m_Repeat == 0) - return -1; - else - { - i = *((t_int32 *) m_Repeat->getValue()); - return i; - } -#else - t_int32 i = -1; - ICalComponent::getIntegerValue(((ICalProperty **) &m_Repeat), i); - return i; -#endif - -} -//--------------------------------------------------------------------- -//Description -void VAlarm::setDescription(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); -#if 1 - if (m_Description == 0) - m_Description = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Description->setValue((void *) &s); - m_Description->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Description), s, parameters); -#endif -} -UnicodeString VAlarm::getDescription() const -{ -#if 1 - if (m_Description == 0) - return ""; - else - { - UnicodeString u; - u = *((UnicodeString *) m_Description->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Description), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//Summary -void VAlarm::setSummary(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); -#if 1 - if (m_Summary == 0) - m_Summary = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Summary->setValue((void *) &s); - m_Summary->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Summary), s, parameters); -#endif -} -UnicodeString VAlarm::getSummary() const -{ -#if 1 - if (m_Summary == 0) - return ""; - else - { - UnicodeString u; - u = *((UnicodeString *) m_Summary->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Summary), us); - return us; -#endif -} -//--------------------------------------------------------------------- -// attach -void VAlarm::addAttach(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - addAttachProperty(prop); -} -void VAlarm::addAttachProperty(ICalProperty * prop) -{ - if (m_AttachVctr == 0) - m_AttachVctr = new JulianPtrArray(); - PR_ASSERT(m_AttachVctr != 0); - if (m_AttachVctr != 0) - { - m_AttachVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -// attendees -void VAlarm::addAttendee(Attendee * a) -{ - if (m_AttendeesVctr == 0) - m_AttendeesVctr = new JulianPtrArray(); - PR_ASSERT(m_AttendeesVctr != 0); - if (m_AttendeesVctr != 0) - { - m_AttendeesVctr->Add(a); - } -} -//--------------------------------------------------------------------- -// XTOKENS -void VAlarm::addXTokens(UnicodeString s) -{ - if (m_XTokensVctr == 0) - m_XTokensVctr = new JulianPtrArray(); - PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - m_XTokensVctr->Add(new UnicodeString(s)); - } -} -//--------------------------------------------------------------------- diff --git a/mozilla/calendar/modules/core/ical/src/vevent.cpp b/mozilla/calendar/modules/core/ical/src/vevent.cpp deleted file mode 100644 index b8ba4d0383e..00000000000 --- a/mozilla/calendar/modules/core/ical/src/vevent.cpp +++ /dev/null @@ -1,1192 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// vevent.cpp -// John Sun -// 10:50 AM February 9 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "jutility.h" -#include "vevent.h" -#include "icalredr.h" -#include "prprtyfy.h" -#include "unistrto.h" -#include "jlog.h" -#include "vtimezne.h" -#include "keyword.h" - -#include "period.h" -#include "datetime.h" - -#include "functbl.h" -//--------------------------------------------------------------------- -void VEvent::setDefaultFmt(UnicodeString s) -{ - nsCalFormatString::Instance()->ms_VEventStrDefaultFmt = s; -} -//--------------------------------------------------------------------- - -// never use -#if 0 -VEvent::VEvent() -{ - PR_ASSERT(FALSE); -} -#endif -//--------------------------------------------------------------------- - -VEvent::VEvent(JLog * initLog) -: m_DTEnd(0), - m_TempDuration(0), - m_GEO(0), m_Location(0), m_Priority(0), m_ResourcesVctr(0), - m_Transp(0), - TimeBasedEvent(initLog) -{ -} -//--------------------------------------------------------------------- -VEvent::VEvent(VEvent & that) -: m_DTEnd(0), - m_TempDuration(0), - m_GEO(0), m_Location(0), m_Priority(0), m_ResourcesVctr(0), - m_Transp(0), - TimeBasedEvent(that) -{ - m_origDTEnd = that.m_origDTEnd; - m_origMyDTEnd = that.m_origMyDTEnd; - - if (that.m_DTEnd != 0) - { - m_DTEnd = that.m_DTEnd->clone(m_Log); - } - //if (that.m_Duration != 0) { m_Duration = that.m_Duration->clone(m_Log); } - if (that.m_GEO != 0) - { - m_GEO = that.m_GEO->clone(m_Log); - } - if (that.m_Location != 0) - { - m_Location = that.m_Location->clone(m_Log); - } - if (that.m_Priority != 0) - { - m_Priority = that.m_Priority->clone(m_Log); - } - if (that.m_Transp != 0) - { - m_Transp = that.m_Transp->clone(m_Log); - } - if (that.m_ResourcesVctr != 0) - { - m_ResourcesVctr = new JulianPtrArray(); PR_ASSERT(m_ResourcesVctr != 0); - if (m_ResourcesVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_ResourcesVctr, m_ResourcesVctr, m_Log); - } - } -} -//--------------------------------------------------------------------- -ICalComponent * -VEvent::clone(JLog * initLog) -{ - m_Log = initLog; - //PR_ASSERT(m_Log != 0); - return new VEvent(*this); -} -//--------------------------------------------------------------------- - -VEvent::~VEvent() -{ - if (m_TempDuration != 0) - { - delete m_TempDuration; m_TempDuration = 0; - } - // properties - if (m_DTEnd != 0) - { - delete m_DTEnd; m_DTEnd = 0; - } - //if (m_Duration != 0) { delete m_Duration; m_Duration = 0; } - if (m_GEO != 0) - { - delete m_GEO; m_GEO = 0; - } - if (m_Location!= 0) - { - delete m_Location; m_Location = 0; - } - if (m_Priority!= 0) - { - delete m_Priority; m_Priority = 0; - } - if (m_Transp != 0) - { - delete m_Transp; m_Transp = 0; - } - - // vector of strings - if (m_ResourcesVctr != 0) { - ICalProperty::deleteICalPropertyVector(m_ResourcesVctr); - delete m_ResourcesVctr; m_ResourcesVctr = 0; - } - //delete (TimeBasedEvent *) this; -} - -//--------------------------------------------------------------------- - -UnicodeString & -VEvent::parse(ICalReader * brFile, UnicodeString & sMethod, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones, - t_bool bIgnoreBeginError, nsCalUtility::MimeEncoding encoding) -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sVEVENT; - return parseType(u, brFile, sMethod, parseStatus, vTimeZones, bIgnoreBeginError, encoding); -} - -//--------------------------------------------------------------------- -#if 0 -t_int8 VEvent::compareTo(VEvent * ve) -{ - PR_ASSERT(ve != 0); - // TODO; - return -1; -} -#endif /* #if 0 */ -//--------------------------------------------------------------------- - -Date VEvent::difference() -{ - if (getDTEnd().getTime() >= 0 && getDTStart().getTime() >= 0) - { - return (getDTEnd().getTime() - getDTStart().getTime()); - } - else return 0; -} - -//--------------------------------------------------------------------- - -void VEvent::selfCheck() -{ - - TimeBasedEvent::selfCheck(); - - // if no dtend, and there is a dtstart and duration, calculate dtend - if (!getDTEnd().isValid()) - { - // calculate DTEnd from duration and dtstart - // TODO: remove memory leaks in m_TempDuration - if (getDTStart().isValid() && m_TempDuration != 0 && m_TempDuration->isValid()) - { - DateTime end; - end = getDTStart(); - end.add(*m_TempDuration); - setDTEnd(end); - delete m_TempDuration; m_TempDuration = 0; // lifetime of variable is only - // after load. - } - else if (!getDTStart().isValid()) - { - if (m_TempDuration != 0) - delete m_TempDuration; m_TempDuration = 0; - } - } - - // if is anniversary event, set transp to TRANSPARENT - if (isAllDayEvent()) - { - setTransp(nsCalKeyword::Instance()->ms_sTRANSP); - - // if no dtend, set dtend to end of day of dtstart. - if (!getDTEnd().isValid()) - { - DateTime d; - d = getDTStart(); - d.add(Calendar::DATE, 1); - d.set(Calendar::HOUR_OF_DAY, 0); - d.set(Calendar::MINUTE, 0); - d.set(Calendar::SECOND, 0); - setDTEnd(d); - } - - // If DTEND is before DTSTART, set dtend = dtstart - if (getDTEnd().getTime() < getDTStart().getTime()) - { - DateTime d; - d = getDTStart(); - setDTEnd(d); - - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDTEndBeforeDTStart, 100); - } - } - else - { - if (!getDTEnd().isValid()) - { - // dtend is same as dtstart - DateTime d; - d = getDTStart(); - if (d.isValid()) - setDTEnd(d); - } - - // If DTEND is before DTSTART, set dtend = dtstart - if (getDTEnd().getTime() < getDTStart().getTime()) - { - DateTime d; - d = getDTStart(); - setDTEnd(d); - - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDTEndBeforeDTStart, 100); - } - } - if (getStatus().size() > 0) - { - // check if I got a valid status - UnicodeString u = getStatus(); - u.toUpper(); - ICalProperty::Trim(u); - JAtom ua(u); - if ((nsCalKeyword::Instance()->ms_ATOM_CONFIRMED != ua) && - (nsCalKeyword::Instance()->ms_ATOM_TENTATIVE != ua) && - (nsCalKeyword::Instance()->ms_ATOM_CANCELLED != ua)) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyValue, - nsCalKeyword::Instance()->ms_sVEVENT, - nsCalKeyword::Instance()->ms_sSTATUS, u, 200); - - setStatus(""); - } - } -} - -//--------------------------------------------------------------------- -void VEvent::storeDTEnd(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParamsWithValueRangeCheck(parameters, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRange, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRangeSize, - nsCalAtomRange::Instance()->ms_asDateDateTimeValueRange, - nsCalAtomRange::Instance()->ms_asDateDateTimeValueRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVEVENT, strLine, 100); - } - - if (getDTEndProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVEVENT, - nsCalKeyword::Instance()->ms_sDTEND, 100); - } - UnicodeString u, out; - - u = nsCalKeyword::Instance()->ms_sVALUE; - out = ICalParameter::GetParameterFromVector(u, out, parameters); - - t_bool bIsDate = DateTime::IsParseableDate(propVal); - - if (bIsDate) - { - // if there is a VALUE=X parameter, make sure X is DATE - if (out.size() != 0 && (nsCalKeyword::Instance()->ms_ATOM_DATE != out.hashCode())) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iPropertyValueTypeMismatch, - nsCalKeyword::Instance()->ms_sVEVENT, strLine, 100); - } - } - else - { - // if there is a VALUE=X parameter, make sure X is DATETIME - if (out.size() != 0 && (nsCalKeyword::Instance()->ms_ATOM_DATETIME != out.hashCode())) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iPropertyValueTypeMismatch, - nsCalKeyword::Instance()->ms_sVEVENT, strLine, 100); - } - } - - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setDTEnd(d, parameters); -} -void VEvent::storeDuration(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVEVENT, strLine, 100); - } - - if (m_TempDuration != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVEVENT, - nsCalKeyword::Instance()->ms_sDURATION, 100); - } - //Duration d(propVal); - if (m_TempDuration == 0) - { - m_TempDuration = new nsCalDuration(propVal); - PR_ASSERT(m_TempDuration != 0); - } - else - m_TempDuration->setDurationString(propVal); -} -void VEvent::storeGEO(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVEVENT, strLine, 100); - } - - if (getGEOProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVEVENT, - nsCalKeyword::Instance()->ms_sGEO, 100); - } - setGEO(propVal, parameters); -} -void VEvent::storeLocation(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRange, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRangeSize); - - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVEVENT, strLine, 100); - } - - if (getLocationProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVEVENT, - nsCalKeyword::Instance()->ms_sLOCATION, 100); - } - setLocation(propVal, parameters); -} -void VEvent::storePriority(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParseError = FALSE; - t_int32 i; - - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVEVENT, strLine, 100); - } - - char * pcc = propVal.toCString(""); - PR_ASSERT(pcc != 0); - i = nsCalUtility::atot_int32(pcc, bParseError, propVal.size()); - delete [] pcc; pcc = 0; - if (getPriorityProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVEVENT, - nsCalKeyword::Instance()->ms_sPRIORITY, 100); - } - if (!bParseError) - { - setPriority(i, parameters); - } - else - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidNumberFormat, - nsCalKeyword::Instance()->ms_sVEVENT, - nsCalKeyword::Instance()->ms_sPRIORITY, propVal, 200); - } -} -void VEvent::storeResources(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ -// check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asLanguageParamRange, - nsCalAtomRange::Instance()->ms_asLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVEVENT, strLine, 100); - } - - addResourcesPropertyVector(propVal, parameters); -} -void VEvent::storeTransp(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVEVENT, strLine, 100); - } - - if (getTranspProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVEVENT, - nsCalKeyword::Instance()->ms_sTRANSP, 100); - } - setTransp(propVal, parameters); -} -//--------------------------------------------------------------------- -t_bool -VEvent::storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters, - JulianPtrArray * vTimeZones) -{ - if (TimeBasedEvent::storeData(strLine, propName, propVal, - parameters, vTimeZones)) - return TRUE; - else - { - t_int32 hashCode = propName.hashCode(); - t_int32 i; - for (i = 0; 0 != (JulianFunctionTable::Instance()->veStoreTable[i]).op; i++) - { - if ((JulianFunctionTable::Instance()->veStoreTable[i]).hashCode == hashCode) - { - ApplyStoreOp(((JulianFunctionTable::Instance())->veStoreTable[i]).op, - strLine, propVal, parameters, vTimeZones); - return TRUE; - } - } - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyName, - nsCalKeyword::Instance()->ms_sVEVENT, propName, 200); - UnicodeString u; - u = nsCalLogErrorMessage::Instance()->ms_sRS202; - u += '.'; u += ' '; - u += strLine; - addRequestStatus(u); - return FALSE; - } -} - -//--------------------------------------------------------------------- -/// note: todo: crash proof, bulletproofed -void VEvent::populateDatesHelper(DateTime start, Date ldiff, - JulianPtrArray * vPeriods) -{ - Date diff = ldiff; - Date diff2 = -1; - - if (vPeriods != 0) - { - // Check if period matches this date, if-so, set - // difference to be length of period - // TODO: if multiple periods match this date, choose period - // with longest length - - t_int32 i; - UnicodeString u; - Period p; - DateTime ps, pe; - Date pl; - for (i = 0; i < vPeriods->GetSize(); i++) - { - u = *((UnicodeString *) vPeriods->GetAt(i)); - - //if (FALSE) TRACE("populateDatesHelper(): u = %s\r\n", u.toCString("")); - - p.setPeriodString(u); - PR_ASSERT(p.isValid()); - if (p.isValid()) - { - ps = p.getStart(); - - if (ps.equalsDateTime(start)) - { - pe = p.getEndingTime(pe); - pl = (pe.getTime() - ps.getTime()); - //if (FALSE) TRACE("populateDatesHelper(): pl = %d\r\n", pl); - - diff2 = ((diff2 > pl) ? diff2 : pl); - } - } - } - } - if (diff2 != -1) - diff = diff2; - - DateTime dEnd; - dEnd.setTime(start.getTime() + diff); - setDTEnd(dEnd); - setMyOrigEnd(dEnd); - - DateTime origEnd; - origEnd.setTime(getOrigStart().getTime() + ldiff); - setOrigEnd(origEnd); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::formatHelper(UnicodeString & strFmt, - UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sVEVENT; - return ICalComponent::format(u, strFmt, sFilterAttendee, delegateRequest); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::toString() -{ - return ICalComponent::toStringFmt( - nsCalFormatString::Instance()->ms_VEventStrDefaultFmt); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::toStringChar(t_int32 c, UnicodeString & dateFmt) -{ - UnicodeString sResult; - switch ( c ) - { - case ms_cDuration: - return getDuration().toString(); - //return ICalProperty::propertyToString(getDurationProperty(), dateFmt, sResult); - case ms_cDTEnd: - return ICalProperty::propertyToString(getDTEndProperty(), dateFmt, sResult); - case ms_cGEO: - return ICalProperty::propertyToString(getGEOProperty(), dateFmt, sResult); - case ms_cLocation: - return ICalProperty::propertyToString(getLocationProperty(), dateFmt, sResult); - case ms_cTransp: - return ICalProperty::propertyToString(getTranspProperty(), dateFmt, sResult); - case ms_cPriority: - return ICalProperty::propertyToString(getPriorityProperty(), dateFmt, sResult); - case ms_cResources: - return ICalProperty::propertyVectorToString(getResources(), dateFmt, sResult); - default: - return TimeBasedEvent::toStringChar(c, dateFmt); - } -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString s, sResult; - switch (c) { - case ms_cDTEnd: - s = nsCalKeyword::Instance()->ms_sDTEND; - return ICalProperty::propertyToICALString(s, getDTEndProperty(), sResult); - case ms_cDuration: - s = nsCalKeyword::Instance()->ms_sDURATION; - s += ':'; - s += getDuration().toICALString(); - s += nsCalKeyword::Instance()->ms_sLINEBREAK; - return s; - //return ICalProperty::propertyToICALString(s, getDurationProperty(), sResult); - case ms_cLocation: - s = nsCalKeyword::Instance()->ms_sLOCATION; - return ICalProperty::propertyToICALString(s, getLocationProperty(), sResult); - case ms_cPriority: - s = nsCalKeyword::Instance()->ms_sPRIORITY; - return ICalProperty::propertyToICALString(s, getPriorityProperty(), sResult); - case ms_cResources: - s = nsCalKeyword::Instance()->ms_sRESOURCES; - return ICalProperty::propertyVectorToICALString(s, getResources(), sResult); - case ms_cGEO: - s = nsCalKeyword::Instance()->ms_sGEO; - return ICalProperty::propertyToICALString(s, getGEOProperty(), sResult); - case ms_cTransp: - s = nsCalKeyword::Instance()->ms_sTRANSP; - return ICalProperty::propertyToICALString(s, getTranspProperty(), sResult); - default: - { - return TimeBasedEvent::formatChar(c, sFilterAttendee, delegateRequest); - } - } -} - -//--------------------------------------------------------------------- - -t_bool VEvent::isValid() -{ - if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sPUBLISH) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREQUEST) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sADD) == 0)) - { - // must have dtstart - if ((!getDTStart().isValid())) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingStartingTime, 300); - return FALSE; - } - // If dtend exists, make sure it is not before dtstart - if (getDTEnd().isValid() && getDTEnd() < getDTStart()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iEndBeforeStartTime, 300); - return FALSE; - } - // must have dtstamp, summary, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getSummary().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSummary, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - - // TODO: must have organizer, comment out for now since CS&T doesn't have ORGANIZER - /* - if (getOrganizer().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingOrganizer, 300); - return FALSE; - } - */ - // must have sequence >= 0 - if (getSequence() < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSeqNo, 300); - return FALSE; - } - if (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREQUEST) == 0) - { - if (getAttendees() == 0 || getAttendees()->GetSize() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingAttendees, 300); - return FALSE; - } - } - } - else if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREPLY) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sCANCEL) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sDECLINECOUNTER) == 0)) - { - // must have dtstamp, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - - // must have organizer - if (getOrganizer().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingOrganizer, 300); - return FALSE; - } - // must have sequence >= 0 - if (getSequence() < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSeqNo, 300); - return FALSE; - } - if (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREPLY) == 0) - { - // TODO: attendees are required, commenting out for now - if (getAttendees() == 0 || getAttendees()->GetSize() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingAttendees, 300); - return FALSE; - } - } - } - else if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREFRESH) == 0)) - { - // must have dtstamp, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - // TODO: attendees required? - } - else if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sCOUNTER) == 0)) - { - // must have dtstamp, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - - // must have sequence >= 0 - if (getSequence() < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSeqNo, 300); - return FALSE; - } - } - - // check super class isValid method - return TimeBasedEvent::isValid(); -} - -//--------------------------------------------------------------------- -#if 0 -t_bool VEvent::isCriticalInfoSame() -{ - // TODO finish - return FALSE; -} -#endif /* #if 0 */ -//--------------------------------------------------------------------- - -UnicodeString VEvent::cancelMessage() -{ - UnicodeString s = nsCalKeyword::Instance()->ms_sCANCELLED; - setStatus(s); - return formatHelper(nsCalFormatString::Instance()->ms_sVEventCancelMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::requestMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventRequestMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::requestRecurMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventRecurRequestMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::counterMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventCounterMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::declineCounterMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventDeclineCounterMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::addMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventAddMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::refreshMessage(UnicodeString sAttendeeFilter) -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventRefreshMessage, sAttendeeFilter); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::allMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventAllPropertiesMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::replyMessage(UnicodeString sAttendeeFilter) -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventReplyMessage, sAttendeeFilter); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::publishMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventPublishMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VEvent::publishRecurMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVEventRecurPublishMessage, ""); -} - -//--------------------------------------------------------------------- -void -VEvent::updateComponentHelper(TimeBasedEvent * updatedComponent) -{ - //TODO: handle duration, origDTEnd, origMyDTEnd. - TimeBasedEvent::updateComponentHelper(updatedComponent); - if (updatedComponent->GetType() == GetType()) - { - ICalComponent::internalSetPropertyVctr(&m_ResourcesVctr, ((VEvent *) updatedComponent)->getResources()); - ICalComponent::internalSetProperty(&m_DTEnd, ((VEvent *) updatedComponent)->m_DTEnd); - ICalComponent::internalSetProperty(&m_GEO, ((VEvent *) updatedComponent)->m_GEO); - ICalComponent::internalSetProperty(&m_Location, ((VEvent *) updatedComponent)->m_Location); - ICalComponent::internalSetProperty(&m_Priority, ((VEvent *) updatedComponent)->m_Priority); - ICalComponent::internalSetProperty(&m_Transp, ((VEvent *) updatedComponent)->m_Transp); - } -} -//--------------------------------------------------------------------- -///DTEnd -void VEvent::setDTEnd(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_DTEnd == 0) - m_DTEnd = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_DTEnd->setValue((void *) &s); - m_DTEnd->setParameters(parameters); - } - //validateDTEnd(); -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_DTEnd), s, parameters); -#endif -} -DateTime VEvent::getDTEnd() const -{ -#if 1 - DateTime d(-1); - if (m_DTEnd == 0) - return d; //return 0; - else - { - d = *((DateTime *) m_DTEnd->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_DTEnd), d); - return d; -#endif -} -//--------------------------------------------------------------------- -///Duration -void VEvent::setDuration(nsCalDuration s, JulianPtrArray * parameters) -{ - /* - if (m_Duration == 0) - m_Duration = ICalPropertyFactory::Make(ICalProperty::DURATION, - (void *) &s, parameters); - else - { - m_Duration->setValue((void *) &s); - m_Duration->setParameters(parameters); - } - //validateDuration(); - */ - // NOTE: remove later, to avoid compiler warnings - if (parameters) - { - } - - - DateTime end; - end = getDTStart(); - end.add(s); - setDTEnd(end); -} -nsCalDuration VEvent::getDuration() const -{ - /* - Duration d; d.setMonth(-1); - if (m_Duration == 0) - return d; // return 0; - else - { - d = *((Duration *) m_Duration->getValue()); - return d; - } - */ - nsCalDuration duration; - DateTime start, end; - start = getDTStart(); - end = getDTEnd(); - DateTime::getDuration(start,end,duration); - return duration; -} -//--------------------------------------------------------------------- -//GEO -void VEvent::setGEO(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_GEO == 0) - m_GEO = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_GEO->setValue((void *) &s); - m_GEO->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_GEO), s, parameters); -#endif -} -UnicodeString VEvent::getGEO() const -{ -#if 1 - if (m_GEO == 0) - return ""; - else - return *((UnicodeString *) m_GEO->getValue()); -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_GEO), us); - return us; -#endif - -} - -//--------------------------------------------------------------------- -//Location -void VEvent::setLocation(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Location == 0) - { - m_Location = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - } - else - { - m_Location->setValue((void *) &s); - m_Location->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Location), s, parameters); -#endif -} -UnicodeString VEvent::getLocation() const -{ -#if 1 - if (m_Location == 0) - return ""; - else - return *((UnicodeString *) m_Location->getValue()); -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Location), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//Priority -void VEvent::setPriority(t_int32 i, JulianPtrArray * parameters) -{ -#if 1 - if (m_Priority == 0) - m_Priority = ICalPropertyFactory::Make(ICalProperty::INTEGER, - (void *) &i, parameters); - else - { - m_Priority->setValue((void *) &i); - m_Priority->setParameters(parameters); - } -#else - ICalComponent::setIntegerValue(((ICalProperty **) &m_Priority), i, parameters); -#endif -} -t_int32 VEvent::getPriority() const -{ -#if 1 - if (m_Priority == 0) - return -1; - else - return *((t_int32 *) m_Priority->getValue()); -#else - t_int32 i = -1; - ICalComponent::getIntegerValue(((ICalProperty **) &m_Priority), i); - return i; -#endif -} -//--------------------------------------------------------------------- -//Transp -void VEvent::setTransp(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Transp == 0) - m_Transp = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_Transp->setValue((void *) &s); - m_Transp->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Transp), s, parameters); -#endif -} -UnicodeString VEvent::getTransp() const -{ -#if 1 - if (m_Transp == 0) - return ""; - else - return *((UnicodeString *) m_Transp->getValue()); -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Transp), us); - return us; -#endif -} -//--------------------------------------------------------------------- -// RESOURCES -void VEvent::addResources(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - addResourcesProperty(prop); -} - -//--------------------------------------------------------------------- - -void VEvent::addResourcesProperty(ICalProperty * prop) -{ - if (m_ResourcesVctr == 0) - m_ResourcesVctr = new JulianPtrArray(); - PR_ASSERT(m_ResourcesVctr != 0); - if (m_ResourcesVctr != 0) - { - m_ResourcesVctr->Add(prop); - } -} - -//--------------------------------------------------------------------- - -void -VEvent::addResourcesPropertyVector(UnicodeString & propVal, - JulianPtrArray * parameters) -{ - //ICalProperty * ip; - - //ip = ICalPropertyFactory::Make(ICalProperty::TEXT, new UnicodeString(propVal), - // parameters); - addResources(propVal, parameters); - //addResourcesProperty(ip); - - -#if 0 - // TODO: see TimeBasedEvent::addCategoriesPropertyVector() - - ErrorCode status = ZERO_ERROR; - UnicodeStringTokenizer * st; - UnicodeString us; - UnicodeString sDelim = ","; - - st = new UnicodeStringTokenizer(propVal, sDelim); - //ICalProperty * ip; - while (st->hasMoreTokens()) - { - us = st->nextToken(us, status); - us.trim(); - //if (FALSE) TRACE("us = %s, status = %d", us.toCString(""), status); - // TODO: if us is in Resources range then add, else, log and error - addResourcesProperty(ICalPropertyFactory::Make(ICalProperty::TEXT, - new UnicodeString(us), parameters)); - } - delete st; st = 0; -#endif - -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/vfrbsy.cpp b/mozilla/calendar/modules/core/ical/src/vfrbsy.cpp deleted file mode 100644 index 6f0f5f114db..00000000000 --- a/mozilla/calendar/modules/core/ical/src/vfrbsy.cpp +++ /dev/null @@ -1,2105 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// vfrbsy.cpp -// John Sun -// 4:46 PM Febuary 19 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "vfrbsy.h" -#include "prprty.h" -#include "prprtyfy.h" -#include "freebusy.h" -#include "jutility.h" -#include "jlog.h" -#include "vtimezne.h" -#include "keyword.h" -#include "orgnzr.h" - -#include "functbl.h" -//--------------------------------------------------------------------- -// private never use -#if 0 -VFreebusy::VFreebusy() -{ - PR_ASSERT(FALSE); -} -#endif - -//--------------------------------------------------------------------- - -void VFreebusy::selfCheck() -{ - // if no dtend, and there is a dtstart and duration, calculate dtend - if (!getDTEnd().isValid()) - { - // calculate DTEnd from duration and dtstart - // TODO: remove memory leaks in m_TempDuration - if (getDTStart().isValid() && m_TempDuration != 0 && m_TempDuration->isValid()) - { - DateTime end; - end = getDTStart(); - end.add(*m_TempDuration); - setDTEnd(end); - delete m_TempDuration; m_TempDuration = 0; // lifetime of variable is only - // after load. - } - else if (!getDTStart().isValid()) - { - if (m_TempDuration != 0) - delete m_TempDuration; m_TempDuration = 0; - } - } - - if (getFreebusy() != 0 && getDTStart().isValid() && getDTEnd().isValid()) - normalize(); - // if sequence is null, set to 0. - if (getSequence() == -1) - setSequence(0); -} - -//--------------------------------------------------------------------- - -void VFreebusy::combineSameFreebusies(JulianPtrArray * freebusies) -{ - t_int32 i = 0; - t_int32 j = 0; - Freebusy * f1 = 0; - Freebusy * f2 = 0; - - if (freebusies != 0 && freebusies->GetSize() >= 2) - { - // merge similar freebusy - for (i = 0; i < freebusies->GetSize() - 1; i++) - { - f1 = (Freebusy *) freebusies->GetAt(i); - for (j = i + 1; j < freebusies->GetSize() ; j++) - { - f2 = (Freebusy *) freebusies->GetAt(j); - if (Freebusy::HasSameParams(f1, f2)) - { - // add all periods in f1 into f2 - // remove f1 from freebusies. delete f1 - f1->addAllPeriods(f2->getPeriod()); - delete f2; f2 = 0; - freebusies->RemoveAt(j); - j--; - } - } - } - } -} - -//--------------------------------------------------------------------- -#if 0 -void VFreebusy::DEBUG_printFreebusyVector(const char * message, JulianPtrArray * freebusies) -{ -#if TESTING_ITIPRIG - if (TRUE) TRACE(message); -#endif - - UnicodeString sResult; - if (freebusies != 0) - { - t_int32 i; - UnicodeString s; - for (i = 0; i < freebusies->GetSize(); i++) - { - s = ((Freebusy *) freebusies->GetAt(i))->toICALString(s); - sResult += ICalProperty::multiLineFormat(s); - } - } - -#if TESTING_ITIPRIG - if (TRUE) TRACE("%s\r\n", sResult.toCString("")); -#endif -} -#endif -//--------------------------------------------------------------------- - -void VFreebusy::mergeSinglePeriodFreebusies() -{ - sortFreebusy(); - - // 1) combine same params freebusy - combineSameFreebusies(getFreebusy()); - //DEBUG_printFreebusyVector("after combining\r\n", getFreebusy()); - - // 2) normalize each freebusy (compress overlapping periods) - compressFreebusies(getFreebusy()); - //DEBUG_printFreebusyVector("after compressing\r\n", getFreebusy()); - - // 3) Unzip freebusies - unzipFreebusies(); - //DEBUG_printFreebusyVector("after unzipping\r\n", getFreebusy()); -} - -//--------------------------------------------------------------------- - -void VFreebusy::compressFreebusies(JulianPtrArray * freebusies) -{ - if (freebusies != 0) - { - t_int32 i; - Freebusy * f1 = 0; - for (i = 0; i < freebusies->GetSize(); i++) - { - f1 = (Freebusy *) freebusies->GetAt(i); - f1->normalizePeriods(); - } - } -} -//--------------------------------------------------------------------- - -void VFreebusy::unzipFreebusies() -{ - JulianPtrArray * freebusies = getFreebusy(); - if (freebusies != 0) - { - t_int32 oldSize = freebusies->GetSize(); - t_int32 i = 0; - t_int32 j = 0; - Freebusy * f1 = 0; - Freebusy * f2 = 0; - - for (i = oldSize - 1; i >= 0; i--) - { - f1 = (Freebusy *) freebusies->GetAt(i); - if (f1->getPeriod() != 0) - { - // foreach period in f1, create a new freebusy for it, - // add to freebusy vector - for (j = 0; j < f1->getPeriod()->GetSize(); j++) - { - f2 = new Freebusy(m_Log); - PR_ASSERT(f2 != 0); - if (f2 != 0) - { - f2->setType(f1->getType()); -#if 0 - f2->setStatus(f1->getStatus()); -#endif - f2->addPeriod((Period *) f1->getPeriod()->GetAt(j)); - addFreebusy(f2); - } - } - } - // now delete f1 - delete f1; f1 = 0; - freebusies->RemoveAt(i); - } - } -} - -//--------------------------------------------------------------------- -void VFreebusy::addExtraFreePeriodFreebusies(JulianPtrArray * freebusies) -{ - if (freebusies != 0) - { - Freebusy * fb; - Period *p; - t_int32 i = 0; - t_int32 j = 0; - t_int32 oldSize = freebusies->GetSize(); - if (getDTStart().isValid() && getDTEnd().isValid()) - { - sortFreebusy(); - DateTime startTime, nextTime, endTime; - startTime = getDTStart(); - nextTime = startTime; - - for (i = 0; i < oldSize; i++) - { - fb = (Freebusy *) freebusies->GetAt(i); - - PR_ASSERT(fb != 0 && fb->getPeriod()->GetSize() == 1); - - p = (Period *) fb->getPeriod()->GetAt(0); - - nextTime = p->getEndingTime(nextTime); - endTime = p->getStart(); - - if (startTime < endTime) - { - // add a new freebusy period - fb = new Freebusy(m_Log); PR_ASSERT(fb != 0); - fb->setType(Freebusy::FB_TYPE_FREE); -#if 0 - fb->setStatus(Freebusy::FB_STATUS_TENTATIVE); // for dbg -#endif - p = new Period(); - p->setStart(startTime); - p->setEnd(endTime); - fb->addPeriod(p); // ownership of p not taken, must delete - delete p; p = 0; - freebusies->Add(fb); // fb ownership taken - } - startTime = nextTime; - } - endTime = getDTEnd(); - if (nextTime < endTime) - { - // add final period - // add a new freebusy period - fb = new Freebusy(m_Log); PR_ASSERT(fb != 0); - fb->setType(Freebusy::FB_TYPE_FREE); -#if 0 - fb->setStatus(Freebusy::FB_STATUS_TENTATIVE); // for dbg -#endif - p = new Period(); - p->setStart(nextTime); - p->setEnd(endTime); - fb->addPeriod(p); // ownership of p not taken, must delete - delete p; p = 0; - freebusies->Add(fb); // fb ownership taken - } - sortFreebusy(); - } - } -} - -//--------------------------------------------------------------------- - -void VFreebusy::normalize() -{ - // 1) Can mergeSinglePeriodFreebusies first time - mergeSinglePeriodFreebusies(); - - // 2) I will now add FREE freebusy periods to those periods not already covered. - addExtraFreePeriodFreebusies(getFreebusy()); - //DEBUG_printFreebusyVector("----- after make free 4)\r\n", v); - - // 3) Combine consective free periods. This is OPTIONAL. - mergeSinglePeriodFreebusies(); - //DEBUG_printFreebusyVector("----- after merge-single-period freebusies 5)\r\n", v); - - sortFreebusy(); -} -//--------------------------------------------------------------------- - -void VFreebusy::sortFreebusy() -{ - if (m_FreebusyVctr != 0) - m_FreebusyVctr->QuickSort(Freebusy::CompareFreebusy); -} - -//--------------------------------------------------------------------- - -void VFreebusy::stamp() -{ - DateTime d; - setDTStamp(d); -} - -//--------------------------------------------------------------------- - -VFreebusy::VFreebusy(JLog * initLog) -: m_AttendeesVctr(0), m_CommentVctr(0), - /*m_Created(0), */ - /*m_Duration(0),*/ - m_TempDuration(0), - m_DTEnd(0), m_DTStart(0), m_DTStamp(0), m_FreebusyVctr(0), - m_LastModified(0), - m_Organizer(0), - m_RequestStatusVctr(0), - //m_RelatedToVctr(0), - m_Sequence(0), m_UID(0), - m_URL(0), - //m_URLVctr(0), - m_XTokensVctr(0), - m_ContactVctr(0), - m_Log(initLog) -{ - //PR_ASSERT(initLog != 0); -} - -//--------------------------------------------------------------------- - -VFreebusy::VFreebusy(VFreebusy & that) -: m_AttendeesVctr(0), m_CommentVctr(0), - /*m_Created(0),*/ - //m_Duration(0), - m_TempDuration(0), - m_DTEnd(0), m_DTStart(0), m_DTStamp(0), m_FreebusyVctr(0), - m_LastModified(0), - m_Organizer(0), - m_RequestStatusVctr(0), - //m_RelatedToVctr(0), - m_Sequence(0), m_UID(0), - m_URL(0), - //m_URLVctr(0), - m_ContactVctr(0), - m_XTokensVctr(0) -{ - if (that.m_AttendeesVctr != 0) - { - m_AttendeesVctr = new JulianPtrArray(); PR_ASSERT(m_AttendeesVctr != 0); - if (m_AttendeesVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_AttendeesVctr, m_AttendeesVctr, m_Log); - } - } - if (that.m_CommentVctr != 0) - { - m_CommentVctr = new JulianPtrArray(); PR_ASSERT(m_CommentVctr != 0); - if (m_CommentVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_CommentVctr, m_CommentVctr, m_Log); - } - } - if (that.m_ContactVctr != 0) - { - m_ContactVctr = new JulianPtrArray(); PR_ASSERT(m_ContactVctr != 0); - if (m_ContactVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_ContactVctr, m_ContactVctr, m_Log); - } - } - /* - if (that.m_Created != 0) - { - m_Created = that.m_Created->clone(m_Log); - } - */ - /* - if (that.m_Duration != 0) - { - m_Duration = that.m_Duration->clone(m_Log); - } - */ - if (that.m_DTEnd != 0) - { - m_DTEnd = that.m_DTEnd->clone(m_Log); - } - if (that.m_DTStart != 0) - { - m_DTStart = that.m_DTStart->clone(m_Log); - } - if (that.m_DTStamp != 0) - { - m_DTStamp = that.m_DTStamp->clone(m_Log); - } - if (that.m_FreebusyVctr != 0) - { - m_FreebusyVctr = new JulianPtrArray(); PR_ASSERT(m_FreebusyVctr != 0); - if (m_FreebusyVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_FreebusyVctr, m_FreebusyVctr, m_Log); - } - } - if (that.m_LastModified != 0) - { - m_LastModified = that.m_LastModified->clone(m_Log); - } - if (that.m_Organizer != 0) - { - m_Organizer = that.m_Organizer->clone(m_Log); - } - if (that.m_RequestStatusVctr != 0) - { - //m_RequestStatus = that.m_RequestStatus->clone(m_Log); - m_RequestStatusVctr = new JulianPtrArray(); PR_ASSERT(m_RequestStatusVctr != 0); - if (m_RequestStatusVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_RequestStatusVctr, m_RequestStatusVctr, m_Log); - } - } - if (that.m_Sequence != 0) - { - m_Sequence = that.m_Sequence->clone(m_Log); - } - if (that.m_UID != 0) - { - m_UID = that.m_UID->clone(m_Log); - } - if (that.m_URL != 0) - { - m_URL = that.m_URL->clone(m_Log); - } - if (that.m_XTokensVctr != 0) - { - m_XTokensVctr = new JulianPtrArray(); PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - ICalProperty::CloneUnicodeStringVector(that.m_XTokensVctr, m_XTokensVctr); - } - } -} - -//--------------------------------------------------------------------- - -ICalComponent * -VFreebusy::clone(JLog * initLog) -{ - m_Log = initLog; - //PR_ASSERT(m_Log != 0); - return new VFreebusy(*this); -} - -//--------------------------------------------------------------------- -VFreebusy::~VFreebusy() -{ - // datetime properties - /* - if (m_Created != 0) - { - delete m_Created; m_Created = 0; - } - */ - if (m_TempDuration != 0) - { - delete m_TempDuration; m_TempDuration = 0; - } - if (m_DTStart != 0) - { - delete m_DTStart; m_DTStart = 0; - } - if (m_DTStamp != 0) - { - delete m_DTStamp; m_DTStamp = 0; - } - if (m_LastModified != 0) - { - delete m_LastModified; m_LastModified = 0; - } - if (m_DTEnd != 0) - { - delete m_DTEnd; m_DTEnd = 0; - } - /* - if (m_Duration != 0) - { - delete m_Duration; m_Duration = 0; - } - */ - // string properties - if (m_RequestStatusVctr != 0) - { - //delete m_RequestStatus; m_RequestStatus = 0; - ICalProperty::deleteICalPropertyVector(m_RequestStatusVctr); - delete m_RequestStatusVctr; m_RequestStatusVctr = 0; - } - if (m_Organizer != 0) - { - delete m_Organizer; m_Organizer = 0; - } - if (m_UID != 0) - { - delete m_UID; m_UID = 0; - } - if (m_URL != 0) - { - delete m_URL; m_URL = 0; - } - - // integer properties - if (m_Sequence != 0) - { - delete m_Sequence; m_Sequence = 0; - } - - // attendees - if (m_AttendeesVctr != 0) { - ICalProperty::deleteICalPropertyVector(m_AttendeesVctr); - delete m_AttendeesVctr; m_AttendeesVctr = 0; - } - // freebusy - if (m_FreebusyVctr != 0) { - ICalProperty::deleteICalPropertyVector(m_FreebusyVctr); - delete m_FreebusyVctr; m_FreebusyVctr = 0; - } - - // string vectors - if (m_CommentVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_CommentVctr); - delete m_CommentVctr; m_CommentVctr = 0; - } - //if (m_RelatedToVctr != 0) { ICalProperty::deleteICalPropertyVector(m_RelatedToVctr); - // delete m_RelatedToVctr; m_RelatedToVctr = 0; } - //if (m_URLVctr != 0) { ICalProperty::deleteICalPropertyVector(m_URLVctr); - // delete m_URLVctr; m_URLVctr = 0; } - - if (m_ContactVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_ContactVctr); - delete m_ContactVctr; m_ContactVctr = 0; - } - if (m_XTokensVctr != 0) { ICalComponent::deleteUnicodeStringVector(m_XTokensVctr); - delete m_XTokensVctr; m_XTokensVctr = 0; - } -} -//--------------------------------------------------------------------- -UnicodeString & -VFreebusy::parse(ICalReader * brFile, UnicodeString & method, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones, - t_bool bIgnoreBeginError, nsCalUtility::MimeEncoding encoding) -{ - parseStatus = nsCalKeyword::Instance()->ms_sOK; - UnicodeString strLine, propName, propVal; - - JulianPtrArray * parameters = new JulianPtrArray(); - PR_ASSERT(parameters != 0 && brFile != 0); - if (parameters == 0 || brFile == 0) - { - // ran out of memory, return invalid VFreebusy - return parseStatus; - } - - ErrorCode status = ZERO_ERROR; - - setMethod(method); - - while (TRUE) - { - PR_ASSERT(brFile != 0); - brFile->readFullLine(strLine, status); - ICalProperty::Trim(strLine); - - if (FAILURE(status) && strLine.size() == 0) - break; - - ICalProperty::parsePropertyLine(strLine, propName, propVal, parameters); - - if (strLine.size() == 0) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - continue; - } - else if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0)) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - break; - } - else if ( - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - ((propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) && !bIgnoreBeginError )|| - ((propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) || - (ICalProperty::IsXToken(propVal))) - ) || - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - ((propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) || - (ICalProperty::IsXToken(propVal))) - ) - ) //else if - { - // break on - // END:VCALENDAR, VEVENT, VTODO, VJOURNAL, VTIMEZONE, x-token - // BEGIN:VEVENT, VTODO, VJOURNAL, VFREEBUSY, VTIMEZONE, VCALENDAR, x-token - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - parseStatus = strLine; - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iAbruptEndOfParsing, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 300); - break; - } - else - { -//#ifdef TIMING - //clock_t start, end; - //start = clock(); -//#endif - storeData(strLine, propName, propVal, parameters, vTimeZones); -//#ifdef TIMING - //end = clock(); - //double d = end - start; - //if (FALSE) TRACE("storeData on %s took %f ms.\r\n", propName.toCString(""), d); -//#endif - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - } - } - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - delete parameters; parameters = 0; - - selfCheck(); // sorts freebusy vector as well - return parseStatus; -} -//--------------------------------------------------------------------- -t_bool -VFreebusy::storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters, - JulianPtrArray * vTimeZones) -{ - t_int32 hashCode = propName.hashCode(); - t_int32 i; - for (i = 0; 0 != (JulianFunctionTable::Instance()->vfStoreTable[i]).op; i++) - { - if ((JulianFunctionTable::Instance()->vfStoreTable[i]).hashCode == hashCode) - { - ApplyStoreOp(((JulianFunctionTable::Instance())->vfStoreTable[i]).op, - strLine, propVal, parameters, vTimeZones); - return TRUE; - } - } - if (ICalProperty::IsXToken(propName)) - { - addXTokens(strLine); - return TRUE; - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyName, - nsCalKeyword::Instance()->ms_sVFREEBUSY, propName, 200); - UnicodeString u; - u = nsCalLogErrorMessage::Instance()->ms_sRS202; - u += '.'; u += ' '; - u += strLine; - //setRequestStatus(nsCalLogErrorMessage::Instance()->ms_iRS202); - addRequestStatus(u); - return FALSE; - } - return FALSE; -} -//--------------------------------------------------------------------- -void VFreebusy::storeAttendees(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - Attendee * attendee = new Attendee(GetType(), m_Log); - PR_ASSERT(attendee != 0); - if (attendee != 0) - { - attendee->parse(propVal, parameters); - if (!attendee->isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidAttendee, - nsCalKeyword::Instance()->ms_sVFREEBUSY, propVal, 200); - UnicodeString u; - u = nsCalLogErrorMessage::Instance()->ms_sRS202; - u += '.'; u += ' '; - u += strLine; - //setRequestStatus(nsCalLogErrorMessage::Instance()->ms_iRS202); - addRequestStatus(u); - delete attendee; attendee = 0; - } - else - { - addAttendee(attendee); - } - } -} -void VFreebusy::storeComment(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRange, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRangeSize); - - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - addComment(propVal, parameters); -} -void VFreebusy::storeContact(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRange, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - addContact(propVal, parameters); -} -/* -void VFreebusy::storeCreated(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - - if (getCreatedProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sCREATED, 100); - } - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setCreated(d , parameters); -} -*/ -void VFreebusy::storeDuration(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - - if (m_TempDuration != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sDURATION, 100); - } - //Duration d(propVal); - if (m_TempDuration == 0) - { - m_TempDuration = new nsCalDuration(propVal); - PR_ASSERT(m_TempDuration != 0); - } - else - m_TempDuration->setDurationString(propVal); -} -void VFreebusy::storeDTEnd(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters (MUST BE IN UTC) - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - - // DTEND must be in UTC - if (getDTEndProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sDTEND, 100); - } - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setDTEnd(d, parameters); -} -void VFreebusy::storeDTStart(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters (MUST BE IN UTC) - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - - // DTSTART must be in UTC - if (getDTStartProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sDTSTART, 100); - } - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setDTStart(d, parameters); -} -void VFreebusy::storeDTStamp(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters (MUST BE IN UTC) - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - - if (getDTStampProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sDTSTAMP, 100); - } - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setDTStamp(d, parameters); -} -void VFreebusy::storeFreebusy(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // Freebusy must be in UTC - Freebusy * freeb = new Freebusy(m_Log); - PR_ASSERT(freeb != 0); - if (freeb != 0) - { - freeb->parse(propVal, parameters, vTimeZones); - if (!freeb->isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidFreebusy, 200); - UnicodeString u; - u = nsCalLogErrorMessage::Instance()->ms_sRS202; - u += '.'; u += ' '; - u += strLine; - //setRequestStatus(nsCalLogErrorMessage::Instance()->ms_iRS202); - addRequestStatus(u); - delete freeb; freeb = 0; - } - else - { - addFreebusy(freeb); - } - } -} -void VFreebusy::storeLastModified(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters (MUST BE IN UTC) - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - - if (getLastModified().getTime() >= 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sLASTMODIFIED, 100); - } - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setLastModified(d, parameters); -} -void VFreebusy::storeOrganizer(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asSentByParamRange, - nsCalAtomRange::Instance()->ms_asSentByParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - - if (getOrganizerProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sORGANIZER, 100); - } - setOrganizer(propVal, parameters); -} -void VFreebusy::storeRequestStatus(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asLanguageParamRange, - nsCalAtomRange::Instance()->ms_asLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } -#if 0 - /* Don't print duplicated property on Request Status */ - if (getRequestStatusProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sREQUESTSTATUS, 100); - } - -#endif - addRequestStatus(propVal, parameters); -} -void VFreebusy::storeSequence(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParseError = FALSE; - t_int32 i; - - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - - char * pcc = propVal.toCString(""); - PR_ASSERT(pcc != 0); - i = nsCalUtility::atot_int32(pcc, bParseError, propVal.size()); - delete [] pcc; pcc = 0; - if (getSequenceProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sSEQUENCE, 100); - } - if (!bParseError) - { - setSequence(i, parameters); - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidNumberFormat, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sSEQUENCE, propVal, 200); - } -} -void VFreebusy::storeUID(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - if (getUIDProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sUID, 100); - } - setUID(propVal, parameters); -} -void VFreebusy::storeURL(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVFREEBUSY, strLine, 100); - } - if (getURLProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVFREEBUSY, - nsCalKeyword::Instance()->ms_sURL, 100); - } - setURL(propVal, parameters); - //addURL(propVal, parameters); -} -//--------------------------------------------------------------------- -t_bool VFreebusy::isValid() -{ - DateTime dS, dE; - dS = getDTStart(); - dE = getDTEnd(); - - // TODO: handle bad method names - - if (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sPUBLISH) == 0) - { - // publish must have dtstamp - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingStartingTime, 300); - return FALSE; - } - - // MUST have organizer - if (getOrganizer().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingOrganizer, 300); - return FALSE; - } - } - else if (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREQUEST) == 0) - { - // publish must have dtstamp - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - // TODO: must have requested attendee address - if (getAttendees() == 0 || getAttendees()->GetSize() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingAttendees, 300); - return FALSE; - } - - // must have organizer - if (getOrganizer().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingOrganizer, 300); - return FALSE; - } - - // must have start, end - if (!dS.isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingStartingTime, 300); - return FALSE; - } - if (!dE.isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingEndingTime, 300); - return FALSE; - } - if (dS.afterDateTime(dE)) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iEndBeforeStartTime, 300); - return FALSE; - } - } - else if (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREPLY) == 0) - { - // both request and reply must have valid dtstamp and a UID - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - - // TODO: must have recipient replying address - if (getAttendees() == 0 || getAttendees()->GetSize() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingAttendees, 300); - return FALSE; - } - // must have originator' organizer address - if (getOrganizer().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingOrganizer, 300); - return FALSE; - } - // must have start, end - if (!dS.isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingStartingTime, 300); - return FALSE; - } - if (!dE.isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingEndingTime, 300); - return FALSE; - } - if (dS.afterDateTime(dE)) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iEndBeforeStartTime, 300); - return FALSE; - } - } - - /* - // both request and reply must have valid dtstamp and a UID - if ((!getDTStamp().isValid()) || (getUID().size() == 0)) - return FALSE; - - // sequence must be >= 0 - if (getSequence() < 0) - return FALSE; - - // if a reply - if (dS.isValid() || dE.isValid()) - { - // ds and de must be valid and dS cannot be after dE - if (!dS.isValid() || !dE.isValid() || dS.afterDateTime(dE)) - return FALSE; - } - */ - - return TRUE; -} -//--------------------------------------------------------------------- -UnicodeString VFreebusy::toICALString() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVFreebusyAllMessage, ""); -} -//--------------------------------------------------------------------- -UnicodeString VFreebusy::toICALString(UnicodeString sMethod, - UnicodeString sName, - t_bool isRecurring) -{ - // NOTE: Remove later, to avoid warnings - if (isRecurring) {} - - if (sMethod.compareIgnoreCase(nsCalKeyword::Instance()->ms_sPUBLISH) == 0) - return formatHelper(nsCalFormatString::Instance()->ms_sVFreebusyPublishMessage, ""); - else if (sMethod.compareIgnoreCase(nsCalKeyword::Instance()->ms_sREQUEST) == 0) - return formatHelper(nsCalFormatString::Instance()->ms_sVFreebusyRequestMessage, ""); - else if (sMethod.compareIgnoreCase(nsCalKeyword::Instance()->ms_sREPLY) == 0) - return formatHelper(nsCalFormatString::Instance()->ms_sVFreebusyReplyMessage, sName); - else - return toICALString(); -} -//--------------------------------------------------------------------- -UnicodeString VFreebusy::toString() -{ - return ICalComponent::toStringFmt( - nsCalFormatString::Instance()->ms_VFreebusyStrDefaultFmt); -} -//--------------------------------------------------------------------- -UnicodeString VFreebusy::formatHelper(UnicodeString & strFmt, UnicodeString sFilterAttendee) -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sVFREEBUSY; - return ICalComponent::format(u, strFmt, sFilterAttendee); -} -//--------------------------------------------------------------------- -UnicodeString -VFreebusy::formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString sResult, s; - t_int32 i; - JulianPtrArray * v; - - // NOTE: remove later, kept in to remove compiler warning - if (delegateRequest) - { - } - - switch (c) - { - case ms_cAttendees: - { - v = getAttendees(); - if (v != 0) - { - if (sFilterAttendee.size() > 0) - { - Attendee * a = getAttendee(sFilterAttendee); - if (a != 0) - s = a->toICALString(s); - else - s = ""; - sResult += ICalProperty::multiLineFormat(s); - } - else - { - for (i=0; i< v->GetSize(); i++) - { - s = ((Attendee * ) v->GetAt(i))->toICALString(s); - sResult += ICalProperty::multiLineFormat(s); - } - } - } - return sResult; - } - case ms_cFreebusy: - s = nsCalKeyword::Instance()->ms_sFREEBUSY; - return ICalProperty::propertyVectorToICALString(s, getFreebusy(), sResult); - case ms_cComment: - s = nsCalKeyword::Instance()->ms_sCOMMENT; - return ICalProperty::propertyVectorToICALString(s, getComment(), sResult); - case ms_cContact: - s = nsCalKeyword::Instance()->ms_sCONTACT; - return ICalProperty::propertyVectorToICALString(s, getContact(), sResult); - /* - case ms_cCreated: - s = nsCalKeyword::Instance()->ms_sCREATED; - return ICalProperty::propertyToICALString(s, getCreatedProperty(), sResult); - */ - case ms_cDTEnd: - s = nsCalKeyword::Instance()->ms_sDTEND; - return ICalProperty::propertyToICALString(s, getDTEndProperty(), sResult); - case ms_cDuration: - s = nsCalKeyword::Instance()->ms_sDURATION; - s += ':'; - s += getDuration().toICALString(); - s += nsCalKeyword::Instance()->ms_sLINEBREAK; - return s; - case ms_cDTStart: - s = nsCalKeyword::Instance()->ms_sDTSTART; - return ICalProperty::propertyToICALString(s, getDTStartProperty(), sResult); - case ms_cDTStamp: - s = nsCalKeyword::Instance()->ms_sDTSTAMP; - return ICalProperty::propertyToICALString(s, getDTStampProperty(), sResult); - //case ms_cRelatedTo: - // s = nsCalKeyword::Instance()->ms_sRELATEDTO; - // return ICalProperty::propertyVectorToICALString(s, getRelatedTo(), sResult); - case ms_cOrganizer: - s = nsCalKeyword::Instance()->ms_sORGANIZER; - return ICalProperty::propertyToICALString(s, getOrganizerProperty(), sResult); - case ms_cRequestStatus: - s = nsCalKeyword::Instance()->ms_sREQUESTSTATUS; - //return ICalProperty::propertyToICALString(s, getRequestStatusProperty(), sResult); - return ICalProperty::propertyVectorToICALString(s, getRequestStatus(), sResult); - case ms_cSequence: - s = nsCalKeyword::Instance()->ms_sSEQUENCE; - return ICalProperty::propertyToICALString(s, getSequenceProperty(), sResult); - case ms_cUID: - s = nsCalKeyword::Instance()->ms_sUID; - return ICalProperty::propertyToICALString(s, getUIDProperty(), sResult); - case ms_cURL: - s = nsCalKeyword::Instance()->ms_sURL; - //return ICalProperty::propertyVectorToICALString(s, getURL(), sResult); - return ICalProperty::propertyToICALString(s, getURLProperty(), sResult); - case ms_cXTokens: - return ICalProperty::vectorToICALString(getXTokens(), sResult); - default: - { - //DebugMsg.Instance().println(0,"No such member in VFreebusy"); - //sResult = ParserUtil.multiLineFormat(sResult); - return ""; - } - } -} -//--------------------------------------------------------------------- -UnicodeString VFreebusy::toStringChar(t_int32 c, UnicodeString & dateFmt) -{ - - UnicodeString sResult; - - switch(c) - { - case ms_cAttendees: - return ICalProperty::propertyVectorToString(getAttendees(), dateFmt, sResult); - /* - case ms_cCreated: - return ICalProperty::propertyToString(getCreatedProperty(), dateFmt, sResult); - */ - case ms_cContact: - return ICalProperty::propertyVectorToString(getContact(), dateFmt, sResult); - case ms_cDuration: - return getDuration().toString(); - //return ICalProperty::propertyToString(getDurationProperty(), dateFmt, sResult); - case ms_cDTEnd: - return ICalProperty::propertyToString(getDTEndProperty(), dateFmt, sResult); - case ms_cDTStart: - return ICalProperty::propertyToString(getDTStartProperty(), dateFmt, sResult); - case ms_cDTStamp: - return ICalProperty::propertyToString(getDTStampProperty(), dateFmt, sResult); - case ms_cLastModified: - return ICalProperty::propertyToString(getLastModifiedProperty(), dateFmt, sResult); - case ms_cOrganizer: - return ICalProperty::propertyToString(getOrganizerProperty(), dateFmt, sResult); - case ms_cRequestStatus: - //return ICalProperty::propertyToString(getRequestStatusProperty(), dateFmt, sResult); - return ICalProperty::propertyVectorToString(getRequestStatus(), dateFmt, sResult); - case ms_cSequence: - return ICalProperty::propertyToString(getSequenceProperty(), dateFmt, sResult); - case ms_cUID: - return ICalProperty::propertyToString(getUIDProperty(), dateFmt, sResult); - case ms_cURL: - return ICalProperty::propertyToString(getURLProperty(), dateFmt, sResult); - case ms_cFreebusy: - return ICalProperty::propertyVectorToString(getFreebusy(), dateFmt, sResult); - default: - { - return ""; - } - } -} -//--------------------------------------------------------------------- -t_bool VFreebusy::MatchUID_seqNO(UnicodeString sUID, t_int32 iSeqNo) -{ - //t_int32 seq = getSequence(); - //UnicodeString uid = getUID(); - - if (getSequence() == iSeqNo && getUID().compareIgnoreCase(sUID) == 0) - return TRUE; - else - return FALSE; -} - -//--------------------------------------------------------------------- -#if 0 -void -VFreebusy::setAttendeeStatus(UnicodeString & sAttendeeFilter, - Attendee::STATUS status, - JulianPtrArray * delegatedTo) -{ - Attendee * a; - a = getAttendee(sAttendeeFilter); - if (a == 0) - { - // add a new attendee to this event (a partycrasher) - a = Attendee::getDefault(GetType()); - PR_ASSERT(a != 0); - if (a != 0) - { - a->setName(sAttendeeFilter); - addAttendee(a); - } - } - PR_ASSERT(a != 0); - if (a != 0) - { - a->setStatus(status); - if (status == Attendee::STATUS_DELEGATED) - { - if (delegatedTo != 0) - { - t_int32 i; - UnicodeString u; - // for each new attendee, set name, role = req_part, delfrom = me, - // rsvp = TRUE, expect = request, status = needs-action. - for (i = 0; i < delegatedTo->GetSize(); i++) - { - u = *((UnicodeString *) delegatedTo->GetAt(i)); - a->addDelegatedTo(u); - - Attendee * delegate = Attendee::getDefault(GetType(), m_Log); - PR_ASSERT(delegate != 0); - if (delegate != 0) - { - delegate->setName(u); - delegate->setRole(Attendee::ROLE_REQ_PARTICIPANT); - delegate->addDelegatedFrom(sAttendeeFilter); - delegate->setRSVP(Attendee::RSVP_TRUE); - delegate->setExpect(Attendee::EXPECT_REQUEST); - delegate->setStatus(Attendee::STATUS_NEEDSACTION); - addAttendee(delegate); - } - } - } - } - } -} -#endif -//--------------------------------------------------------------------- - -Attendee * -VFreebusy::getAttendee(UnicodeString sAttendee) -{ - return Attendee::getAttendee(getAttendees(), sAttendee); -} - -//--------------------------------------------------------------------- - -int -VFreebusy::CompareVFreebusyByUID(const void * a, - const void * b) -{ - PR_ASSERT(a != 0 && b != 0); - VFreebusy * ta = *(VFreebusy **) a; - VFreebusy * tb = *(VFreebusy **) b; - - return (int) ta->getUID().compare(tb->getUID()); -} - -//--------------------------------------------------------------------- - -int -VFreebusy::CompareVFreebusyByDTStart(const void * a, - const void * b) -{ - PR_ASSERT(a != 0 && b != 0); - VFreebusy * ta = *(VFreebusy **) a; - VFreebusy * tb = *(VFreebusy **) b; - - DateTime da, db; - da = ta->getDTStart(); - db = tb->getDTStart(); - - return (int) (da.compareTo(db)); -} - -//--------------------------------------------------------------------- - -void VFreebusy::removeAllFreebusy() -{ - if (m_FreebusyVctr != 0) - { - ICalProperty::deleteICalPropertyVector(m_FreebusyVctr); - delete m_FreebusyVctr; m_FreebusyVctr = 0; - } -} -//--------------------------------------------------------------------- -#if 0 -t_bool -VFreebusy::isMoreRecent(VFreebusy * component) -{ - // component is not NULL - PR_ASSERT(component != 0); - - if (component != 0) - { - t_bool bHasSeq; - t_bool bHasDTStamp; - - t_int32 iSeq, jSeq; - DateTime idts, jdts; - - iSeq = getSequence(); - idts = getDTStamp(); - - jSeq = component->getSequence(); - jdts = component->getDTStamp(); - - // both components must have sequence and DTSTAMP - bHasSeq = (iSeq >= 0 && jSeq >= 0); - bHasDTStamp = (idts.isValid() && jdts.isValid()); - - PR_ASSERT(bHasSeq); - PR_ASSERT(bHasDTStamp); - - // if iSeq > jSeq return TRUE - // else if iSeq < jSeq return FALSE - // else if iSeq == jSeq - // { - // else if jdts is after idts return FALSE - // else if jdts is before idts return TRUE - // else (dts is equal to idts) return TRUE - // } - - if (component != 0 && bHasSeq && bHasDTStamp) - { - if (iSeq > jSeq) - { - return TRUE; - } - else if (iSeq < jSeq) - { - return FALSE; - } - else - { - return !(jdts.afterDateTime(idts)); - } - } - } - // assert failed - return FALSE; -} -#endif -//--------------------------------------------------------------------- - -void -VFreebusy::updateComponentHelper(VFreebusy * updatedComponent) -{ - // no created, last-modified, UID - DateTime d; - ICalComponent::internalSetPropertyVctr(&m_AttendeesVctr, updatedComponent->getAttendees()); - ICalComponent::internalSetPropertyVctr(&m_CommentVctr, updatedComponent->getComment()); - ICalComponent::internalSetPropertyVctr(&m_ContactVctr, updatedComponent->getContact()); - ICalComponent::internalSetPropertyVctr(&m_FreebusyVctr, updatedComponent->getFreebusy()); - //ICalComponent::internalSetPropertyVctr(&m_RelatedToVctr, updatedComponent->getRelatedTo()); - //ICalComponent::internalSetPropertyVctr(&m_URLVctr, updatedComponent->getURL()); - ICalComponent::internalSetProperty(&m_DTStart, updatedComponent->m_DTStart); - ICalComponent::internalSetProperty(&m_DTEnd, updatedComponent->m_DTEnd); - ICalComponent::internalSetProperty(&m_DTStamp, updatedComponent->m_DTStamp); - ICalComponent::internalSetProperty(&m_Organizer, updatedComponent->m_Organizer); - //ICalComponent::internalSetPropertyVctr(&m_RequestStatusVctr, updatedComponent->getRequestStatus()); - ICalComponent::internalSetProperty(&m_Sequence, updatedComponent->m_Sequence); - ICalComponent::internalSetProperty(&m_URL, updatedComponent->m_URL); - ICalComponent::internalSetXTokensVctr(&m_XTokensVctr, updatedComponent->m_XTokensVctr); - - ICalComponent::internalSetProperty(&m_LastModified, updatedComponent->m_LastModified); - //setLastModified(d); -} - -//--------------------------------------------------------------------- - -t_bool -VFreebusy::updateComponent(ICalComponent * updatedComponent) -{ - if (updatedComponent != 0) - { - ICAL_COMPONENT ucType = updatedComponent->GetType(); - - // only call updateComponentHelper if it's a VFreebusy and - // it is an exact matching UID and updatedComponent - // is more recent than this component - if (ucType == ICAL_COMPONENT_VFREEBUSY) - { - // should be a safe cast with check above. - VFreebusy * ucvf = (VFreebusy *) updatedComponent; - - // only if uid's match and are not empty - if (ucvf->getUID().size() > 0 && getUID().size() > 0) - { - //if (ucvf->getUID() == getUID() && !isMoreRecent(ucvf)) - if (ucvf->getUID() == getUID()) - { - updateComponentHelper(ucvf); - return TRUE; - } - } - } - } - return FALSE; -} -//--------------------------------------------------------------------- -// GETTERS AND SETTERS here -//--------------------------------------------------------------------- -// attendee -void VFreebusy::addAttendee(Attendee * a) -{ - if (m_AttendeesVctr == 0) - m_AttendeesVctr = new JulianPtrArray(); - PR_ASSERT(m_AttendeesVctr != 0); - if (m_AttendeesVctr != 0) - { - m_AttendeesVctr->Add(a); - } -} -//--------------------------------------------------------------------- -// freebusy -void VFreebusy::addFreebusy(Freebusy * f) -{ - if (m_FreebusyVctr == 0) - m_FreebusyVctr = new JulianPtrArray(); - PR_ASSERT(m_FreebusyVctr != 0); - if (m_FreebusyVctr != 0) - { - m_FreebusyVctr->Add(f); - } -} -//--------------------------------------------------------------------- -///DTEnd -void VFreebusy::setDTEnd(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_DTEnd == 0) - m_DTEnd = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_DTEnd->setValue((void *) &s); - m_DTEnd->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_DTEnd), s, parameters); -#endif -} -DateTime VFreebusy::getDTEnd() const -{ -#if 1 - DateTime d(-1); - if (m_DTEnd == 0) - return d; //return 0; - else - { - d = *((DateTime *) m_DTEnd->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_DTEnd), d); - return d; -#endif -} -//--------------------------------------------------------------------- -///nsCalDuration -void VFreebusy::setDuration(nsCalDuration s, JulianPtrArray * parameters) -{ - /* - if (m_Duration == 0) - m_Duration = ICalPropertyFactory::Make(ICalProperty::DURATION, - (void *) &s, parameters); - else - { - m_Duration->setValue((void *) &s); - m_Duration->setParameters(parameters); - } - */ - // NOTE: remove later, to avoid compiler warnings - if (parameters) - { - } - - - DateTime end; - end = getDTStart(); - end.add(s); - setDTEnd(end); -} -nsCalDuration VFreebusy::getDuration() const -{ - /* - nsCalDuration d; d.set(-1,-1,-1,-1,-1,-1); - if (m_Duration == 0) - return d; // return 0; - else - { - d = *((nsCalDuration *) m_Duration->getValue()); - return d; - } - */ - nsCalDuration duration; - DateTime start, end; - start = getDTStart(); - end = getDTEnd(); - DateTime::getDuration(start,end,duration); - return duration; -} -//--------------------------------------------------------------------- -//LAST-MODIFIED -void VFreebusy::setLastModified(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_LastModified == 0) - m_LastModified = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_LastModified->setValue((void *) &s); - m_LastModified->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_LastModified), s, parameters); -#endif -} - -DateTime VFreebusy::getLastModified() const -{ -#if 1 - DateTime d(-1); - if (m_LastModified == 0) - return d; // return 0; - else - { - d = *((DateTime *) m_LastModified->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_LastModified), d); - return d; -#endif -} -//--------------------------------------------------------------------- -#if 0 -//Created -void VFreebusy::setCreated(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_Created == 0) - m_Created = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_Created->setValue((void *) &s); - m_Created->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_Created), s, parameters); -#endif -} -DateTime VFreebusy::getCreated() const -{ -#if 1 - DateTime d(-1); - if (m_Created == 0) - return d;//return 0; - else - { - d = *((DateTime *) m_Created->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_Created), d); - return d; -#endif -} -#endif -//--------------------------------------------------------------------- -//DTStamp -void VFreebusy::setDTStamp(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_DTStamp == 0) - m_DTStamp = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_DTStamp->setValue((void *) &s); - m_DTStamp->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_DTStamp), s, parameters); -#endif -} -DateTime VFreebusy::getDTStamp() const -{ -#if 1 - DateTime d(-1); - if (m_DTStamp == 0) - return d;//return 0; - else - { - d = *((DateTime *) m_DTStamp->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_DTStamp), d); - return d; -#endif -} -//--------------------------------------------------------------------- -///DTStart -void VFreebusy::setDTStart(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_DTStart == 0) - m_DTStart = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_DTStart->setValue((void *) &s); - m_DTStart->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_DTStart), s, parameters); -#endif -} - -DateTime VFreebusy::getDTStart() const -{ -#if 1 - DateTime d(-1); - if (m_DTStart == 0) - return d; //return 0; - else - { - d = *((DateTime *) m_DTStart->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_DTStart), d); - return d; -#endif -} -//--------------------------------------------------------------------- -//Organizer -void VFreebusy::setOrganizer(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Organizer == 0) - { - //m_Organizer = ICalPropertyFactory::Make(ICalProperty::TEXT, - // (void *) &s, parameters); - - m_Organizer = (ICalProperty *) new nsCalOrganizer(m_Log); - PR_ASSERT(m_Organizer != 0); - m_Organizer->setValue((void *) &s); - m_Organizer->setParameters(parameters); - } - else - { - m_Organizer->setValue((void *) &s); - m_Organizer->setParameters(parameters); - } -} -UnicodeString VFreebusy::getOrganizer() const -{ - UnicodeString u; - if (m_Organizer == 0) - return ""; - else { - u = *((UnicodeString *) m_Organizer->getValue()); - return u; - } -} -//--------------------------------------------------------------------- -//RequestStatus -#if 0 -void VFreebusy::setRequestStatus(UnicodeString s, JulianPtrArray * parameters) -{ - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_RequestStatus == 0) - m_RequestStatus = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_RequestStatus->setValue((void *) &s); - m_RequestStatus->setParameters(parameters); - } -} -UnicodeString VFreebusy::getRequestStatus() const -{ - UnicodeString u; - if (m_RequestStatus == 0) - return ""; - else - { - u = *((UnicodeString *) m_RequestStatus->getValue()); - return u; - } -} -#endif -void VFreebusy::addRequestStatus(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - addRequestStatusProperty(prop); -} -void VFreebusy::addRequestStatusProperty(ICalProperty * prop) -{ - if (m_RequestStatusVctr == 0) - m_RequestStatusVctr = new JulianPtrArray(); - PR_ASSERT(m_RequestStatusVctr != 0); - m_RequestStatusVctr->Add(prop); -} -//--------------------------------------------------------------------- -//UID -void VFreebusy::setUID(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_UID == 0) - m_UID = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_UID->setValue((void *) &s); - m_UID->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_UID), s, parameters); -#endif -} -UnicodeString VFreebusy::getUID() const -{ -#if 1 - UnicodeString u; - if (m_UID == 0) - return ""; - else { - u = *((UnicodeString *) m_UID->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_UID), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//Sequence -void VFreebusy::setSequence(t_int32 i, JulianPtrArray * parameters) -{ -#if 1 - if (m_Sequence == 0) - m_Sequence = ICalPropertyFactory::Make(ICalProperty::INTEGER, - (void *) &i, parameters); - else - { - m_Sequence->setValue((void *) &i); - m_Sequence->setParameters(parameters); - } -#else - ICalComponent::setIntegerValue(((ICalProperty **) &m_Sequence), i, parameters); -#endif -} -t_int32 VFreebusy::getSequence() const -{ -#if 1 - t_int32 i; - if (m_Sequence == 0) - return -1; - else - { - i = *((t_int32 *) m_Sequence->getValue()); - return i; - } -#else - t_int32 i = -1; - ICalComponent::getIntegerValue(((ICalProperty **) &m_Sequence), i); - return i; -#endif -} -//--------------------------------------------------------------------- -//comment -void VFreebusy::addComment(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - addCommentProperty(prop); -} -void VFreebusy::addCommentProperty(ICalProperty * prop) -{ - if (m_CommentVctr == 0) - m_CommentVctr = new JulianPtrArray(); - PR_ASSERT(m_CommentVctr != 0); - if (m_CommentVctr != 0) - { - m_CommentVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -// Contact -void VFreebusy::addContact(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *)&s, parameters); - addContactProperty(prop); -} -void VFreebusy::addContactProperty(ICalProperty * prop) -{ - if (m_ContactVctr == 0) - m_ContactVctr = new JulianPtrArray(); - PR_ASSERT(m_ContactVctr != 0); - if (m_ContactVctr != 0) - { - m_ContactVctr->Add(prop); - } -} -//--------------------------------------------------------------------- -// RelatedTo -//void VFreebusy::addRelatedTo(UnicodeString s, JulianPtrArray * parameters) -//{ -// ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, -// (void *) &s, parameters); -// addRelatedToProperty(prop); -//} -//void VFreebusy::addRelatedToProperty(ICalProperty * prop) -//{ -// if (m_RelatedToVctr == 0) -// m_RelatedToVctr = new JulianPtrArray(); -// PR_ASSERT(m_RelatedToVctr != 0); -// m_RelatedToVctr->Add(prop); -//} -//--------------------------------------------------------------------- -// URL -//void VFreebusy::addURL(UnicodeString s, JulianPtrArray * parameters) -//{ -// ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, -// (void *) &s, parameters); -// addURLProperty(prop); -//} -//void VFreebusy::addURLProperty(ICalProperty * prop) -//{ -// if (m_URLVctr == 0) -// m_URLVctr = new JulianPtrArray(); -// PR_ASSERT(m_URLVctr != 0); -// m_URLVctr->Add(prop); -//} -void VFreebusy::setURL(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_URL == 0) - m_URL = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_URL->setValue((void *) &s); - m_URL->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_URL), s, parameters); -#endif -} -UnicodeString VFreebusy::getURL() const -{ -#if 1 - UnicodeString u; - if (m_URL == 0) - return ""; - else { - u = *((UnicodeString *) m_URL->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_URL), us); - return us; -#endif -} -//--------------------------------------------------------------------- -// XTOKENS -void VFreebusy::addXTokens(UnicodeString s) -{ - if (m_XTokensVctr == 0) - m_XTokensVctr = new JulianPtrArray(); - PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - m_XTokensVctr->Add(new UnicodeString(s)); - } -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/ical/src/vjournal.cpp b/mozilla/calendar/modules/core/ical/src/vjournal.cpp deleted file mode 100644 index 812e5b54dfb..00000000000 --- a/mozilla/calendar/modules/core/ical/src/vjournal.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * vjournal.cpp - * John Sun - * 4/23/98 10:33:36 AM - */ - -#include "stdafx.h" -#include "jdefines.h" - -#include "jutility.h" -#include "vjournal.h" -#include "icalredr.h" -#include "prprtyfy.h" -#include "unistrto.h" -#include "jlog.h" -#include "vtimezne.h" -#include "keyword.h" -#include "period.h" -#include "datetime.h" - -//--------------------------------------------------------------------- -void VJournal::setDefaultFmt(UnicodeString s) -{ - nsCalFormatString::Instance()->ms_VJournalStrDefaultFmt = s; -} -//--------------------------------------------------------------------- -#if 0 -VJournal::VJournal() -{ - PR_ASSERT(FALSE); -} -#endif -//--------------------------------------------------------------------- - -VJournal::VJournal(JLog * initLog) -: TimeBasedEvent(initLog) -{ -} - -//--------------------------------------------------------------------- - -VJournal::VJournal(VJournal & that) -: TimeBasedEvent(that) -{ -} - -//--------------------------------------------------------------------- - -ICalComponent * -VJournal::clone(JLog * initLog) -{ - m_Log = initLog; - return new VJournal(*this); -} - -//--------------------------------------------------------------------- - -VJournal::~VJournal() -{ - // should call TimeBasedEvent destructor -} - -//--------------------------------------------------------------------- - -UnicodeString & -VJournal::parse(ICalReader * brFile, UnicodeString & sMethod, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones, - t_bool bIgnoreBeginError, nsCalUtility::MimeEncoding encoding) -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sVJOURNAL; - return parseType(u, brFile, sMethod, parseStatus, vTimeZones, bIgnoreBeginError, encoding); -} - -//--------------------------------------------------------------------- - -Date VJournal::difference() -{ - return 0; -} - -//--------------------------------------------------------------------- - -void VJournal::selfCheck() -{ - TimeBasedEvent::selfCheck(); - if (getStatus().size() > 0) - { - // check if I got a valid status - UnicodeString u = getStatus(); - u.toUpper(); - ICalProperty::Trim(u); - JAtom ua(u); - if ((nsCalKeyword::Instance()->ms_ATOM_DRAFT!= ua) && - (nsCalKeyword::Instance()->ms_ATOM_FINAL != ua) && - (nsCalKeyword::Instance()->ms_ATOM_CANCELLED != ua)) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyValue, - nsCalKeyword::Instance()->ms_sVJOURNAL, - nsCalKeyword::Instance()->ms_sSTATUS, u, 200); - - setStatus(""); - } - } -} - -//--------------------------------------------------------------------- - -t_bool -VJournal::storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters, - JulianPtrArray * vTimeZones) -{ - if (TimeBasedEvent::storeData(strLine, propName, propVal, - parameters, vTimeZones)) - return TRUE; - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyName, - nsCalKeyword::Instance()->ms_sVJOURNAL, propName, 200); - UnicodeString u; - u = nsCalLogErrorMessage::Instance()->ms_sRS202; - u += '.'; u += ' '; - u += strLine; - //setRequestStatus(nsCalLogErrorMessage::Instance()->ms_iRS202); - addRequestStatus(u); - return FALSE; - } -} - -//--------------------------------------------------------------------- - -void VJournal::populateDatesHelper(DateTime start, Date ldiff, - JulianPtrArray * vPeriods) -{ -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::formatHelper(UnicodeString & strFmt, - UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sVJOURNAL; - return ICalComponent::format(u, strFmt, sFilterAttendee, delegateRequest); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::toString() -{ - return ICalComponent::toStringFmt( - nsCalFormatString::Instance()->ms_VJournalStrDefaultFmt); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::toStringChar(t_int32 c, UnicodeString & dateFmt) -{ - return TimeBasedEvent::toStringChar(c, dateFmt); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - return TimeBasedEvent::formatChar(c, sFilterAttendee, delegateRequest); -} - -//--------------------------------------------------------------------- - -t_bool VJournal::isValid() -{ - // TODO: finish - if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sPUBLISH) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREQUEST) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sADD) == 0)) - { - // must have dtstart - if ((!getDTStart().isValid())) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingStartingTime, 300); - return FALSE; - } - - // If due exists, make sure it is not before dtstart - //if (getDTEnd().isValid() && getDTEnd() < getDTStart()) - // return FALSE; - - // must have dtstamp, summary, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getSummary().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSummary, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - // must have organizer - if (getOrganizer().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingOrganizer, 300); - return FALSE; - } - // must have sequence >= 0 - if (getSequence() < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSeqNo, 300); - return FALSE; - } - if (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREQUEST) == 0) - { - if (getAttendees() == 0 || getAttendees()->GetSize() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingAttendees, 300); - return FALSE; - } - } - } - else if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREPLY) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sCANCEL) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sDECLINECOUNTER) == 0)) - { - // must have dtstamp, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - // must have organizer - if (getOrganizer().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingOrganizer, 300); - return FALSE; - } - // must have sequence >= 0 - if (getSequence() < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSeqNo, 300); - return FALSE; - } - if (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREPLY) == 0) - { - if (getAttendees() == 0 || getAttendees()->GetSize() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingAttendees, 300); - return FALSE; - } - } - } - else if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREFRESH) == 0)) - { - // must have dtstamp, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - // TODO: attendees required? - } - else if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sCOUNTER) == 0)) - { - // must have dtstamp, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - - // must have sequence >= 0 - if (getSequence() < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSeqNo, 300); - return FALSE; - } - } - - // check super class isValid method - return TimeBasedEvent::isValid(); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::cancelMessage() -{ - UnicodeString s = nsCalKeyword::Instance()->ms_sCANCELLED; - setStatus(s); - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalCancelMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::requestMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalRequestMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::requestRecurMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalRecurRequestMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::counterMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalCounterMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::declineCounterMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalDeclineCounterMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::addMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalAddMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::refreshMessage(UnicodeString sAttendeeFilter) -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalRefreshMessage, sAttendeeFilter); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::allMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalAllPropertiesMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::replyMessage(UnicodeString sAttendeeFilter) -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalReplyMessage, sAttendeeFilter); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::publishMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalPublishMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VJournal::publishRecurMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVJournalRecurPublishMessage, ""); -} - -//--------------------------------------------------------------------- - -void -VJournal::updateComponentHelper(TimeBasedEvent * updatedComponent) -{ - TimeBasedEvent::updateComponentHelper(updatedComponent); -} diff --git a/mozilla/calendar/modules/core/ical/src/vtimezne.cpp b/mozilla/calendar/modules/core/ical/src/vtimezne.cpp deleted file mode 100644 index ffa82376eb9..00000000000 --- a/mozilla/calendar/modules/core/ical/src/vtimezne.cpp +++ /dev/null @@ -1,815 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// vtimezne.cpp -// John Sun -// 2:40 PM February 24 1998 - -#include "stdafx.h" -#include "jdefines.h" - -#include "icalcomp.h" -#include "prprtyfy.h" -#include "vtimezne.h" -#include "jlog.h" -#include "jutility.h" -#include "keyword.h" -#include - -t_bool VTimeZone::ms_bMORE_THAN_TWO_TZPARTS = FALSE; -//--------------------------------------------------------------------- - -// private never use. -#if 0 -VTimeZone::VTimeZone() -{ - PR_ASSERT(FALSE); -} -#endif - -//--------------------------------------------------------------------- - -VTimeZone::VTimeZone(JLog * initLog) -: m_TZID(0), m_LastModified(0), m_TZURL(0), - m_XTokensVctr(0), - m_TZPartVctr(0), m_NLSTimeZone(0), - m_Log(initLog) -{ - //PR_ASSERT(initLog != 0); -} -//--------------------------------------------------------------------- -VTimeZone::VTimeZone(VTimeZone & that) -: m_TZID(0), m_LastModified(0), m_TZURL(0), - m_XTokensVctr(0), - m_TZPartVctr(0), m_NLSTimeZone(0) -{ - if (that.m_NLSTimeZone != 0) - { - // note: todo: this should be an OK cast, - // but technically it's a bad thing to do. - m_NLSTimeZone = (SimpleTimeZone *) (that.m_NLSTimeZone)->clone(); - } - - if (that.m_TZID != 0) - { - m_TZID = that.m_TZID->clone(m_Log); - } - if (that.m_LastModified != 0) - { - m_LastModified = that.m_LastModified->clone(m_Log); - } - if (that.m_TZURL != 0) - { - m_TZURL = that.m_TZURL->clone(m_Log); - } - if (that.m_XTokensVctr != 0) - { - m_XTokensVctr = new JulianPtrArray(); PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - ICalProperty::CloneUnicodeStringVector(that.m_XTokensVctr, m_XTokensVctr); - } - } - if (that.m_TZPartVctr != 0) - { - t_int32 i; - ICalComponent * tzclone; - ICalComponent * ip; - m_TZPartVctr = new JulianPtrArray(); PR_ASSERT(m_TZPartVctr != 0); - if (m_TZPartVctr != 0) - { - for (i = 0; i < that.m_TZPartVctr->GetSize(); i++) - { - ip = (ICalComponent *) that.m_TZPartVctr->GetAt(i); - tzclone = ip->clone(m_Log); - PR_ASSERT(tzclone != 0); - if (tzclone != 0) - { - m_TZPartVctr->Add(tzclone); - } - } - } - } -} -//--------------------------------------------------------------------- -ICalComponent * -VTimeZone::clone(JLog * initLog) -{ - m_Log = initLog; - //PR_ASSERT(m_Log != 0); - return new VTimeZone(*this); -} -//--------------------------------------------------------------------- - -VTimeZone::~VTimeZone() -{ - if (m_TZPartVctr != 0) - { - ICalComponent::deleteICalComponentVector(m_TZPartVctr); - delete m_TZPartVctr; m_TZPartVctr = 0; - } - if (m_LastModified != 0) - { - delete m_LastModified; m_LastModified = 0; - } - if (m_TZID != 0) - { - delete m_TZID; m_TZID = 0; - } - if (m_TZURL != 0) - { - delete m_TZURL; m_TZURL = 0; - } - if (m_XTokensVctr != 0) - { - ICalComponent::deleteUnicodeStringVector(m_XTokensVctr); - delete m_XTokensVctr; m_XTokensVctr = 0; - } - // NOTE: verify this - if (m_NLSTimeZone != 0) - { - delete m_NLSTimeZone; m_NLSTimeZone = 0; - } -} - -//--------------------------------------------------------------------- -UnicodeString & -VTimeZone::parse(ICalReader * brFile, UnicodeString & sType, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones, - t_bool bIgnoreBeginError, nsCalUtility::MimeEncoding encoding) -{ - UnicodeString strLine, propName, propVal; - parseStatus = nsCalKeyword::Instance()->ms_sOK; - JulianPtrArray * parameters = new JulianPtrArray(); - PR_ASSERT(parameters != 0 && brFile != 0); - if (parameters == 0 || brFile == 0) - { - // ran out of memory, return invalid vtimezone - return parseStatus; - } - - ErrorCode status = ZERO_ERROR; - t_bool parseError = FALSE; - //PR_ASSERT(vTimeZones == 0); - - // NOTE: remove later, to avoid compiler warning - if (sType.size() > 0 && vTimeZones) {} - - while (TRUE) - { - PR_ASSERT(brFile != 0); - brFile->readFullLine(strLine, status); - ICalProperty::Trim(strLine); - - if (FAILURE(status) && strLine.size() == 0) - break; - - ICalProperty::parsePropertyLine(strLine, propName, propVal, parameters); - - if (strLine.size() == 0) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - continue; - } - else if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0)) - { - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - break; - } - else if (((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sEND) == 0) && - ((propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) || - (ICalProperty::IsXToken(propVal))) - ) || - ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - ((propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTIMEZONE) == 0) && !bIgnoreBeginError) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVEVENT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVTODO) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVJOURNAL) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVFREEBUSY) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0) || - (ICalProperty::IsXToken(propVal)) - )) - - { - // abrupt break of parsing - // Break on END:VCALENDAR, VEVENT, VTODO, VJOURNAL, VFREEBUSY, x-token, - // break on BEGIN:VTIMEZONE (and not first BEGIN:VTIMEZONE) - // break on BEGIN:VEVENT, VTODO, VJOURNAL, VFREEBUSY, VCALENDAR, xtoken - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iAbruptEndOfParsing, - nsCalKeyword::Instance()->ms_sVTIMEZONE, strLine, 300); - - parseStatus = strLine; - break; - } - else if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - ((propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sDAYLIGHT) == 0) || - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sSTANDARD) == 0))) - { - // Add the DAYLIGHT, STANDARD parts - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - TZPart * tzpart = new TZPart(m_Log); - PR_ASSERT(tzpart != 0); - if (tzpart != 0) - { - tzpart->parse(brFile, propVal, parseStatus, 0); - - if (!tzpart->isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidTZPart, 200); - delete tzpart; tzpart = 0; - } - else - { - addTZPart(tzpart); - } - } - } - else - { - storeData(strLine, propName, propVal, parameters); - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - } - } - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - delete parameters; parameters = 0; - - selfCheck(); - return parseStatus; -} -//--------------------------------------------------------------------- -void VTimeZone::storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters) -{ - - if (strLine.size() > 0) - { - } - //UnicodeString u; - t_int32 hashCode = propName.hashCode(); - //if (propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sLASTMODIFIED) == 0) - - if (nsCalKeyword::Instance()->ms_ATOM_LASTMODIFIED == hashCode) - { - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTIMEZONE, strLine, 100); - } - - if (getLastModifiedProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTIMEZONE, propName, 100); - } - DateTime d(propVal); - setLastModified(d, parameters); - } - else if (nsCalKeyword::Instance()->ms_ATOM_TZID == hashCode) - { - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTIMEZONE, strLine, 100); - } - - if (getTZIDProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTIMEZONE, propName, 100); - } - setTZID(propVal, parameters); - } - else if (nsCalKeyword::Instance()->ms_ATOM_TZURL == hashCode) - { - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTIMEZONE, strLine, 100); - } - - if (getTZURLProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTIMEZONE, propName, 100); - } - setTZURL(propVal, parameters); - } - else if (ICalProperty::IsXToken(propName)) - { - addXTokens(strLine); - } - else - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyName, - nsCalKeyword::Instance()->ms_sVTIMEZONE, propName, 200); - } -} -//--------------------------------------------------------------------- - -void VTimeZone::selfCheck() -{ - if (isValid()) - { - // Make the NLS timezone part - createNLSTimeZone(); - } -} - -//--------------------------------------------------------------------- - -void VTimeZone::createNLSTimeZone() -{ - float f1, f2; - t_int32 toOffset; - UnicodeString u; - - if ((0 != getStandardPart()) && 0 != getDaylightPart()) - { - // create a NLSTimeZone with daylight and standard part - u = getStandardPart()->getTZOffsetTo(); - f1 = TZPart::UTCOffsetToFloat(u); - u = getDaylightPart()->getTZOffsetTo(); - f2 = TZPart::UTCOffsetToFloat(u); - - toOffset = (t_int32) ((f2 - f1) * kMillisPerHour); - - if (m_NLSTimeZone != 0) - { - delete m_NLSTimeZone; m_NLSTimeZone = 0; - } - m_NLSTimeZone = new SimpleTimeZone((t_int32) (f1 * kMillisPerHour), getTZID(), - (t_int8) getDaylightPart()->getMonth(), - (t_int8) getDaylightPart()->getDayOfWeekInMonth(), - (t_int8) getDaylightPart()->getDay(), - (t_int32) getDaylightPart()->getStartTime(), - (t_int8) getStandardPart()->getMonth(), - (t_int8) getStandardPart()->getDayOfWeekInMonth(), - (t_int8) getStandardPart()->getDay(), - (t_int32) getStandardPart()->getStartTime(), - (t_int32) toOffset); - - PR_ASSERT(m_NLSTimeZone != 0); - if (m_NLSTimeZone != 0) - { - m_NLSTimeZone->setRawOffset((t_int32) (f1 * kMillisPerHour)); - m_NLSTimeZone->setID(getTZID()); - - m_NLSTimeZone->setStartRule(getDaylightPart()->getMonth(), getDaylightPart()->getDayOfWeekInMonth(), - getDaylightPart()->getDay(), getDaylightPart()->getStartTime()); - - m_NLSTimeZone->setEndRule(getStandardPart()->getMonth(), getStandardPart()->getDayOfWeekInMonth(), - getStandardPart()->getDay(), getStandardPart()->getStartTime()); - } - } - else - { - PR_ASSERT(m_TZPartVctr != 0 && m_TZPartVctr->GetSize() > 0); - if (m_TZPartVctr != 0 && m_TZPartVctr->GetSize() > 0) - { - // use first tzpart to create a single part timezone, - TZPart * tz = (TZPart *) m_TZPartVctr->GetAt(0); - u = tz->getTZOffsetTo(); - f1 = TZPart::UTCOffsetToFloat(u); - - if (m_NLSTimeZone != 0) - { - delete m_NLSTimeZone; m_NLSTimeZone = 0; - } - m_NLSTimeZone = new SimpleTimeZone((t_int32) (f1 * kMillisPerHour), getTZID()); - PR_ASSERT(m_NLSTimeZone != 0); - } - } -} - -//--------------------------------------------------------------------- - -t_bool VTimeZone::isValid() -{ - // TODO: log invalid ID, Daylight, Standard. - /* Must have tzid, standard || daylight part && at most 2 parts. */ - - if (0 == getTZID().size()) - return FALSE; - - // if no parts, return FALSE - if ((0 == getDaylightPart()) && (0 == getStandardPart())) - return FALSE; - - if (!ms_bMORE_THAN_TWO_TZPARTS) - { - if (0 != getTZParts()) - { - if (getTZParts()->GetSize() > 2) - return FALSE; - } - } - return TRUE; -} - -//--------------------------------------------------------------------- -UnicodeString VTimeZone::toICALString() -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sVTIMEZONE; - return ICalComponent::format(u, nsCalFormatString::Instance()->ms_sVTimeZoneAllMessage, ""); -} -//--------------------------------------------------------------------- -UnicodeString VTimeZone::toICALString(UnicodeString method, - UnicodeString name, - t_bool isRecurring) -{ - // NOTE: remove later avoid warnings - if (isRecurring) {} - return toICALString(); -} -//--------------------------------------------------------------------- -UnicodeString VTimeZone::toString() -{ - return ICalComponent::toStringFmt( - nsCalFormatString::Instance()->ms_VTimeZoneStrDefaultFmt); -} -//--------------------------------------------------------------------- -UnicodeString VTimeZone::toStringChar(t_int32 c, UnicodeString & dateFmt) -{ - UnicodeString s; - t_int32 i; - TZPart * tzp; - - switch (c) - { - case ms_cTZParts: - if (getTZParts() != 0) - { - for (i = 0; i < getTZParts()->GetSize(); i++) - { - tzp = (TZPart *) getTZParts()->GetAt(i); - s += tzp->toString(); - } - } - return s; - case ms_cLastModified: - return ICalProperty::propertyToString(getLastModifiedProperty(), dateFmt, s); - case ms_cTZID: - return ICalProperty::propertyToString(getTZIDProperty(), dateFmt, s); - case ms_cTZURL: - return ICalProperty::propertyToString(getTZURLProperty(), dateFmt, s); - default: - return ""; - } -} -//--------------------------------------------------------------------- -UnicodeString VTimeZone::formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString s, sResult; - t_int32 i; - TZPart * tzp; - - // NOTE: remove here is get rid of compiler warnings - if (sFilterAttendee.size() > 0 || delegateRequest) - { - } - - switch (c) - { - case ms_cTZParts: - if (getTZParts() != 0) - { - for (i = 0; i < getTZParts()->GetSize(); i++) - { - tzp = (TZPart *) getTZParts()->GetAt(i); - s += tzp->toICALString(); - } - } - return s; - case ms_cLastModified: - s = nsCalKeyword::Instance()->ms_sLASTMODIFIED; - return ICalProperty::propertyToICALString(s, getLastModifiedProperty(), sResult); - case ms_cTZID: - s = nsCalKeyword::Instance()->ms_sTZID; - return ICalProperty::propertyToICALString(s, getTZIDProperty(), sResult); - case ms_cTZURL: - s = nsCalKeyword::Instance()->ms_sTZURL; - return ICalProperty::propertyToICALString(s, getTZURLProperty(), sResult); - case ms_cXTokens: - return ICalProperty::vectorToICALString(getXTokens(), sResult); - default: - return ""; - } -} -//--------------------------------------------------------------------- - -void -VTimeZone::updateComponentHelper(VTimeZone * updatedComponent) -{ - DateTime d; - // no need: last-modified, TZID - ICalComponent::internalSetXTokensVctr(&m_XTokensVctr, updatedComponent->m_XTokensVctr); - - // call updateComponentHelper on TZPart's - ICalComponent::internalSetProperty(&m_TZURL, updatedComponent->m_TZURL); - setLastModified(d); - if (m_TZPartVctr != 0 && updatedComponent->getTZParts() != 0) - { - t_int32 i, j; - TZPart * tzp; - TZPart * uctzp; - for (i = 0; i < m_TZPartVctr->GetSize(); i++) - { - tzp = (TZPart *) m_TZPartVctr->GetAt(i); - for (j = 0; j < updatedComponent->getTZParts()->GetSize(); j++) - { - uctzp = (TZPart *) updatedComponent->getTZParts()->GetAt(j); - - tzp->updateComponent(uctzp); - } - } - } -} -//--------------------------------------------------------------------- - -t_bool -VTimeZone::updateComponent(ICalComponent * updatedComponent) -{ - if (updatedComponent != 0) - { - ICAL_COMPONENT ucType = updatedComponent->GetType(); - - // only call updateComponentHelper if it's a VTimeZone and - // it is an exact matching TZID - // basically always overwrite - if (ucType == ICAL_COMPONENT_VTIMEZONE) - { - // should be a safe cast with check above. - VTimeZone * ucvtz = (VTimeZone *) updatedComponent; - - // only if TZID's match and are not empty - if (ucvtz->getTZID().size() > 0 && getTZID().size() > 0) - { - if (ucvtz->getTZID() == getTZID()) - { - updateComponentHelper(ucvtz); - return TRUE; - } - } - } - } - return FALSE; -} -//--------------------------------------------------------------------- -void VTimeZone::addTZPart(TZPart * part) -{ - if (m_TZPartVctr == 0) - m_TZPartVctr = new JulianPtrArray(); - PR_ASSERT(m_TZPartVctr != 0); - PR_ASSERT(part != 0); - if (m_TZPartVctr != 0 && part != 0) - { - m_TZPartVctr->Add(part); - } -} -//--------------------------------------------------------------------- -TZPart * VTimeZone::getPart(UnicodeString & u) -{ - t_int32 i; - TZPart * tzp; - if (getTZParts() != 0) - { - for (i = 0; i < getTZParts()->GetSize(); i++) - { - tzp = (TZPart *) getTZParts()->GetAt(i); - if (tzp->getName().compareIgnoreCase(u) == 0) - { - return tzp; - } - } - } - return 0; -} -//--------------------------------------------------------------------- -TZPart * VTimeZone::getStandardPart() -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sSTANDARD; - return getPart(u); -} -//--------------------------------------------------------------------- -TZPart * VTimeZone::getDaylightPart() -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sDAYLIGHT; - return getPart(u); -} -//--------------------------------------------------------------------- -VTimeZone * VTimeZone::getTimeZone(UnicodeString & id, - JulianPtrArray * timezones) -{ - t_int32 i; - VTimeZone * vt; - if (timezones != 0) - { - for (i = 0; i < timezones->GetSize(); i++) - { - vt = (VTimeZone *) timezones->GetAt(i); - if (id.compareIgnoreCase(vt->getTZID()) == 0) - { - return vt; - } - } - - } - return 0; -} -//--------------------------------------------------------------------- -//LAST-MODIFIED -void VTimeZone::setLastModified(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_LastModified == 0) - m_LastModified = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_LastModified->setValue((void *) &s); - m_LastModified->setParameters(parameters); - } -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_LastModified), s, parameters); -#endif -} - -DateTime VTimeZone::getLastModified() const -{ -#if 1 - DateTime d(-1); - if (m_LastModified == 0) - return d; // return 0; - else - { - d = *((DateTime *) m_LastModified->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_LastModified), d); - return d; -#endif -} -//--------------------------------------------------------------------- -//TZID -void VTimeZone::setTZID(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_TZID == 0) - m_TZID = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_TZID->setValue((void *) &s); - m_TZID->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_TZID), s, parameters); -#endif -} -UnicodeString VTimeZone::getTZID() const -{ -#if 1 - UnicodeString u; - if (m_TZID == 0) - return ""; - else - { - u = *((UnicodeString *) m_TZID->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_TZID), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//TZURL -void VTimeZone::setTZURL(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_TZURL == 0) - m_TZURL = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_TZURL->setValue((void *) &s); - m_TZURL->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_TZURL), s, parameters); -#endif -} -UnicodeString VTimeZone::getTZURL() const -{ -#if 1 - UnicodeString u; - if (m_TZURL == 0) - return ""; - else - { - u = *((UnicodeString *) m_TZURL->getValue()); - return u; - } -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_TZID), us); - return us; -#endif -} -//--------------------------------------------------------------------- -DateTime -VTimeZone::DateTimeApplyTimeZone(UnicodeString & time, - JulianPtrArray * vTimeZones, - JulianPtrArray * parameters) -{ - DateTime d; - UnicodeString out, u; - VTimeZone * vt = 0; - TimeZone *t = 0; - u = nsCalKeyword::Instance()->ms_sTZID; - out = ICalParameter::GetParameterFromVector(u, out, parameters); - - //if (FALSE) TRACE("out = %s\r\n", out.toCString("")); - if (out.size() > 0) - { - vt = VTimeZone::getTimeZone(out, vTimeZones); - if (vt != 0) - t = vt->getNLSTimeZone(); - } - if (t != 0) - d.setTimeString(time, t); - else - d.setTimeString(time); - - return d; -} -//--------------------------------------------------------------------- -// XTOKENS -void VTimeZone::addXTokens(UnicodeString s) -{ - if (m_XTokensVctr == 0) - m_XTokensVctr = new JulianPtrArray(); - PR_ASSERT(m_XTokensVctr != 0); - if (m_XTokensVctr != 0) - { - m_XTokensVctr->Add(new UnicodeString(s)); - } -} -//--------------------------------------------------------------------- diff --git a/mozilla/calendar/modules/core/ical/src/vtodo.cpp b/mozilla/calendar/modules/core/ical/src/vtodo.cpp deleted file mode 100644 index 9559eab4018..00000000000 --- a/mozilla/calendar/modules/core/ical/src/vtodo.cpp +++ /dev/null @@ -1,1221 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * vtodo.cpp - * John Sun - * 4/22/98 3:41:09 PM - */ - -#include "stdafx.h" -#include "jdefines.h" - -#include "jutility.h" -#include "vtodo.h" -#include "icalredr.h" -#include "prprtyfy.h" -#include "unistrto.h" -#include "jlog.h" -#include "vtimezne.h" -#include "keyword.h" -#include "period.h" -#include "datetime.h" - -#include "functbl.h" -//--------------------------------------------------------------------- -void VTodo::setDefaultFmt(UnicodeString s) -{ - nsCalFormatString::Instance()->ms_VTodoStrDefaultFmt = s; -} -//--------------------------------------------------------------------- -#if 0 -VTodo::VTodo() -{ - PR_ASSERT(FALSE); -} -#endif -//--------------------------------------------------------------------- - -VTodo::VTodo(JLog * initLog) -: m_Due(0), - m_Completed(0), - m_TempDuration(0), - m_GEO(0), - m_Location(0), - m_PercentComplete(0), - m_Priority(0), - m_ResourcesVctr(0), - TimeBasedEvent(initLog) -{ -} - -//--------------------------------------------------------------------- - -VTodo::VTodo(VTodo & that) -: m_Due(0), - m_Completed(0), - m_TempDuration(0), - m_GEO(0), - m_Location(0), - m_PercentComplete(0), - m_Priority(0), - m_ResourcesVctr(0), - TimeBasedEvent(that) -{ - m_origDue = that.m_origDue; - m_origMyDue = that.m_origMyDue; - - if (that.m_Completed != 0) - { - m_Completed = that.m_Completed->clone(m_Log); - } - if (that.m_Due != 0) - { - m_Due = that.m_Due->clone(m_Log); - } - //if (that.m_Duration != 0) { m_Duration = that.m_Duration->clone(m_Log); } - if (that.m_GEO != 0) - { - m_GEO = that.m_GEO->clone(m_Log); - } - if (that.m_Location != 0) - { - m_Location = that.m_Location->clone(m_Log); - } - if (that.m_PercentComplete != 0) - { - m_PercentComplete = that.m_PercentComplete->clone(m_Log); - } - if (that.m_Priority != 0) - { - m_Priority = that.m_Priority->clone(m_Log); - } - if (that.m_ResourcesVctr != 0) - { - m_ResourcesVctr = new JulianPtrArray(); PR_ASSERT(m_ResourcesVctr != 0); - if (m_ResourcesVctr != 0) - { - ICalProperty::CloneICalPropertyVector(that.m_ResourcesVctr, m_ResourcesVctr, m_Log); - } - } -} - -//--------------------------------------------------------------------- - -ICalComponent * -VTodo::clone(JLog * initLog) -{ - m_Log = initLog; - return new VTodo(*this); -} - -//--------------------------------------------------------------------- - -VTodo::~VTodo() -{ - if (m_TempDuration != 0) - { - delete m_TempDuration; m_TempDuration = 0; - } - // properties - if (m_Completed != 0) - { - delete m_Completed; m_Completed = 0; - } - if (m_Due != 0) - { - delete m_Due; m_Due = 0; - } - //if (m_Duration != 0) { delete m_Duration; m_Duration = 0; } - if (m_GEO != 0) - { - delete m_GEO; m_GEO = 0; - } - if (m_Location!= 0) - { - delete m_Location; m_Location = 0; - } - if (m_PercentComplete != 0) - { - delete m_PercentComplete; m_PercentComplete = 0; - } - if (m_Priority!= 0) - { - delete m_Priority; m_Priority = 0; - } - - // vector of strings - if (m_ResourcesVctr != 0) { - ICalProperty::deleteICalPropertyVector(m_ResourcesVctr); - delete m_ResourcesVctr; m_ResourcesVctr = 0; - } - //delete (TimeBasedEvent *) this; -} - -//--------------------------------------------------------------------- - -UnicodeString & -VTodo::parse(ICalReader * brFile, UnicodeString & sMethod, - UnicodeString & parseStatus, JulianPtrArray * vTimeZones, - t_bool bIgnoreBeginError, nsCalUtility::MimeEncoding encoding) -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sVTODO; - return parseType(u, brFile, sMethod, parseStatus, vTimeZones, bIgnoreBeginError, encoding); -} - -//--------------------------------------------------------------------- - -Date VTodo::difference() -{ - if (getDue().getTime() >= 0 && getDTStart().getTime() >= 0) - { - return (getDue().getTime() - getDTStart().getTime()); - } - else return 0; -} - -//--------------------------------------------------------------------- - -void VTodo::selfCheck() -{ - TimeBasedEvent::selfCheck(); - - // if no due, and there is a dtstart and duration, calculate due - if (!getDue().isValid()) - { - // calculate Due from duration and dtstart - // TODO: remove memory leaks in m_TempDuration - if (getDTStart().isValid() && m_TempDuration != 0 && m_TempDuration->isValid()) - { - DateTime due; - due = getDTStart(); - due.add(*m_TempDuration); - setDue(due); - delete m_TempDuration; m_TempDuration = 0; - } - else if (!getDTStart().isValid()) - { - if (m_TempDuration != 0) - delete m_TempDuration; m_TempDuration = 0; - } - } - if (getStatus().size() > 0) - { - // check if I got a valid status - UnicodeString u = getStatus(); - u.toUpper(); - ICalProperty::Trim(u); - JAtom ua(u); - if ((nsCalKeyword::Instance()->ms_ATOM_NEEDSACTION != ua) && - (nsCalKeyword::Instance()->ms_ATOM_COMPLETED != ua) && - (nsCalKeyword::Instance()->ms_ATOM_INPROCESS != ua) && - (nsCalKeyword::Instance()->ms_ATOM_CANCELLED != ua)) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyValue, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sSTATUS, u, 200); - - setStatus(""); - } - } -} - -//--------------------------------------------------------------------- -//--------------------------------------------------------------------- -void VTodo::storeCompleted(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters (MUST BE IN UTC) - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - if (getCompletedProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sCOMPLETED, 100); - } - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setCompleted(d, parameters); -} -void VTodo::storeDue(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // check parameters - t_bool bParamValid = ICalProperty::CheckParamsWithValueRangeCheck(parameters, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRange, - nsCalAtomRange::Instance()->ms_asTZIDValueParamRangeSize, - nsCalAtomRange::Instance()->ms_asDateDateTimeValueRange, - nsCalAtomRange::Instance()->ms_asDateDateTimeValueRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - - if (getDueProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sDUE, 100); - } - UnicodeString u, out; - - u = nsCalKeyword::Instance()->ms_sVALUE; - out = ICalParameter::GetParameterFromVector(u, out, parameters); - - t_bool bIsDate = DateTime::IsParseableDate(propVal); - - if (bIsDate) - { - // if there is a VALUE=X parameter, make sure X is DATE - if (out.size() != 0 && (nsCalKeyword::Instance()->ms_ATOM_DATE != out.hashCode())) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iPropertyValueTypeMismatch, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - } - else - { - // if there is a VALUE=X parameter, make sure X is DATETIME - if (out.size() != 0 && (nsCalKeyword::Instance()->ms_ATOM_DATETIME != out.hashCode())) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iPropertyValueTypeMismatch, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - } - - DateTime d; - d = VTimeZone::DateTimeApplyTimeZone(propVal, vTimeZones, parameters); - - setDue(d, parameters); -} -void VTodo::storeDuration(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - - if (m_TempDuration != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sDURATION, 100); - } - //nsCalDuration d(propVal); - if (m_TempDuration == 0) - { - m_TempDuration = new nsCalDuration(propVal); - PR_ASSERT(m_TempDuration != 0); - } - else - m_TempDuration->setDurationString(propVal); -} -void VTodo::storeGEO(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - - if (getGEOProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sGEO, 100); - } - setGEO(propVal, parameters); -} -void VTodo::storeLocation(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRange, - nsCalAtomRange::Instance()->ms_asAltrepLanguageParamRangeSize); - - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - - if (getLocationProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sLOCATION, 100); - } - setLocation(propVal, parameters); -} -void VTodo::storePercentComplete(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParseError = FALSE; - t_int32 i; - - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - - char * pcc = propVal.toCString(""); - PR_ASSERT(pcc != 0); - i = nsCalUtility::atot_int32(pcc, bParseError, propVal.size()); - delete [] pcc; pcc = 0; - if (getPercentCompleteProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sPERCENTCOMPLETE, 100); - } - if (!bParseError) - { - if (i > 100) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iRoundedPercentCompleteTo100, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sPERCENTCOMPLETE, 100); - i = 100; - } - setPercentComplete(i, parameters); - } - else - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidNumberFormat, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sPERCENTCOMPLETE, propVal, 200); - } -} -void VTodo::storePriority(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ - t_bool bParseError = FALSE; - t_int32 i; - - // no parameters - if (parameters->GetSize() > 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - - char * pcc = propVal.toCString(""); - PR_ASSERT(pcc != 0); - i = nsCalUtility::atot_int32(pcc, bParseError, propVal.size()); - delete [] pcc; pcc = 0; - if (getPriorityProperty() != 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iDuplicatedProperty, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sPRIORITY, 100); - } - if (!bParseError) - { - setPriority(i, parameters); - } - else - { - if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidNumberFormat, - nsCalKeyword::Instance()->ms_sVTODO, - nsCalKeyword::Instance()->ms_sPRIORITY, propVal, 200); - } -} -void VTodo::storeResources(UnicodeString & strLine, UnicodeString & propVal, - JulianPtrArray * parameters, JulianPtrArray * vTimeZones) -{ -// check parameters - t_bool bParamValid = ICalProperty::CheckParams(parameters, - nsCalAtomRange::Instance()->ms_asLanguageParamRange, - nsCalAtomRange::Instance()->ms_asLanguageParamRangeSize); - if (!bParamValid) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidOptionalParam, - nsCalKeyword::Instance()->ms_sVTODO, strLine, 100); - } - - addResourcesPropertyVector(propVal, parameters); -} -//--------------------------------------------------------------------- -t_bool -VTodo::storeData(UnicodeString & strLine, UnicodeString & propName, - UnicodeString & propVal, JulianPtrArray * parameters, - JulianPtrArray * vTimeZones) -{ - if (TimeBasedEvent::storeData(strLine, propName, propVal, - parameters, vTimeZones)) - return TRUE; - else - { - t_int32 hashCode = propName.hashCode(); - t_int32 i; - for (i = 0; 0 != (JulianFunctionTable::Instance()->vtStoreTable[i]).op; i++) - { - if ((JulianFunctionTable::Instance()->vtStoreTable[i]).hashCode == hashCode) - { - ApplyStoreOp(((JulianFunctionTable::Instance())->vtStoreTable[i]).op, - strLine, propVal, parameters, vTimeZones); - return TRUE; - } - } - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iInvalidPropertyName, - nsCalKeyword::Instance()->ms_sVTODO, propName, 200); - UnicodeString u; - u = nsCalLogErrorMessage::Instance()->ms_sRS202; - u += '.'; u += ' '; - u += strLine; - addRequestStatus(u); - return FALSE; - } -} - -//--------------------------------------------------------------------- - -void VTodo::populateDatesHelper(DateTime start, Date ldiff, - JulianPtrArray * vPeriods) -{ - Date diff = ldiff; - Date diff2 = -1; - - if (vPeriods != 0) - { - // Check if period matches this date, if-so, set - // difference to be length of period - // TODO: if multiple periods match this date, choose period - // with longest length - - t_int32 i; - UnicodeString u; - Period p; - DateTime ps, pe; - Date pl; - for (i = 0; i < vPeriods->GetSize(); i++) - { - u = *((UnicodeString *) vPeriods->GetAt(i)); - - //if (FALSE) TRACE("populateDatesHelper(): u = %s\r\n", u.toCString("")); - - p.setPeriodString(u); - PR_ASSERT(p.isValid()); - if (p.isValid()) - { - ps = p.getStart(); - - if (ps.equalsDateTime(start)) - { - pe = p.getEndingTime(pe); - pl = (pe.getTime() - ps.getTime()); - //if (FALSE) TRACE("populateDatesHelper(): pl = %d\r\n", pl); - - diff2 = ((diff2 > pl) ? diff2 : pl); - } - } - } - } - if (diff2 != -1) - diff = diff2; - - DateTime dDue; - dDue.setTime(start.getTime() + diff); - setDue(dDue); - setMyOrigDue(dDue); - - DateTime origDue; - origDue.setTime(getOrigStart().getTime() + ldiff); - setOrigDue(origDue); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::formatHelper(UnicodeString & strFmt, - UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString u = nsCalKeyword::Instance()->ms_sVTODO; - return ICalComponent::format(u, strFmt, sFilterAttendee, delegateRequest); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::toString() -{ - return ICalComponent::toStringFmt( - nsCalFormatString::Instance()->ms_VTodoStrDefaultFmt); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::toStringChar(t_int32 c, UnicodeString & dateFmt) -{ - UnicodeString sResult; - switch ( c ) - { - case ms_cCompleted: - return ICalProperty::propertyToString(getCompletedProperty(), dateFmt, sResult); - case ms_cDue: - return ICalProperty::propertyToString(getDueProperty(), dateFmt, sResult); - case ms_cDuration: - return getDuration().toString(); - //return ICalProperty::propertyToString(getDurationProperty(), dateFmt, sResult); - case ms_cGEO: - return ICalProperty::propertyToString(getGEOProperty(), dateFmt, sResult); - case ms_cLocation: - return ICalProperty::propertyToString(getLocationProperty(), dateFmt, sResult); - case ms_cPercentComplete: - return ICalProperty::propertyToString(getPercentCompleteProperty(), dateFmt, sResult); - case ms_cPriority: - return ICalProperty::propertyToString(getPriorityProperty(), dateFmt, sResult); - case ms_cResources: - return ICalProperty::propertyVectorToString(getResources(), dateFmt, sResult); - default: - return TimeBasedEvent::toStringChar(c, dateFmt); - } -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::formatChar(t_int32 c, UnicodeString sFilterAttendee, - t_bool delegateRequest) -{ - UnicodeString s, sResult; - switch (c) { - case ms_cCompleted: - s = nsCalKeyword::Instance()->ms_sCOMPLETED; - return ICalProperty::propertyToICALString(s, getCompletedProperty(), sResult); - case ms_cDue: - s = nsCalKeyword::Instance()->ms_sDUE; - return ICalProperty::propertyToICALString(s, getDueProperty(), sResult); - case ms_cDuration: - s = nsCalKeyword::Instance()->ms_sDURATION; - s += ':'; - s += getDuration().toICALString(); - s += nsCalKeyword::Instance()->ms_sLINEBREAK; - return s; - //return ICalProperty::propertyToICALString(s, getDurationProperty(), sResult); - case ms_cLocation: - s = nsCalKeyword::Instance()->ms_sLOCATION; - return ICalProperty::propertyToICALString(s, getLocationProperty(), sResult); - case ms_cPercentComplete: - s = nsCalKeyword::Instance()->ms_sPERCENTCOMPLETE; - return ICalProperty::propertyToICALString(s, getPercentCompleteProperty(), sResult); - case ms_cPriority: - s = nsCalKeyword::Instance()->ms_sPRIORITY; - return ICalProperty::propertyToICALString(s, getPriorityProperty(), sResult); - case ms_cResources: - s = nsCalKeyword::Instance()->ms_sRESOURCES; - return ICalProperty::propertyVectorToICALString(s, getResources(), sResult); - case ms_cGEO: - s = nsCalKeyword::Instance()->ms_sGEO; - return ICalProperty::propertyToICALString(s, getGEOProperty(), sResult); - default: - { - return TimeBasedEvent::formatChar(c, sFilterAttendee, delegateRequest); - } - } -} - -//--------------------------------------------------------------------- - -t_bool VTodo::isValid() -{ - if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sPUBLISH) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREQUEST) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sADD) == 0)) - { - // must have dtstart - if ((!getDTStart().isValid())) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingStartingTime, 300); - return FALSE; - } - - // If due exists, make sure it is not before dtstart - //if (getDTEnd().isValid() && getDTEnd() < getDTStart()) - // return FALSE; - - // must have dtstamp, summary, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getSummary().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSummary, 300); - return FALSE; - } - - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - // must have organizer - if (getOrganizer().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingOrganizer, 300); - return FALSE; - } - // must have sequence >= 0 - if (getSequence() < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSeqNo, 300); - return FALSE; - } - if (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREQUEST) == 0) - { - if (getAttendees() == 0 || getAttendees()->GetSize() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingAttendees, 300); - return FALSE; - } - } - } - else if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREPLY) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sCANCEL) == 0) || - (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sDECLINECOUNTER) == 0)) - { - // must have dtstamp, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - // must have organizer - if (getOrganizer().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingOrganizer, 300); - return FALSE; - } - // must have sequence >= 0 - if (getSequence() < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSeqNo, 300); - return FALSE; - } - if (getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREPLY) == 0) - { - if (getAttendees() == 0 || getAttendees()->GetSize() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingAttendees, 300); - return FALSE; - } - } - } - else if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sREFRESH) == 0)) - { - // must have dtstamp, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - // TODO: attendees required? - } - else if ((getMethod().compareIgnoreCase(nsCalKeyword::Instance()->ms_sCOUNTER) == 0)) - { - // must have dtstamp, uid - if (!getDTStamp().isValid()) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingDTStamp, 300); - return FALSE; - } - if (getUID().size() == 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingUID, 300); - return FALSE; - } - // must have sequence >= 0 - if (getSequence() < 0) - { - if (m_Log) m_Log->logError( - nsCalLogErrorMessage::Instance()->ms_iMissingSeqNo, 300); - return FALSE; - } - } - - - // check super class isValid method - return TimeBasedEvent::isValid(); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::cancelMessage() -{ - UnicodeString s = nsCalKeyword::Instance()->ms_sCANCELLED; - setStatus(s); - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoCancelMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::requestMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoRequestMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::requestRecurMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoRecurRequestMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::counterMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoCounterMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::declineCounterMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoDeclineCounterMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::addMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoAddMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::refreshMessage(UnicodeString sAttendeeFilter) -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoRefreshMessage, sAttendeeFilter); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::allMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoAllPropertiesMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::replyMessage(UnicodeString sAttendeeFilter) -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoReplyMessage, sAttendeeFilter); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::publishMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoPublishMessage, ""); -} - -//--------------------------------------------------------------------- - -UnicodeString VTodo::publishRecurMessage() -{ - return formatHelper(nsCalFormatString::Instance()->ms_sVTodoRecurPublishMessage, ""); -} - -//--------------------------------------------------------------------- - -void -VTodo::updateComponentHelper(TimeBasedEvent * updatedComponent) -{ - //TODO: handle duration, origDue, origMyDue. - TimeBasedEvent::updateComponentHelper(updatedComponent); - if (updatedComponent->GetType() == GetType()) - { - ICalComponent::internalSetPropertyVctr(&m_ResourcesVctr, ((VTodo *) updatedComponent)->getResources()); - ICalComponent::internalSetProperty(&m_Completed, ((VTodo *) updatedComponent)->m_Completed); - ICalComponent::internalSetProperty(&m_Due, ((VTodo *) updatedComponent)->m_Due); - ICalComponent::internalSetProperty(&m_GEO, ((VTodo *) updatedComponent)->m_GEO); - ICalComponent::internalSetProperty(&m_Location, ((VTodo *) updatedComponent)->m_Location); - ICalComponent::internalSetProperty(&m_PercentComplete, ((VTodo *) updatedComponent)->m_PercentComplete); - ICalComponent::internalSetProperty(&m_Priority, ((VTodo *) updatedComponent)->m_Priority); - } -} - -//--------------------------------------------------------------------- -///Completed -void VTodo::setCompleted(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_Completed == 0) - m_Completed = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_Completed->setValue((void *) &s); - m_Completed->setParameters(parameters); - } - //validateCompleted(); -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_Completed), s, parameters); -#endif -} -DateTime VTodo::getCompleted() const -{ -#if 1 - DateTime d(-1); - if (m_Completed == 0) - return d; //return 0; - else - { - d = *((DateTime *) m_Completed->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_Completed), d); - return d; -#endif -} -//--------------------------------------------------------------------- -///Due -void VTodo::setDue(DateTime s, JulianPtrArray * parameters) -{ -#if 1 - if (m_Due == 0) - m_Due = ICalPropertyFactory::Make(ICalProperty::DATETIME, - (void *) &s, parameters); - else - { - m_Due->setValue((void *) &s); - m_Due->setParameters(parameters); - } - //validateDue(); -#else - ICalComponent::setDateTimeValue(((ICalProperty **) &m_Due), s, parameters); -#endif -} -DateTime VTodo::getDue() const -{ -#if 1 - DateTime d(-1); - if (m_Due == 0) - return d; //return 0; - else - { - d = *((DateTime *) m_Due->getValue()); - return d; - } -#else - DateTime d(-1); - ICalComponent::getDateTimeValue(((ICalProperty **) &m_Due), d); - return d; -#endif -} -//--------------------------------------------------------------------- -///nsCalDuration -void VTodo::setDuration(nsCalDuration s, JulianPtrArray * parameters) -{ - /* - if (m_Duration == 0) - m_Duration = ICalPropertyFactory::Make(ICalProperty::DURATION, - (void *) &s, parameters); - else - { - m_Duration->setValue((void *) &s); - m_Duration->setParameters(parameters); - } - //validateDuration(); - */ - // NOTE: remove later, to avoid compiler warnings - if (parameters) - { - } - - - DateTime due; - due = getDTStart(); - due.add(s); - setDue(due); -} -nsCalDuration VTodo::getDuration() const -{ - /* - nsCalDuration d; d.setMonth(-1); - if (m_Duration == 0) - return d; // return 0; - else - { - d = *((nsCalDuration *) m_Duration->getValue()); - return d; - } - */ - nsCalDuration duration; - DateTime start, due; - start = getDTStart(); - due = getDue(); - DateTime::getDuration(start,due,duration); - return duration; -} -//--------------------------------------------------------------------- -//GEO -void VTodo::setGEO(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_GEO == 0) - m_GEO = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - else - { - m_GEO->setValue((void *) &s); - m_GEO->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_GEO), s, parameters); -#endif -} -UnicodeString VTodo::getGEO() const -{ -#if 1 - if (m_GEO == 0) - return ""; - else - return *((UnicodeString *) m_GEO->getValue()); -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_GEO), us); - return us; -#endif -} - -//--------------------------------------------------------------------- -//Location -void VTodo::setLocation(UnicodeString s, JulianPtrArray * parameters) -{ -#if 1 - //UnicodeString * s_ptr = new UnicodeString(s); - //PR_ASSERT(s_ptr != 0); - - if (m_Location == 0) - { - m_Location = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - } - else - { - m_Location->setValue((void *) &s); - m_Location->setParameters(parameters); - } -#else - ICalComponent::setStringValue(((ICalProperty **) &m_Location), s, parameters); -#endif -} -UnicodeString VTodo::getLocation() const -{ -#if 1 - if (m_Location == 0) - return ""; - else - return *((UnicodeString *) m_Location->getValue()); -#else - UnicodeString us; - ICalComponent::getStringValue(((ICalProperty **) &m_Location), us); - return us; -#endif -} -//--------------------------------------------------------------------- -//PercentComplete -void VTodo::setPercentComplete(t_int32 i, JulianPtrArray * parameters) -{ -#if 1 - if (m_PercentComplete == 0) - m_PercentComplete = ICalPropertyFactory::Make(ICalProperty::INTEGER, - (void *) &i, parameters); - else - { - m_PercentComplete->setValue((void *) &i); - m_PercentComplete->setParameters(parameters); - } -#else - ICalComponent::setIntegerValue(((ICalProperty **) &m_PercentComplete), i, parameters); -#endif -} -t_int32 VTodo::getPercentComplete() const -{ -#if 1 - if (m_PercentComplete == 0) - return -1; - else - return *((t_int32 *) m_PercentComplete->getValue()); -#else - t_int32 i = -1; - ICalComponent::getIntegerValue(((ICalProperty **) &m_PercentComplete), i); - return i; -#endif -} -//--------------------------------------------------------------------- -//Priority -void VTodo::setPriority(t_int32 i, JulianPtrArray * parameters) -{ -#if 1 - if (m_Priority == 0) - m_Priority = ICalPropertyFactory::Make(ICalProperty::INTEGER, - (void *) &i, parameters); - else - { - m_Priority->setValue((void *) &i); - m_Priority->setParameters(parameters); - } -#else - ICalComponent::setIntegerValue(((ICalProperty **) &m_Priority), i, parameters); -#endif -} -t_int32 VTodo::getPriority() const -{ -#if 1 - if (m_Priority == 0) - return -1; - else - return *((t_int32 *) m_Priority->getValue()); -#else - t_int32 i = -1; - ICalComponent::getIntegerValue(((ICalProperty **) &m_Priority), i); - return i; -#endif -} -//--------------------------------------------------------------------- -// RESOURCES -void VTodo::addResources(UnicodeString s, JulianPtrArray * parameters) -{ - ICalProperty * prop = ICalPropertyFactory::Make(ICalProperty::TEXT, - (void *) &s, parameters); - addResourcesProperty(prop); -} - -//--------------------------------------------------------------------- - -void VTodo::addResourcesProperty(ICalProperty * prop) -{ - if (m_ResourcesVctr == 0) - m_ResourcesVctr = new JulianPtrArray(); - PR_ASSERT(m_ResourcesVctr != 0); - if (m_ResourcesVctr != 0) - { - m_ResourcesVctr->Add(prop); - } -} - -//--------------------------------------------------------------------- - -void -VTodo::addResourcesPropertyVector(UnicodeString & propVal, - JulianPtrArray * parameters) -{ - //ICalProperty * ip; - - //ip = ICalPropertyFactory::Make(ICalProperty::TEXT, new UnicodeString(propVal), - // parameters); - addResources(propVal, parameters); - //addResourcesProperty(ip); - - -#if 0 - // TODO: see TimeBasedEvent::addCategoriesPropertyVector() - - ErrorCode status = ZERO_ERROR; - UnicodeStringTokenizer * st; - UnicodeString us; - UnicodeString sDelim = nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL; - - st = new UnicodeStringTokenizer(propVal, sDelim); - //ICalProperty * ip; - while (st->hasMoreTokens()) - { - us = st->nextToken(us, status); - us.trim(); - //if (FALSE) TRACE("us = %s, status = %d", us.toCString(""), status); - // TODO: if us is in Resources range then add, else, log and error - addResourcesProperty(ICalPropertyFactory::Make(ICalProperty::TEXT, - new UnicodeString(us), parameters)); - } - delete st; st = 0; -#endif - -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/inc/JulianParser.h b/mozilla/calendar/modules/core/inc/JulianParser.h deleted file mode 100644 index ae473dd6fef..00000000000 --- a/mozilla/calendar/modules/core/inc/JulianParser.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * jparser.h - * John Sun - * 4/28/98 10:45:21 AM - */ -#ifndef __NSQQnsCalStreamReader_H_ -#define __NSQQnsCalStreamReader_H_ - -#include "ptrarray.h" -#include "icalredr.h" -#include "nsCapiCallbackReader.h" -#include "jutility.h" -#include "nspr.h" - -/** - * This class will be removed later. It is a hack I created to - * parse the MIME-message from the CS&T server fetch results. - * I will try to extract the iCalendar information from it. - * I will need to handle multi-threaded parsing somehow as well. - */ -class nsCalStreamReader -{ -private: - /*char * m_Buffer;*/ - - static nsCalUtility::MimeEncoding stringToEncodingType(UnicodeString & propVal); - - JulianPtrArray * m_OutCalendars; - nsCapiCallbackReader * m_Reader; - t_bool m_bParseStarted; - t_bool m_bParseFinished; - PRThread * m_Thread; - -public: - nsCalStreamReader(); - nsCalStreamReader(nsCapiCallbackReader * reader, JulianPtrArray * outCalendars, - PRThread * thread); - /* - void setBuffer(char * buf) - { - strcat(m_Buffer, buf); - } - */ - - t_bool isParseStarted() const { return m_bParseStarted; } - void setParseStarted() { m_bParseStarted = TRUE; } - - t_bool isParseFinished() const { return m_bParseFinished; } - void setParseFinished() { m_bParseFinished = TRUE; } - - nsCapiCallbackReader * getReader() const { return m_Reader; } - PRThread * getThread() const { return m_Thread; } - - void ParseCalendars(ICalReader * reader, - JulianPtrArray * outCalendars); - - void ParseCalendars(); - -}; - -#ifdef XP_CPLUSPLUS -extern "C"{ -#endif - - void jparser_ParseCalendarsZero(void * jp, void *); - -#ifdef XP_CPLUSPLUS -}; -#endif - -#endif /* __NSQQnsCalStreamReader_H_ */ - diff --git a/mozilla/calendar/modules/core/inc/Makefile b/mozilla/calendar/modules/core/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/inc/manifest.mn b/mozilla/calendar/modules/core/inc/manifest.mn deleted file mode 100644 index 3b0015102b4..00000000000 --- a/mozilla/calendar/modules/core/inc/manifest.mn +++ /dev/null @@ -1,38 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsCalNetFetchCollector.h \ - nsCalNetFetchCommand.h \ - nsCalNetFetchVals.h \ - nsLayer.h \ - nsLayerCollection.h \ - nsCoreCIID.h \ - nsCalendarUser.h \ - nsCalList.h \ - nsCalLoggedInUser.h \ - nsCalSession.h \ - nsCalSessionMgr.h \ - nsCalUser.h \ - nsCalUserList.h \ - nsCalendarUser.h \ - nsCalendarModel.h \ - nsCapiCallbackReader.h \ - nsCalStreamReader.h \ - JulianParser.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/core/inc/nsCalList.h b/mozilla/calendar/modules/core/inc/nsCalList.h deleted file mode 100644 index 9fb120d8810..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalList.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * nsCalList.cpp: implementation of the nsCalList class. - * This class manages the list of calendars currently in memory. - * All calendars that are to be displayed should be registered - * in this list. - */ - -#if !defined(AFX_NSCALLIST_H__BC9A7773_3EF1_11D2_8ED1_000000000000__INCLUDED_) -#define AFX_NSCALLIST_H__BC9A7773_3EF1_11D2_8ED1_000000000000__INCLUDED_ - -#include "jdefines.h" -#include "ptrarray.h" -#include "nscalexport.h" - -class NS_CALENDAR nsCalList -{ -public: - JulianPtrArray m_List; - - nsCalList(); - virtual ~nsCalList(); - - /** - * Add a calendar to the list - * @param pCal pointer to the calendar to add - * @return 0 on success - */ - nsresult Add(NSCalendar* pCal); - - /** - * Delete the calendar matching the supplied pointer. - * @param pCal pointer to the calendar to add - * @return 0 on success - * 1 if not found - */ - nsresult Delete(NSCalendar* pCal); - - /** - * Delete all calendars having the supplied cal url - * @param pCurl pointer to the curl of this calendar store - * @return 0 on success - * 1 if not found - */ - nsresult Delete(char* psCurl); - - /** - * Search for a calendar. - * @param psCurl pointer to the curl of this calendar store - * @param iStart start searching at this point in the list - * if iStart is < 0 it is snapped to 0. If it - * is >= list size, it is snapped to the last - * index. - * @param piFound the index of the calendar of the list that - * matches the psCurl. This value is always - * >= iStart when the return value is 0. It - * is returned as -1 if the curl cannot be found. - * @return 0 on success - * 1 if not found - */ - nsresult Find(char* psCurl, int iStart, int* piFound); - - /** - * Get the calendar at the supplied index. - * @param i the index of the calendar to fetch - * @return 0 if the index is bad, otherwise it is a pointer - * to the calendar at index i in the list - */ - NSCalendar* GetAt(int i); - -}; - -#endif /* !defined(AFX_NSCALLIST_H__BC9A7773_3EF1_11D2_8ED1_000000000000__INCLUDED_) */ - - diff --git a/mozilla/calendar/modules/core/inc/nsCalLoggedInUser.h b/mozilla/calendar/modules/core/inc/nsCalLoggedInUser.h deleted file mode 100644 index c92bdb7feb8..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalLoggedInUser.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * This extends the nsCalUser just a bit. It includes a password for - * logging in and a local capi url. - * - * sman - */ - -#ifndef __NS_CAL_LOGGED_IN_USER__ -#define __NS_CAL_LOGGED_IN_USER__ - -#include "nscalexport.h" - -class NS_CALENDAR nsCalLoggedInUser : public nsCalUser -{ -private: - JulianString m_sPassword; /* user's password */ - JulianString m_sLocalCapiUrl; /* url to local capi file */ - -public: - nsCalLoggedInUser(); - virtual ~nsCalLoggedInUser(); - - JulianString& GetPassword() {return m_sPassword;} - void SetPassword(char* psName) { m_sPassword = psName; } - - JulianString& GetLocalCapiUrl() {return m_sLocalCapiUrl;} - void SetLocalCapiUrl(char* psName) { m_sLocalCapiUrl = psName; } -}; - -#endif // __NS_CAL_LOGGED_IN_USER__ diff --git a/mozilla/calendar/modules/core/inc/nsCalNetFetchCollector.h b/mozilla/calendar/modules/core/inc/nsCalNetFetchCollector.h deleted file mode 100644 index a98606feb71..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalNetFetchCollector.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalNetFetchCollector_h__ -#define nsCalNetFetchCollector_h__ - -#include "nscalexport.h" -#include "nsCalNetFetchVals.h" -#include "nsICalNetFetchCollector.h" -#include "nsIArray.h" - - -class NS_CALENDAR nsCalNetFetchCollector : public nsICalNetFetchCollector -{ - - nsIArray * mpFetchList ; - -public: - nsCalNetFetchCollector(nsISupports* outer); - ~nsCalNetFetchCollector(); - - NS_DECL_ISUPPORTS - - /** - * Register a fetch by range, but don't perform it yet. - * @param nsIUser user making the request - * @param d1 start date/time of range - * @param d2 end date/time of range - */ - NS_IMETHOD QueueFetchByRange(nsIUser* pUser, nsILayer* pLayer, DateTime d1, DateTime d2); - - /** - * Perform all the queued fetches. - * @param pID the returned ID number associated with this set of fetches. - */ - NS_IMETHOD FlushFetchByRange(PRInt32* pID); - - /** - * Set the priority of the fetches belonging to the supplied ID number - * @param id the ID number of the fetches as returned by FlushFetchByRange. - * @param iPri the priority for their threads - */ - NS_IMETHOD SetPriority(PRInt32 id, PRInt32 iPri); - - /** - * Get the state associated with the ID'd fetches - * @param id the id of the fetch - * @param d1 its current state - */ - NS_IMETHOD GetState(PRInt32 ID, eCalNetFetchState *pState); - - /** - * Cancel everything associated with the fetch - * @param nsIUser user making the request - * @param d1 start date/time of range - * @param d2 end date/time of range - */ - NS_IMETHOD Cancel(nsILayer * aLayer); -}; - -#endif //nsCalNetFetchCollector_h__ diff --git a/mozilla/calendar/modules/core/inc/nsCalNetFetchCommand.h b/mozilla/calendar/modules/core/inc/nsCalNetFetchCommand.h deleted file mode 100644 index 0b925afd562..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalNetFetchCommand.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalNetFetchCommand_h__ -#define nsCalNetFetchCommand_h__ - -#include "nscalexport.h" -#include "nsCalNetFetchVals.h" -#include "nsICalNetFetchCommand.h" -#include "nsIArray.h" - - -class NS_CALENDAR nsCalNetFetchCommand -{ - - nsIArray * mpLayerList ; // all the layers that need the events from this range - -public: - nsCalNetFetchCommand(nsISupports* outer); - ~nsCalNetFetchCommand(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD UpdateRange(DateTime d1, DateTime d2); - NS_IMETHOD AddLayer(nsILayer* pLayer); - NS_IMETHOD Execute(PRInt32 iPri); - NS_IMETHOD Cancel(); -}; - -#endif //nsCalNetFetchCommand_h__ diff --git a/mozilla/calendar/modules/core/inc/nsCalNetFetchVals.h b/mozilla/calendar/modules/core/inc/nsCalNetFetchVals.h deleted file mode 100644 index fb2dede094a..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalNetFetchVals.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsCalNetFetchVals_h___ -#define nsCalNetFetchVals_h___ - -enum eCalNetFetchState { eCALNETFETCH_PAUSED, - eCALNETFETCH_COLLECTING, - eCALNETFETCH_EXECUTING, - eCALNETFETCH_COMPLETED }; - -#endif /* nsCalNetFetchVals_h___ */ \ No newline at end of file diff --git a/mozilla/calendar/modules/core/inc/nsCalSession.h b/mozilla/calendar/modules/core/inc/nsCalSession.h deleted file mode 100644 index 82bf2f2fbd8..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalSession.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * nsCalSession - * Maintains a list of active sessions, CURLs, and reference counts. - * - * sman - */ -#ifndef __NS_CAL_SESSION__ -#define __NS_CAL_SESSION__ - -#include "capi.h" -#include "nsICapi.h" -#include "nscalexport.h" - -class NS_CALENDAR nsCalSession -{ -public: - nsICapi * mCapi; - -protected: - JulianString m_sCurl; /* example: capi://cal.mcom.com/sman */ - PRInt32 m_iCount; /* a list of JulianString CalURL strings */ - long m_lFlags; /* login flags */ - -public: - nsCalSession(); - nsCalSession(const JulianString& sCurl, long lFlags); - nsCalSession(const char* psCurl, long lFlags); - virtual ~nsCalSession(); - - CAPISession m_Session; /* associated session */ - - /** - * @return the number of holders using this session - */ - PRInt32 GetUsageCount() const {return m_iCount;} - - /** - * @return the CURL associated with this session - */ - JulianString GetCurl() const {return m_sCurl;} - - /** - * Establish a CAPI session to the supplied curl. If a session already - * exists, bump the reference count and return the existing session. - * @return 0 on success - * CAPI errors associated with not getting a session. - */ - nsresult GetSession(CAPISession& s, const char* psPassword=0); - - /** - * Establish a CAPI session to the supplied curl. If a session already - * exists, bump the reference count and return the existing session. - * @return 0 on success - * CAPI errors associated with not getting a session. - */ - nsresult EstablishSession(const char* psPassword=0); - - /** - * Release the session. That is, a consumer is indicating that they - * are finished using the session. Decrement the usage count. - * The session should not be destroyed until the usage count is 0. - * @return 0 on success - */ - nsresult ReleaseSession(); - -}; - -#endif // __NS_CAL_SESSION__ diff --git a/mozilla/calendar/modules/core/inc/nsCalSessionMgr.h b/mozilla/calendar/modules/core/inc/nsCalSessionMgr.h deleted file mode 100644 index 42cd2fe0985..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalSessionMgr.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * nsCalSessionMgr.cpp: implementation of the nsCalSessionMgr class. - * This class manages the list of calendars currently in memory. - * All calendars that are to be displayed should be registered - * in this list. - */ - -#if !defined(AFX_NSCALSESSIONMGR_H__BC9A7773_3EF1_11D2_8ED1_000000000000__INCLUDED_) -#define AFX_NSCALSESSIONMGR_H__BC9A7773_3EF1_11D2_8ED1_000000000000__INCLUDED_ - -#include "jdefines.h" -#include "ptrarray.h" -#include "julnstr.h" -#include "nsCalSession.h" -#include "nscalexport.h" - -class NS_CALENDAR nsCalSessionMgr -{ - JulianPtrArray m_List; - -public: - - nsCalSessionMgr(); - virtual ~nsCalSessionMgr(); - - /** - * Get a session to the supplied curl. - * @param psCurl the curl to the calendar store - * @param psPassword the password needed for logging in - * @param s the session - * @return 0 on success - */ - nsresult GetSession(const char* psCurl, long lFlags, const char* psPassword, CAPISession& s); - - /** - * Get a session to the supplied curl. - * @param sCurl the curl to the calendar store - * @param psPassword the password needed for logging in - * @param s the session - * @return 0 on success - */ - nsresult GetSession(const JulianString sCurl, long lFlags, const char* psPassword, nsCalSession* &pCalSession); - - /** - * Release a session - * @param pUser pointer to the calendar to add - * @return 0 on success - * 1 if not found - */ - nsresult ReleaseSession(CAPISession& s); - - /** - * @return the session list - */ - JulianPtrArray* GetList() {return &m_List;} - - /** - * Shutdown and destroy all connected sessions. - * - * @return 0 on success - * otherwise the number of sessions that had problems shutting down. - */ - nsresult Shutdown(); - -protected: - /** - * Search for an existing session to this curl. - * - * @param psCurl pointer to the curl of this calendar store - * @param iStart start searching at this point in the list - * if iStart is < 0 it is snapped to 0. If it - * is >= list size, it is snapped to the last - * index. - * @param piFound the index of the calendar of the list that - * matches the psCurl. This value is always - * >= iStart when the return value is 0. It - * is returned as -1 if the curl cannot be found. - * @return 0 on success - * 1 if not found - */ - nsresult Find(char* psCurl, int iStart, int* piFound); - - /** - * Search for an existing session with the supplied CAPISession. - * - * @param s the session to search for - * @param iStart start searching at this point in the list - * if iStart is < 0 it is snapped to 0. If it - * is >= list size, it is snapped to the last - * index. - * @param piFound the index of the calendar of the list that - * matches the psCurl. This value is always - * >= iStart when the return value is 0. It - * is returned as -1 if the curl cannot be found. - * @return 0 on success - * 1 if not found - */ - nsresult Find(CAPISession s, int iStart, int* piFound); - -public: - /** - * Get the calendar session definition at the supplied index. - * @param i the index to fetch - * @return a pointer to the calendar session at the supplied index. - */ - NS_IMETHOD_(nsCalSession*) nsCalSessionMgr::GetAt(int i); -}; - -#endif /* !defined(AFX_NSCALSESSIONMGR_H__BC9A7773_3EF1_11D2_8ED1_000000000000__INCLUDED_) */ - - diff --git a/mozilla/calendar/modules/core/inc/nsCalStreamReader.h b/mozilla/calendar/modules/core/inc/nsCalStreamReader.h deleted file mode 100644 index 26750554af2..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalStreamReader.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef __NSQQnsCalStreamReader_H_ -#define __NSQQnsCalStreamReader_H_ - -#include "nscapiexport.h" -#include "ptrarray.h" -#include "icalredr.h" -#include "nsCapiCallbackReader.h" -#include "jutility.h" -#include "nspr.h" -#include "nscalexport.h" - -/** - * This class will be removed later. It is a hack I created to - * parse the MIME-message from the CS&T server fetch results. - * I will try to extract the iCalendar information from it. - * I will need to handle multi-threaded parsing somehow as well. - */ -class NS_CALENDAR nsCalStreamReader -{ -private: - static nsCalUtility::MimeEncoding stringToEncodingType(UnicodeString & propVal); - - - /* dont deallocate these */ - JulianPtrArray * m_OutCalendars; - nsCapiCallbackReader * m_Reader; - t_bool m_bParseStarted; - t_bool m_bParseFinished; - PRThread * m_Thread; - void * m_CallerData; - -public: - nsCalStreamReader(); - ~nsCalStreamReader(); - nsCalStreamReader( - nsCapiCallbackReader * reader, - JulianPtrArray * outCalendars, - PRThread * thread, - void* condvar); - t_bool isParseStarted() const { return m_bParseStarted; } - void setParseStarted() { m_bParseStarted = TRUE; } - - t_bool isParseFinished() const { return m_bParseFinished; } - void setParseFinished() { m_bParseFinished = TRUE; } - - nsCapiCallbackReader * getReader() const { return m_Reader; } - PRThread * getThread() const { return m_Thread; } - void * getCallerData() const { return m_CallerData; } - - void ParseCalendars( - ICalReader * reader, - JulianPtrArray * outCalendars); - - void ParseCalendars(); -}; - -#ifdef XP_CPLUSPLUS -extern "C"{ -#endif - - void NS_CAPIEXPORT main_CalStreamReader(void * jp); - -#ifdef XP_CPLUSPLUS -}; -#endif - -#endif /* __NSQQnsCalStreamReader_H_ */ - diff --git a/mozilla/calendar/modules/core/inc/nsCalUser.h b/mozilla/calendar/modules/core/inc/nsCalUser.h deleted file mode 100644 index a4a6eaccc82..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalUser.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * nsCalUser - * Simple abstraction for the owner of a calendar store. Applies - * to a resource or a person. This implementation assumes a single - * NSCalendar per user. - * - * sman - */ -#ifndef __NS_CAL_USER__ -#define __NS_CAL_USER__ -#include "nscalexport.h" - -class NS_CALENDAR nsCalUser -{ -private: - JulianString m_sUserName; /* example: sman */ - nsString m_sDisplayName; /* example: Steve Mansour */ - JulianPtrArray m_CalAddrList; /* a list of JulianString CalURL strings */ - NSCalendar* m_pCal; /* the preferred calendar account (the only one for now) */ - JulianPtrArray m_CalList; /* an array of calendars owned by this user */ - void InitMembers(); - -public: - nsCalUser(); - nsCalUser(JulianString& sUserName, nsString& sDisplayName); - nsCalUser(char* sUserName, char* sDisplayName); - virtual ~nsCalUser(); - - JulianString& GetUserName() {return m_sUserName;} - void SetUserName(char* psName) {m_sUserName = psName; } - - nsString& GetDisplayName() {return m_sDisplayName;} - void SetDisplayName(char* psName) { m_sDisplayName = psName; } - - JulianPtrArray* GetCalAddrList() {return &m_CalAddrList;} - JulianPtrArray* GetCalList() {return &m_CalList;} - - /** - * Add a calendar address to the list of calendar addresses for this user - * @param psAddr the CURL pointing to the calendar store. - * @return 0 = success - * 1 = failure - */ - nsresult AddCalAddr(JulianString* psAddr); - JulianString* GetPreferredCalAddr(); - - NSCalendar* GetNSCal() {return m_pCal;} - -}; - -#endif // __NS_CAL_USER__ diff --git a/mozilla/calendar/modules/core/inc/nsCalUserList.h b/mozilla/calendar/modules/core/inc/nsCalUserList.h deleted file mode 100644 index 6ef7f8f7599..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalUserList.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * nsICalendarUserList.cpp: implementation of the nsICalendarUserList class. - * This class manages the list of calendars currently in memory. - * All calendars that are to be displayed should be registered - * in this list. - */ - -#if !defined(AFX_nsICalendarUserLIST_H__BC9A7773_3EF1_11D2_8ED1_000000000000__INCLUDED_) -#define AFX_nsICalendarUserLIST_H__BC9A7773_3EF1_11D2_8ED1_000000000000__INCLUDED_ - -#include "jdefines.h" -#include "ptrarray.h" -#include "nscalexport.h" -#include "nsICalendarUser.h" - -class NS_CALENDAR nsCalUserList -{ -public: - JulianPtrArray m_List; - - nsCalUserList(); - virtual ~nsCalUserList(); - - /** - * Add a user calendar to the list - * @param pUser pointer to the user to add - * @return 0 on success - */ - nsresult Add(nsICalendarUser* pUser); - - /** - * Delete the user matching the supplied pointer. - * @param pUser pointer to the calendar to add - * @return 0 on success - * 1 if not found - */ - nsresult Delete(nsICalendarUser* pUser); - - /** - * Delete all users having the supplied cal url - * @param pCurl pointer to the curl of this calendar store - * @return 0 on success - * 1 if not found - */ - nsresult Delete(char* psCurl); - - /** - * Search for a user. - * @param psCurl pointer to the curl of this calendar store - * @param iStart start searching at this point in the list - * if iStart is < 0 it is snapped to 0. If it - * is >= list size, it is snapped to the last - * index. - * @param piFound the index of the calendar of the list that - * matches the psCurl. This value is always - * >= iStart when the return value is 0. It - * is returned as -1 if the curl cannot be found. - * @return 0 on success - * 1 if not found - */ - nsresult Find(char* psCurl, int iStart, int* piFound); - - /** - * Get the calendar at the supplied index. - * @param i the index of the calendar to fetch - * @return 0 if the index is bad, otherwise it is a pointer - * to the calendar at index i in the list - */ - nsICalendarUser* GetAt(int i); - -}; - -#endif /* !defined(AFX_nsICalendarUserLIST_H__BC9A7773_3EF1_11D2_8ED1_000000000000__INCLUDED_) */ - - diff --git a/mozilla/calendar/modules/core/inc/nsCalendarModel.h b/mozilla/calendar/modules/core/inc/nsCalendarModel.h deleted file mode 100644 index 12dfc4b8d58..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalendarModel.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalendarModel_h___ -#define nsCalendarModel_h___ - -#include "nscalexport.h" -#include "nsIModel.h" -#include "nsICalendarModel.h" -#include "nsICalendarUser.h" -#include "nsIXPFCObserver.h" -#include "nsIXPFCCommandReceiver.h" -#include "nsIXPFCSubject.h" - -class nsXPFCNotificationStateCommand; -class nsCalFetchEventsCommand; - -class nsCalendarModel : public nsICalendarModel, - public nsIModel, - public nsIXPFCObserver, - public nsIXPFCSubject, - public nsIXPFCCommandReceiver -{ - -public: - nsCalendarModel(nsISupports* outer); - ~nsCalendarModel(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - NS_IMETHOD GetCalendarUser(nsICalendarUser *& aCalendarUser); - NS_IMETHOD SetCalendarUser(nsICalendarUser* aCalendarUser); - - // nsIXPFCObserver methods - NS_IMETHOD_(nsEventStatus) Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand); - - // nsIXPFCCommandReceiver methods - NS_IMETHOD_(nsEventStatus) Action(nsIXPFCCommand * aCommand); - - // nsIXPFCSubject methods - NS_IMETHOD Attach(nsIXPFCObserver * aObserver); - NS_IMETHOD Detach(nsIXPFCObserver * aObserver); - NS_IMETHOD Notify(nsIXPFCCommand * aCommand); - -private: - NS_IMETHOD HandleNotificationCommand(nsXPFCNotificationStateCommand * aCommand); - NS_IMETHOD HandleFetchCommand(nsCalFetchEventsCommand * aCommand); - NS_IMETHOD SendModelUpdateCommand(); - -protected: - nsICalendarUser * mCalendarUser; - -}; - -#endif //nsCalendarModel_h___ diff --git a/mozilla/calendar/modules/core/inc/nsCalendarUser.h b/mozilla/calendar/modules/core/inc/nsCalendarUser.h deleted file mode 100644 index 5350ab3db2f..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCalendarUser.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalendarUser_h___ -#define nsCalendarUser_h___ - -#include "nscalexport.h" -#include "nsICalendarUser.h" -#include "nsIUser.h" -#include "nsILayer.h" - -class NS_CALENDAR nsCalendarUser : public nsICalendarUser -{ - -public: - nsCalendarUser(nsISupports* outer); - ~nsCalendarUser(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - NS_IMETHOD GetLayer(nsILayer *& aLayer); - NS_IMETHOD SetLayer(nsILayer* aLayer); - - /** - * Check to see whether or not the user has a particular layer - * in the list of layers that make up their calendar. - * @param aCurl the curl containing the host and csid - * @param aContains return value set to PR_TRUE if the user's - * calendar list contains the specified curl - * or PR_FALSE otherwise. - * @return NS_OK on success. - */ - NS_IMETHOD HasLayer(const JulianString& aCurl,PRBool& aContains); - -protected: - nsISupports * mpUserSupports; - nsILayer * mpLayer; - -}; - -#endif //nsCalendarUser_h___ diff --git a/mozilla/calendar/modules/core/inc/nsCapiCallbackReader.h b/mozilla/calendar/modules/core/inc/nsCapiCallbackReader.h deleted file mode 100644 index 7d1acaee11b..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCapiCallbackReader.h +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * capiredr.h - * John Sun - * 4/16/98 3:31:51 PM - */ -#ifndef __NSQQnsCapiCallbackReader_H_ -#define __NSQQnsCapiCallbackReader_H_ - -#include "nscapiexport.h" -#include "jdefines.h" -#include -#include "ptrarray.h" -#include "icalredr.h" -#include "prmon.h" -#include "jutility.h" -#include "nscalexport.h" - -/** - * nsCapiBufferStruct is contains the data passed in by the callback in CAPI. - * This struct encapsulates the data in m_pBuf, - * and the size of the passed in data in m_pBufSize. - */ -class NS_CALENDAR nsCapiBufferStruct -{ -public: - char * m_pBuf; - size_t m_pBufSize; -}; - -/** - * nsCapiCallbackReader is a subclass of ICalReader. It implements - * the ICalReader interface to work with CAPI callback method - * to parse from stream. - * Uses multiple threads. - */ -class NS_CALENDAR nsCapiCallbackReader -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - - /* current buffer of iCal information, - * when CAPI has information to return to - * the buffer, it must append to this buffer - * when no more full-lines can be made from the - * buffer, block on the monitor. Will be - * notified when CAPI gets back more information - */ - char * m_Buffer; - - t_int32 m_BufferSize; - t_bool m_Init; - t_int32 m_Mark; - t_int32 m_ChunkMark; - t_int32 m_Pos; - t_int32 m_ChunkIndex; - - - /** encoding of stream */ - nsCalUtility::MimeEncoding m_Encoding; - - /** need to deallocate */ - JulianPtrArray * m_Chunks; - - static const t_int32 m_MAXBUFFERSIZE; - static const t_int32 m_NOMORECHUNKS; - - /* finished getting input from CAPI callback */ - t_bool m_bFinished; - - /** do not deallocate */ - PRMonitor * m_Monitor; - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - - UnicodeString & createLine(t_int32 oldPos, t_int32 oldChunkIndex, - t_int32 newPos, t_int32 newChunkIndex, UnicodeString & aLine); - - static void deleteCapiBufferStructVector(JulianPtrArray * bufferVector); - - nsCapiCallbackReader(); -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - nsCapiCallbackReader(PRMonitor * monitor, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - ~nsCapiCallbackReader(); - - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - - virtual void * getMonitor() { return m_Monitor; } - - void setFinished() { m_bFinished = TRUE; } - void setEncoding(nsCalUtility::MimeEncoding encoding) { m_Encoding = encoding; } - t_bool isFinished() const { return m_bFinished; } - - /** - * Don't delete u until this object is deleted. - * @param nsCapiBufferStruct * cBuf - * - * @return void - */ - void AddBuffer(nsCapiBufferStruct * cBuf); - /*----------------------------- - ** UTILITIES - **---------------------------*/ - - void mark() { m_Mark = m_Pos; m_ChunkMark = m_ChunkIndex;} - - void reset() { m_Pos = m_Mark; m_ChunkIndex = m_ChunkMark; m_Mark = -1; m_ChunkMark = -1; } - - /** - * Read next character from file. - * - * @param status, return 1 if no more characters - * @return next character of string - */ - virtual t_int8 read(ErrorCode & status); - - /** - * Read the next ICAL full line of the file. The definition - * of a full ICAL line can be found in the ICAL spec. - * Basically, a line followed by a CRLF and a space character - * signifies that the next line is a continuation of the previous line. - * Uses the readLine, read methods. - * - * @param aLine, returns next full line of string - * @param status, return 1 if no more lines - * - * @return next full line of string - */ - virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0); - - /** - * Read next line of file. A line is defined to be - * characters terminated by either a '\n', '\r' or "\r\n". - * @param aLine, return next line of string - * @param status, return 1 if no more lines - * - * @return next line of string - */ - virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status); - -}; - -#endif /* __NSQQnsCapiCallbackReader_H_ */ - diff --git a/mozilla/calendar/modules/core/inc/nsCoreCIID.h b/mozilla/calendar/modules/core/inc/nsCoreCIID.h deleted file mode 100644 index a41c149cb52..00000000000 --- a/mozilla/calendar/modules/core/inc/nsCoreCIID.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCoreCIID_h__ -#define nsCoreCIID_h__ - -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsRepository.h" -#include "nscalexport.h" - -// d4797370-4cc8-11d2-924a-00805f8a7ab6 -#define NS_LAYER_CID \ -{ 0xd4797370, 0x4cc8, 0x11d2, \ - {0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } - -// dabe52d0-4ccb-11d2-924a-00805f8a7ab6 -#define NS_LAYER_COLLECTION_CID \ -{ 0xdabe52d0, 0x4ccb, 0x11d2, \ - {0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } - -// 6858eab0-4cd8-11d2-924a-00805f8a7ab6 -#define NS_CALENDAR_USER_CID \ -{ 0x6858eab0, 0x4cd8, 0x11d2, \ - {0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } - -// fd439e90-4e67-11d2-924a-00805f8a7ab6 -#define NS_CALENDAR_MODEL_CID \ -{ 0xfd439e90, 0x4e67, 0x11d2, \ - {0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } - -//ea7225c0-6313-11d2-b564-0060088a4b1d -#define NS_CAL_NET_FETCH_COLLECTOR_CID \ - { 0xea7225c0, 0x6313, 0x11d2, \ - { 0xb5, 0x64, 0x00, 0x60, 0x08, 0x8a, 0x4b, 0x1d } } - -#endif diff --git a/mozilla/calendar/modules/core/inc/nsLayer.h b/mozilla/calendar/modules/core/inc/nsLayer.h deleted file mode 100644 index 6f781daa059..00000000000 --- a/mozilla/calendar/modules/core/inc/nsLayer.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsLayer_h___ -#define nsLayer_h___ - -#include "nscalexport.h" -#include "nsILayer.h" - -class nsCalendarShell; - -class NS_CALENDAR nsLayer : public nsILayer -{ - - JulianString msCurl; - NSCalendar* mpCal; - nsCalendarShell* mpShell; - -public: - nsLayer(nsISupports* outer); - ~nsLayer(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD SetCurl(const JulianString& s); - NS_IMETHOD GetCurl(JulianString& s); - - /** - * Check to see if the layer matches the supplied curl. - * In this case, matching means that the host and CSID - * values are equal. - * @param s the curl - * @return NS_OK on success - */ - NS_IMETHOD URLMatch(const JulianString& aCurl, PRBool& aMatch); - - NS_IMETHOD SetCal(NSCalendar* aCal); - NS_IMETHOD GetCal(NSCalendar*& aCal); - NS_IMETHOD SetShell(nsCalendarShell* aShell) {mpShell = aShell; return NS_OK;} - NS_IMETHOD FetchEventsByRange( - DateTime* aStart, - DateTime* aStop, - JulianPtrArray* anArray - ); - - NS_IMETHOD StoreEvent(VEvent& addEvent); - -private: - nsresult FetchEventsByRange(); -}; - -#endif //nsLayer_h___ diff --git a/mozilla/calendar/modules/core/inc/nsLayerCollection.h b/mozilla/calendar/modules/core/inc/nsLayerCollection.h deleted file mode 100644 index 8d157e9761b..00000000000 --- a/mozilla/calendar/modules/core/inc/nsLayerCollection.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsLayerCollection_h___ -#define nsLayerCollection_h___ - -#include "nscalexport.h" -#include "nsILayer.h" -#include "nsILayerCollection.h" -#include "nsIArray.h" - - -class NS_CALENDAR nsLayerCollection : public nsILayerCollection, - nsILayer -{ - -public: - nsLayerCollection(nsISupports* outer); - ~nsLayerCollection(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD CreateIterator(nsIIterator ** aIterator) ; - NS_IMETHOD AddLayer(nsILayer * aLayer); - NS_IMETHOD RemoveLayer(nsILayer * aLayer); - - NS_IMETHOD SetShell(nsCalendarShell* aShell); - NS_IMETHOD SetCurl(const JulianString& s); - NS_IMETHOD GetCurl(JulianString& s); - - /** - * Check to see if any layer matches the supplied curl. - * In this case, matching means that the host and CSID - * values are equal. - * @param s the curl - * @return NS_OK on success - */ - NS_IMETHOD URLMatch(const JulianString& aCurl, PRBool& aMatch); - - NS_IMETHOD SetCal(NSCalendar* aCal); - NS_IMETHOD GetCal(NSCalendar*& aCal); - NS_IMETHOD FetchEventsByRange( - DateTime* aStart, - DateTime* aStop, JulianPtrArray* aL - ); - - NS_IMETHOD StoreEvent(VEvent& addEvent); -private: - nsIArray * mLayers ; - nsCalendarShell * mpShell; - -}; - -#endif //nsLayerCollection_h___ diff --git a/mozilla/calendar/modules/core/manifest.mn b/mozilla/calendar/modules/core/manifest.mn deleted file mode 100644 index 9608fd06d1e..00000000000 --- a/mozilla/calendar/modules/core/manifest.mn +++ /dev/null @@ -1,28 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../.. -DEPTH = ../../.. - -DIRS = ical src capi - -DIRS_EXPORT = public inc - -LIBRARY_NAME = calcore - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = xpcom raptor shell trex - diff --git a/mozilla/calendar/modules/core/public/Makefile b/mozilla/calendar/modules/core/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/core/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/public/manifest.mn b/mozilla/calendar/modules/core/public/manifest.mn deleted file mode 100644 index 1edea369605..00000000000 --- a/mozilla/calendar/modules/core/public/manifest.mn +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -EXPORTS = \ - nsILayer.h \ - nsILayerCollection.h \ - nsICalendarUser.h \ - nsICalendarModel.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor shell diff --git a/mozilla/calendar/modules/core/public/nsICalNetFetchCollector.h b/mozilla/calendar/modules/core/public/nsICalNetFetchCollector.h deleted file mode 100644 index f7d07350694..00000000000 --- a/mozilla/calendar/modules/core/public/nsICalNetFetchCollector.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsICalNetFetchCollector_h___ -#define nsICalNetFetchCollector_h___ - -#include "nsISupports.h" -#include "nsCalNetFetchVals.h" - -//09176270-638f-11d2-b566-0060088a4b1d -#define NS_ICAL_NET_FETCH_COLLECTOR_IID \ - { 0x09176270, 0x638f, 0x11d2, \ - { 0xb5, 0x66, 0x00, 0x60, 0x08, 0x8a, 0x4b, 0x1d } } - -class nsICalNetFetchCollector : public nsISupports -{ - -public: - NS_IMETHOD Init() = 0; - - /** - * Register a fetch by range, but don't perform it yet. - * @param nsIUser user making the request - * @param pLayer - * @param d1 start date/time of range - * @param d2 end date/time of range - */ - NS_IMETHOD QueueFetchEventsByRange(nsILayer* pLayer, DateTime d1, DateTime d2) = 0; - - /** - * Perform all the queued fetches. - * @param pID the returned ID number associated with this set of fetches. - */ - NS_IMETHOD FlushFetchEventsByRange(PRInt32* pID) = 0; - - /** - * Set the priority of the fetches belonging to the supplied ID number - * @param id the ID number of the fetches as returned by FlushFetchByRange. - * @param iPri the priority for their threads - */ - NS_IMETHOD SetPriority(PRInt32 id, PRInt32 iPri) = 0; - - /** - * Get the state associated with the ID'd fetches - * @param id the id of the fetch - * @param d1 its current state - */ - NS_IMETHOD GetState(PRInt32 id, eCalNetFetchState *pState) = 0; - - /** - * Cancel everything associated with the fetch - * @param nsIUser user making the request - * @param d1 start date/time of range - * @param d2 end date/time of range - */ - NS_IMETHOD Cancel(PRInt32 id) = 0; - -private: - PRInt32 GetNextID(); -}; - - -#endif /* nsICalNetFetchCollector */ \ No newline at end of file diff --git a/mozilla/calendar/modules/core/public/nsICalendarModel.h b/mozilla/calendar/modules/core/public/nsICalendarModel.h deleted file mode 100644 index e49af2bbfee..00000000000 --- a/mozilla/calendar/modules/core/public/nsICalendarModel.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsICalendarModel_h___ -#define nsICalendarModel_h___ - -#include "nsISupports.h" -#include "nsILayer.h" - -//317353e0-4e66-11d2-924a-00805f8a7ab6 -#define NS_ICALENDAR_MODEL_IID \ -{ 0x317353e0, 0x4e66, 0x11d2, \ -{ 0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -class nsICalendarUser ; - -class nsICalendarModel : public nsISupports -{ - -public: - NS_IMETHOD Init() = 0; - - NS_IMETHOD GetCalendarUser(nsICalendarUser *& aCalendarUser) = 0; - NS_IMETHOD SetCalendarUser(nsICalendarUser* aCalendarUser) = 0; - -}; - - -#endif /* nsICalendarModel */ diff --git a/mozilla/calendar/modules/core/public/nsICalendarUser.h b/mozilla/calendar/modules/core/public/nsICalendarUser.h deleted file mode 100644 index 6acba0d8e5e..00000000000 --- a/mozilla/calendar/modules/core/public/nsICalendarUser.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsICalendarUser_h___ -#define nsICalendarUser_h___ - -#include "nsISupports.h" -#include "nsILayer.h" - -//2fa12310-4cd8-11d2-924a-00805f8a7ab6 -#define NS_ICALENDAR_USER_IID \ -{ 0x2fa12310, 0x4cd8, 0x11d2, \ -{ 0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -class nsICalendarUser : public nsISupports -{ - -public: - NS_IMETHOD Init() = 0; - - NS_IMETHOD GetLayer(nsILayer *& aLayer) = 0; - NS_IMETHOD SetLayer(nsILayer* aLayer) = 0; - NS_IMETHOD HasLayer(const JulianString& aCurl,PRBool& aContains) = 0; - -}; - - -#endif /* nsICalendarUser */ diff --git a/mozilla/calendar/modules/core/public/nsILayer.h b/mozilla/calendar/modules/core/public/nsILayer.h deleted file mode 100644 index 4948d3d0bb1..00000000000 --- a/mozilla/calendar/modules/core/public/nsILayer.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsILayer_h___ -#define nsILayer_h___ - -#include "nsISupports.h" -#include "jdefines.h" -#include "julnstr.h" -#include "vevent.h" - -//5482d0d0-4cca-11d2-924a-00805f8a7ab6 -#define NS_ILAYER_IID \ -{ 0x5482d0d0, 0x4cca, 0x11d2, \ -{ 0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -class NSCalendar; -class DateTime; -class JulianPtrArray; -class nsCalendarShell; - -class nsILayer : public nsISupports -{ - -public: - NS_IMETHOD Init() = 0; - - /** - * Set the curl that points to the cal store - * @param s the curl - * @return NS_OK on success - */ - NS_IMETHOD SetCurl(const JulianString& s) = 0; - - /** - * Set the shell pointer - * @param s the curl - * @return NS_OK on success - */ - NS_IMETHOD SetShell(nsCalendarShell* aShell) = 0; - - /** - * Get the curl that points to the cal store - * @param s the curl - * @return NS_OK on success - */ - NS_IMETHOD GetCurl(JulianString& s) = 0; - - /** - * Check to see if the layer matches the supplied curl. - * In this case, matching means that the host and CSID - * values are equal. - * @param s the curl - * @return NS_OK on success - */ - NS_IMETHOD URLMatch(const JulianString& aCurl, PRBool& aMatch) = 0; - - NS_IMETHOD SetCal(NSCalendar* aCal) = 0; - NS_IMETHOD GetCal(NSCalendar*& aCal) = 0; - NS_IMETHOD FetchEventsByRange( - DateTime* aStart, - DateTime* aStop, - JulianPtrArray* anArray - ) = 0; - - /** - * Save an event in this layer - * @param addEvent the new event to save - * @return NS_OK on success - */ - NS_IMETHOD StoreEvent(VEvent& addEvent) = 0; - -}; - - -#endif /* nsILayer */ diff --git a/mozilla/calendar/modules/core/public/nsILayerCollection.h b/mozilla/calendar/modules/core/public/nsILayerCollection.h deleted file mode 100644 index 5fc3c4dd403..00000000000 --- a/mozilla/calendar/modules/core/public/nsILayerCollection.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsILayerCollection_h___ -#define nsILayerCollection_h___ - -#include "nsISupports.h" -#include "nsIIterator.h" - -//91cd3b90-4ccb-11d2-924a-00805f8a7ab6 -#define NS_ILAYER_COLLECTION_IID \ -{ 0x91cd3b90, 0x4ccb, 0x11d2, \ -{ 0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -class nsILayerCollection : public nsISupports -{ - -public: - NS_IMETHOD Init() = 0; - - NS_IMETHOD CreateIterator(nsIIterator ** aIterator) = 0; - - NS_IMETHOD AddLayer(nsILayer * aLayer) = 0; - NS_IMETHOD RemoveLayer(nsILayer * aLayer) = 0; - - - -}; - - -#endif /* nsILayerCollection */ diff --git a/mozilla/calendar/modules/core/src/Makefile b/mozilla/calendar/modules/core/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/core/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/core/src/config.mk b/mozilla/calendar/modules/core/src/config.mk deleted file mode 100644 index 6e81c895a21..00000000000 --- a/mozilla/calendar/modules/core/src/config.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -I$(GDEPTH)/include - -ifeq ($(OS_ARCH), WINNT) -CFLAGS += /Zm1000 -endif - -LIBRARY_NAME = cal_core_src -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY=1 - -#AR_LIBS += \ -# cal_core_ical \ -# $(NULL) - -EXTRA_LIBS += $(NSPR_LIBS) \ No newline at end of file diff --git a/mozilla/calendar/modules/core/src/manifest.mn b/mozilla/calendar/modules/core/src/manifest.mn deleted file mode 100644 index 4734cbbcfe8..00000000000 --- a/mozilla/calendar/modules/core/src/manifest.mn +++ /dev/null @@ -1,38 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalUserList.cpp \ - nsCalList.cpp \ - nsCalLoggedInUser.cpp \ - nsCalSession.cpp \ - nsCalSessionMgr.cpp \ - nsCalUser.cpp \ - nsLayer.cpp \ - nsLayerCollection.cpp \ - nsCoreFactory.cpp \ - nsCalendarUser.cpp \ - nsCalendarModel.cpp \ - nsCalStreamReader.cpp \ - nsCapiCallbackReader.cpp \ - $(NULL) - - -REQUIRES = xpcom raptor shell trex julian nls netlib pref js xpfc - diff --git a/mozilla/calendar/modules/core/src/nsCalList.cpp b/mozilla/calendar/modules/core/src/nsCalList.cpp deleted file mode 100644 index fb92267439d..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalList.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * nsCalList.cpp: implementation of the nsCalList class. - * This class manages the list of calendars currently in memory. - * All calendars that are to be displayed should be registered - * in this list. - */ - -#include "jdefines.h" -#include "julnstr.h" -#include "nsString.h" -#include "ptrarray.h" -#include "nscal.h" -#include "nspr.h" -#include "nsCalList.h" - -nsCalList::nsCalList() -{ -} - -nsCalList::~nsCalList() -{ -} - -/** - * Add a calendar to the list - * @param pCal pointer to the calendar to add - * @return 0 on success - * 1 problems adding the calendar - * 2 already in the list - */ -nsresult nsCalList::Add(NSCalendar* pCal) -{ - int index = m_List.FindIndex(0, pCal); - if (index != -1) - { - if (0 > m_List.Add(pCal)) - return 1; - return 0; - } - return 2; -} - -/** - * Delete the calendar matching the supplied pointer. - * @param pCal pointer to the calendar to add - * @return 0 on success - * 1 if not found - */ -nsresult nsCalList::Delete(NSCalendar* pCal) -{ - return (1 == m_List.Remove(pCal)) ? 0 : 1; - -} - -/** - * Delete all calendars having the supplied cal url - * @param pCurl pointer to the curl of this calendar store - * @return 0 on success - * 1 if not found - */ -nsresult nsCalList::Delete(char* psCurl) -{ - int i; - nsresult s = Find(psCurl,0,&i); - m_List.RemoveAt(i,1); - return NS_OK; -} - -/** - * Search for a calendar. - * @param psCurl pointer to the curl of this calendar store - * @param iStart start searching at this point in the list - * if iStart is < 0 it is snapped to 0. If it - * is >= list size, it is snapped to the last - * index. - * @param piFound the index of the calendar of the list that - * matches the psCurl. This value is always - * >= iStart when the return value is 0. It - * is returned as -1 if the curl cannot be found. - * @return 0 on success - * 1 if not found - */ -nsresult nsCalList::Find(char* psCurl, int iStart, int* piFound) -{ - NSCalendar* pCal; - *piFound = -1; - if (m_List.GetSize() > 0) - { - if (iStart >= m_List.GetSize()) - iStart = m_List.GetSize() - 1; - for (int i = 0; i < m_List.GetSize(); i++) - { - pCal = (NSCalendar*) m_List.GetAt(i); - if (0 != pCal) - { - if ( pCal->getCurl() == psCurl ) - { - *piFound = i; - return NS_OK; - } - } - } - } - return 1; -} - -/** - * Get the calendar at the supplied index. - * @param i the index of the calendar to fetch - * @return a pointer to the calendar at the supplied index. - */ -NSCalendar* nsCalList::GetAt(int i) -{ - return (NSCalendar*) m_List.GetAt(i); -} - diff --git a/mozilla/calendar/modules/core/src/nsCalLoggedInUser.cpp b/mozilla/calendar/modules/core/src/nsCalLoggedInUser.cpp deleted file mode 100644 index d4f16f2108e..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalLoggedInUser.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * nsCalLoggedInUser - * Enhances nsCalUser by adding a local capi address and a password. - * - * sman - */ -#include "jdefines.h" -#include "ptrarray.h" -#include "julnstr.h" -#include "nsString.h" -#include "nscal.h" -#include "nsCalUser.h" -#include "nsCalLoggedInUser.h" - -nsCalLoggedInUser::nsCalLoggedInUser() -{ -} - -nsCalLoggedInUser::~nsCalLoggedInUser() -{ -} - diff --git a/mozilla/calendar/modules/core/src/nsCalNetFetchCollector.cpp b/mozilla/calendar/modules/core/src/nsCalNetFetchCollector.cpp deleted file mode 100644 index 96e4989b05e..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalNetFetchCollector.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#include -#include "nscore.h" -#include "nsCoreCIID.h" -#include "nsxpfcCIID.h" - -static PRInt32 gsiID = 0; - -PRInt32 nsCalNetFetchCollector::GetNextID() -{ - return gsiID++; -} - -nsCalNetFetchCollector::nsCalNetFetchCollector(nsISupports* outer) -{ - NS_INIT_REFCNT(); - mpFetchList = nsnull; -} - -// is this needed for a singleton? -NS_IMPL_ADDREF(nsCalNetFetchCollector) -NS_IMPL_RELEASE(nsCalNetFetchCollector) - -nsCalNetFetchCollector::~nsCalNetFetchCollector() -{ - /* - * destroy anything in the list... - */ - NS_IF_RELEASE(mpFetchList); -} - -nsresult nsCalNetFetchCollector::Init() -{ - static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID); - - nsresult res = nsRepository::CreateInstance(kCVectorCID, nsnull, kCVectorCID, (void **)&mpFetchList); - if (NS_OK != res) - return res ; - mpFetchList->Init(); - return (NS_OK); -} - -nsresult nsCalNetFetchCollector::QueueFetchByRange(nsIUser* pUser, nsILayer* pLayer, DateTime d1, DateTime d2) -{ - return (NS_OK); -} - -nsresult nsCalNetFetchCollector::FlushFetchByRange(PRInt32* pID) -{ - return (NS_OK); -} - -nsresult nsCalNetFetchCollector::SetPriority(PRInt32 id, PRInt32 iPri) -{ - return (NS_OK); -} - -nsresult nsCalNetFetchCollector::GetState(PRInt32 ID, eCalNetFetchState *pState) -{ - return (NS_OK); -} - -nsresult nsCalNetFetchCollector::Cancel(nsILayer * aLayer) -{ - return (NS_OK); -} - - diff --git a/mozilla/calendar/modules/core/src/nsCalSession.cpp b/mozilla/calendar/modules/core/src/nsCalSession.cpp deleted file mode 100644 index 773dc5d8b2c..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalSession.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * nsCalSession - * Maintains a list of active sessions, CURLs, and reference counts. - * - * sman - */ - -#include "jdefines.h" -#include "julnstr.h" -#include "nsString.h" -#include "ptrarray.h" -#include "nscal.h" -#include "nspr.h" -#include "capi.h" -#include "nsCalSession.h" -#include "nsICapi.h" -#include "nsICapiLocal.h" -#include "nsCapiCIID.h" -#include "nsCurlParser.h" - -static NS_DEFINE_IID(kCCapiLocalCID, NS_CAPI_LOCAL_CID); -static NS_DEFINE_IID(kCCapiCSTCID, NS_CAPI_CST_CID); -static NS_DEFINE_IID(kICapiIID, NS_ICAPI_IID); -static NS_DEFINE_IID(kICapiLocalIID, NS_ICAPI_LOCAL_IID); - - -/* - * m_iCount -> 0 - n means that it is in use and that this is - * this is the current number of users. A value - * of 0 just means that it has been created but - * no session has yet been established to the - * server. - * -1 means that it has been used, released by - * everyone who was using it, and is now ready - * to be destroyed. - */ -nsCalSession::nsCalSession() -{ - m_sCurl = ""; - m_Session = 0; - m_iCount = 0; - m_lFlags = 0; - mCapi = nsnull; -} - -nsCalSession::nsCalSession(const JulianString& sCurl, long lFlags) -{ - m_sCurl = sCurl; - m_Session = 0; - m_iCount = 0; - m_lFlags = lFlags; - mCapi = nsnull; -} - -nsCalSession::nsCalSession(const char* psCurl, long lFlags) -{ - m_sCurl = psCurl; - m_Session = 0; - m_iCount = 0; - m_lFlags = lFlags; - mCapi = nsnull; -} - -nsCalSession::~nsCalSession() -{ - NS_IF_RELEASE(mCapi); -} - -/** - * Establish a CAPI session to the supplied curl. If a session already - * exists, bump the reference count and return the existing session. - * If the value of s is 0 on return, there was a problem getting the - * session. - * @return 0 on success - * 1 general failure - * CAPI errors associated with not getting a session. - */ -nsresult nsCalSession::GetSession(CAPISession& Session, const char* psPassword) -{ - Session = 0; - nsresult res = EstablishSession(psPassword); - ++m_iCount; - Session = m_Session; - return res; -} - -/** - * Establish a CAPI session. If a session already - * exists, bump the reference count and return the existing session. - * If the value of s is 0 on return, there was a problem getting the - * session. - * @return 0 on success - * 1 general failure - * CAPI errors associated with not getting a session. - */ -nsresult nsCalSession::EstablishSession(const char* psPassword) -{ - nsresult res = NS_OK; - if (0 == m_Session) - { - CAPIStatus s; - nsICapiLocal * capi_local = nsnull; - - if ( m_sCurl == "") - return 1; - - /* - * Create an nsICapi Instance - * - * TODO: The CID should be based on the type of url passed in! - * For now, do local capi - */ - res = 1; - nsCurlParser cp(m_sCurl); - switch ( cp.GetProtocol() ) - { - case nsCurlParser::eFILE: - res = nsRepository::CreateInstance(kCCapiLocalCID,nsnull,kICapiIID,(void**)&mCapi); - break; - - case nsCurlParser::eCAPI: - { - res = nsRepository::CreateInstance(kCCapiCSTCID,nsnull, kICapiIID, (void**)&mCapi); - } - break; - } - - if (NS_OK != res) - return res; - - mCapi->Init(); - - /* - * Since we believe this to be local capi, see if the capi - * object we created supports the nsICapiLocal interface - */ - res = mCapi->QueryInterface(kICapiLocalIID,(void**)&capi_local); - - if (NS_OK == res) - { - /* - * Do the CAPI login - */ - s = capi_local->CAPI_LogonCurl(m_sCurl.GetBuffer(), psPassword, m_lFlags, &m_Session); - NS_RELEASE(capi_local); - } - else - { - /* - * use standard login... - * Try several things for the user name - */ - JulianString sName; - JulianString sPW; - JulianString sHost = cp.GetHost(); - if ( cp.GetUser() != "" ) - sName = cp.GetUser(); - else - sName = cp.GetExtra(); - - if (cp.GetPassword() != "") - sPW = cp.GetPassword(); - else - sPW = psPassword; - - s = mCapi->CAPI_Logon( - sName.GetBuffer(), sPW.GetBuffer(), - sHost.GetBuffer(), m_lFlags, &m_Session); - } - - if (CAPI_ERR_OK != s) - return res; - } - - return res; -} - -/** - * Release the session. That is, a consumer is indicating that they - * are finished using the session. Decrement the usage count. - * The session should not be destroyed until the usage count is 0. - * @return 0 on success - * CAPI logoff errors - */ -nsresult nsCalSession::ReleaseSession() -{ - if (--m_iCount <= 0) - { - m_iCount = -1; - - /* - * do a capi logoff here... - */ - CAPIStatus s = mCapi->CAPI_Logoff(&m_Session, 0L); - if (CAPI_ERR_OK != s) - return (nsresult) s; - } - return NS_OK; -} diff --git a/mozilla/calendar/modules/core/src/nsCalSessionMgr.cpp b/mozilla/calendar/modules/core/src/nsCalSessionMgr.cpp deleted file mode 100644 index 088add07894..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalSessionMgr.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * nsCalSessionMgr.cpp: implementation of the nsCalSessionMgr class. - * This class manages the list of sessions to calendar stores. When - * a session is needed, this class should be called to grant it. - */ - -#include "jdefines.h" -#include "julnstr.h" -#include "nsString.h" -#include "ptrarray.h" -#include "nscal.h" -#include "nspr.h" -#include "nsCurlParser.h" -#include "nsCalSession.h" -#include "nsCalSessionMgr.h" - -nsCalSessionMgr::nsCalSessionMgr() -{ -} - -nsCalSessionMgr::~nsCalSessionMgr() -{ -} - -/** - * Shut down all sessions. - * @return 0 on success - * otherwise the number of sessions that had problems shutting - * down. - */ -nsresult nsCalSessionMgr::Shutdown() -{ - nsCalSession* pSession; - int j, iCount; - int iErrors = 0; - - /* - * Shut down any open sessions... - */ - for (int i = 0; i < m_List.GetSize(); i++) - { - pSession = (nsCalSession*) m_List.GetAt(i); - iCount = pSession->GetUsageCount(); - if (0 == iCount) - ++iCount; - for (j = 0; j < iCount; ++j) - { - if (0 != pSession->ReleaseSession()) - ++iErrors; - } - delete pSession; - } - return (nsresult) iErrors; -} - -/** - * Get a session to the supplied curl. - * @param psCurl the curl to the calendar store - * @param psPassword the password needed for logging in - * @param s the session - * @return 0 on success - * 1 problems pulling the session from the list - * problems from nsCalSession::GetSession. - */ -nsresult nsCalSessionMgr::GetSession(const char* psCurl, long lFlags, const char* psPassword, CAPISession& s) -{ - /* - * First, search the current sessions and see if we already have a - * session to the requested server... - */ - nsCurlParser Curl(psCurl); - int iIndex; - - if (0 == Find(Curl.GetCurl().GetBuffer(), 0, &iIndex)) - { - /* - * Found it - */ - nsCalSession* pSession = GetAt(iIndex); - if (0 == pSession) - return 1; - return pSession->GetSession(s,psPassword); - } - else - { - /* - * nothing found, have to create it. - */ - nsCalSession* pSes = new nsCalSession(psCurl,lFlags); - m_List.Add(pSes); - return pSes->GetSession(s,psPassword ? psPassword : ""); - } -} - -/** - * Get a session to the supplied curl. - * @param sCurl the curl to the calendar store - * @param psPassword the password needed for logging in - * @param pCalSession the session object that was found or created - * @return 0 on success (that is, the session was established with the - * capi server) or the error that occurred while trying to - * establish the session. - */ -nsresult nsCalSessionMgr::GetSession(const JulianString sCurl, long lFlags, const char* psPassword, nsCalSession* &pCalSession) -{ - /* - * First, search the current sessions and see if we already have a - * session to the requested server... - */ - nsCurlParser Curl(sCurl); - int iIndex; - - pCalSession = 0; - - if (0 == Find(Curl.GetCurl().GetBuffer(), 0, &iIndex)) - { - /* - * Found it - */ - pCalSession = GetAt(iIndex); - if (0 == pCalSession) - return 1; - return pCalSession->EstablishSession(psPassword); - } - else - { - /* - * nothing found, have to create it. - */ - pCalSession = new nsCalSession(sCurl,lFlags); - m_List.Add(pCalSession); - return pCalSession->EstablishSession(psPassword ? psPassword : ""); - } -} - - -/** - * Release a session - * @param pUser pointer to the calendar to add - * @return 0 on success - * 1 if not found - */ -nsresult nsCalSessionMgr::ReleaseSession(CAPISession& s) -{ - int iIndex; - nsresult res; - if (0 != (res = Find(s,0,&iIndex))) - return res; - - nsCalSession* pSes = (nsCalSession*) GetAt(iIndex); - if (0 == pSes) - return 1; - - pSes->ReleaseSession(); - - return NS_OK; -} - -/** - * Search for a calendar based on its curl. - * @param psCurl pointer to the curl of this calendar store - * @param iStart start searching at this point in the list - * if iStart is < 0 it is snapped to 0. If it - * is >= list size, it is snapped to the last - * index. - * @param piFound the index of the calendar of the list that - * matches the psCurl. This value is always - * >= iStart when the return value is 0. It - * is returned as -1 if the curl cannot be found. - * @return 0 on success - * 1 if not found - */ -nsresult nsCalSessionMgr::Find(char* p, int iStart, int* piFound) -{ - nsCalSession* pSession; - - *piFound = -1; - if (m_List.GetSize() > 0) - { - if (iStart >= m_List.GetSize()) - iStart = m_List.GetSize() - 1; - for (int i = iStart; i < m_List.GetSize(); i++) - { - pSession = (nsCalSession*) m_List.GetAt(i); - if ( (pSession->GetCurl()) == p) - { - *piFound = i; - return NS_OK; - } - } - } - - return 1; -} - -/** - * Search for a calendar based on its CAPISession. - * @param s the capi session to search for. - * @param iStart start searching at this point in the list - * if iStart is < 0 it is snapped to 0. If it - * is >= list size, it is snapped to the last - * index. - * @param piFound the index of the calendar of the list that - * matches the psCurl. This value is always - * >= iStart when the return value is 0. It - * is returned as -1 if the curl cannot be found. - * @return 0 on success - * 1 if not found - */ -nsresult nsCalSessionMgr::Find(CAPISession s, int iStart, int* piFound) -{ - nsCalSession* pSession; - - *piFound = -1; - if (m_List.GetSize() > 0) - { - if (iStart >= m_List.GetSize()) - iStart = m_List.GetSize() - 1; - for (int i = iStart; i < m_List.GetSize(); i++) - { - pSession = (nsCalSession*) m_List.GetAt(i); - if ( (pSession->m_Session) == s) - { - *piFound = i; - return NS_OK; - } - } - } - return 1; -} - -/** - * Get the calendar session definition at the supplied index. - * @param i the index to fetch - * @return a pointer to the calendar session at the supplied index. - */ -nsCalSession* nsCalSessionMgr::GetAt(int i) -{ - if (m_List.GetSize() == 0) - return nsnull; - - return (nsCalSession*) m_List.GetAt(i); -} - diff --git a/mozilla/calendar/modules/core/src/nsCalStreamReader.cpp b/mozilla/calendar/modules/core/src/nsCalStreamReader.cpp deleted file mode 100644 index 18721f2e771..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalStreamReader.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - - -#include "jdefines.h" - -#include -#include "nsCalStreamReader.h" -#include "prprty.h" -#include "tmbevent.h" -#include "nscal.h" -#include "jlog.h" -#include "keyword.h" -#include "icalsrdr.h" - -#include "nspr.h" - -//--------------------------------------------------------------------- - -nsCalStreamReader::nsCalStreamReader() -{ - m_Reader = 0; - m_OutCalendars = 0; - m_Thread = 0; - m_CallerData = 0; - m_bParseStarted = FALSE; - m_bParseFinished = FALSE; -} - -//--------------------------------------------------------------------- - -nsCalStreamReader::~nsCalStreamReader() -{ -} - -//--------------------------------------------------------------------- - -nsCalStreamReader::nsCalStreamReader(nsCapiCallbackReader * reader, - JulianPtrArray * outCalendars, - PRThread * thread, void* condVar) -{ - m_Reader = reader; - m_OutCalendars = outCalendars; - m_Thread = thread; - m_CallerData = condVar; - m_bParseStarted = FALSE; - m_bParseFinished = FALSE; -} - -//--------------------------------------------------------------------- - -nsCalUtility::MimeEncoding -nsCalStreamReader::stringToEncodingType(UnicodeString & propVal) -{ - if (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_s7bit) == 0) - { - return nsCalUtility::MimeEncoding_7bit; - } - else if (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sQUOTED_PRINTABLE) == 0) - { - return nsCalUtility::MimeEncoding_QuotedPrintable; - } - else if (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBase64) == 0) - { - return nsCalUtility::MimeEncoding_Base64; - } - else - return nsCalUtility::MimeEncoding_7bit; -} - -//--------------------------------------------------------------------- - -void nsCalStreamReader::ParseCalendars() -{ - nsCalStreamReader::ParseCalendars((ICalReader *) m_Reader, m_OutCalendars); -} - -//--------------------------------------------------------------------- - -void nsCalStreamReader::ParseCalendars(ICalReader * reader, - JulianPtrArray * outCalendars) -{ - if (outCalendars == 0) - return; - - JulianPtrArray * parameters = new JulianPtrArray(); - - // TODO: this needs to be changed to capireader later - PR_ASSERT(parameters != 0); - if (parameters != 0) - { - JLog * log = 0; - ErrorCode status = ZERO_ERROR; - UnicodeString strLine, propName, propVal; - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit; - - nsCapiCallbackReader * cr = (nsCapiCallbackReader *) reader; - - while(TRUE) - { - cr->readFullLine(strLine, status); - ICalProperty::Trim(strLine); - -#if TESTING_ITIPRIG - if (FALSE) TRACE("\t--Parser: line (size = %d) = ---%s---\r\n", - strLine.size(), strLine.toCString("")); -#endif - if (FAILURE(status) && strLine.size() == 0) - { - //PR_Notify((PRMonitor *) cr->getMonitor()); - if (cr->isFinished()) - { - break; - } -#if TESTING_ITIPRIG - if (FALSE) TRACE("\t--jParser: yielding\r\n"); -#endif - PR_Sleep(PR_INTERVAL_NO_WAIT); - //break; - } - - ICalProperty::parsePropertyLine(strLine, propName, - propVal, parameters); - -#if TESTING_ITIPRIG - if (TRUE) TRACE("\t--Parser: propName = --%s--, propVal = --%s--,paramSize = %d\r\n", - propName.toCString(""), propVal.toCString(""), parameters->GetSize()); -#endif - if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0)) - { - // parse an NSCalendar, add it to outCalendars - NSCalendar * cal = new NSCalendar(log); - UnicodeString fileName; - cal->parse(reader, fileName, encoding); - outCalendars->Add(cal); - } - else if (propName.compareIgnoreCase( - nsCalKeyword::Instance()->ms_sCONTENT_TRANSFER_ENCODING) == 0) - { - ICalProperty::Trim(propVal); - encoding = stringToEncodingType(propVal); - cr->setEncoding(encoding); - } - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - //PR_ExitMonitor((PRMonitor *)cr->getMonitor()); - } - - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - delete parameters; parameters = 0; - setParseFinished(); - } -} -//--------------------------------------------------------------------- - -void main_CalStreamReader(void* p) -{ - /* - * We've been started. We must wait until our parent thread - * signals to begin working... - */ - nsCalStreamReader * pStreamReader = (nsCalStreamReader *) p; - PRMonitor * pMon = (PRMonitor*)pStreamReader->getCallerData(); - PR_EnterMonitor(pMon); /* wait until the other thread releases this */ - PR_ExitMonitor(pMon); /* now that we've got it, let both threads run */ - - /* - * We only enter the Monitor when the parent has exited it. So, - * our parent thread has signaled us to begin the work at hand. - */ - pStreamReader->ParseCalendars(); - - /* - * The parent will try to re-enter the monitor when it is waiting for - * this thread to complete parsing the calendars. - */ - PR_EnterMonitor(pMon); - pStreamReader->setParseFinished(); - PR_Notify(pMon); - PR_ExitMonitor(pMon); - - /* - * We're done. - */ -#if 0 - PR_ProcessExit(0); -#endif -} - -//--------------------------------------------------------------------- - - - diff --git a/mozilla/calendar/modules/core/src/nsCalUser.cpp b/mozilla/calendar/modules/core/src/nsCalUser.cpp deleted file mode 100644 index 3a798626693..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalUser.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * nsCalUser - * Simple abstraction for the owner of a calendar store. Applies - * to a resource or a person. This implementation assumes a single - * NSCalendar per user. - * - * sman - */ -#include "jdefines.h" -#include "julnstr.h" -#include "nsString.h" -#include "ptrarray.h" -#include "nscal.h" -#include "nsCalUser.h" -#include "nspr.h" - -nsCalUser::nsCalUser() -{ - InitMembers(); -} - -nsCalUser::nsCalUser(JulianString& sUserName, nsString& sDisplayName) -{ - InitMembers(); - m_sUserName = sUserName; - m_sDisplayName = sDisplayName; -} - -nsCalUser::nsCalUser(char* sUserName, char* sDisplayName) -{ - InitMembers(); - m_sUserName = sUserName; - m_sDisplayName = sDisplayName; -} - -nsCalUser::~nsCalUser() -{ - PRInt32 size = m_CalAddrList.GetSize(); - PRInt32 i ; - - for (i=0; i m_CalAddrList.Add(psAddr)); -} diff --git a/mozilla/calendar/modules/core/src/nsCalUserList.cpp b/mozilla/calendar/modules/core/src/nsCalUserList.cpp deleted file mode 100644 index 06a7cb0ca12..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalUserList.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * nsCalUserList.cpp: implementation of the nsCalUserList class. - * This class manages the list of users or resources that have - * calendars currently in memory. All calendars that are to be - * displayed should have their users registered in this list. - */ - -#include "jdefines.h" -#include "julnstr.h" -#include "nsString.h" -#include "ptrarray.h" -#include "nscal.h" -#include "nspr.h" -#include "nsICalendarUser.h" -#include "nsCalUserList.h" - -nsCalUserList::nsCalUserList() -{ -} - -nsCalUserList::~nsCalUserList() -{ -} - -/** - * Add a calendar to the list - * @param pUser pointer to the calendar to add - * @return 0 on success - * 1 problems adding the calendar - */ -nsresult nsCalUserList::Add(nsICalendarUser* pUser) -{ - if (0 > m_List.Add(pUser)) - return 1; - return 0; -} - -/** - * Delete the calendar matching the supplied pointer. - * @param pUser pointer to the calendar to add - * @return 0 on success - * 1 if not found - */ -nsresult nsCalUserList::Delete(nsICalendarUser* pUser) -{ - return (1 == m_List.Remove(pUser)) ? 0 : 1; -} - -/** - * Delete all calendars having the supplied cal url - * @param pCurl pointer to the curl of this calendar store - * @return 0 on success - * 1 if not found - */ -nsresult nsCalUserList::Delete(char* psCurl) -{ - int i; - nsresult s = Find(psCurl,0,&i); - m_List.RemoveAt(i,1); - return NS_OK; -} - -/** - * Search for a calendar. - * @param psCurl pointer to the curl of this calendar store - * @param iStart start searching at this point in the list - * if iStart is < 0 it is snapped to 0. If it - * is >= list size, it is snapped to the last - * index. - * @param piFound the index of the calendar of the list that - * matches the psCurl. This value is always - * >= iStart when the return value is 0. It - * is returned as -1 if the curl cannot be found. - * @return 0 on success - * 1 if not found - */ -nsresult nsCalUserList::Find(char* p, int iStart, int* piFound) -{ - nsICalendarUser* pUser; - JulianPtrArray* pList; - JulianString* psCurl; - int i,j; - - *piFound = -1; - if (m_List.GetSize() > 0) - { - if (iStart >= m_List.GetSize()) - iStart = m_List.GetSize() - 1; - for (i = 0; i < m_List.GetSize(); i++) - { - pUser = (nsICalendarUser*) m_List.GetAt(i); - if (0 != pUser) - { -#if 0 - pList = pUser->GetCalAddrList(); - for (j = 0; j < pList->GetSize(); j++) - { - psCurl = (JulianString *)pList->GetAt(i); - if ( (*psCurl) == p) - { - *piFound = i; - return NS_OK; - } - } -#endif - } - } - } - return 1; -} - -/** - * Get the calendar at the supplied index. - * @param i the index of the calendar to fetch - * @return a pointer to the calendar at the supplied index. - */ -nsICalendarUser* nsCalUserList::GetAt(int i) -{ - return (nsICalendarUser*) m_List.GetAt(i); -} - diff --git a/mozilla/calendar/modules/core/src/nsCalendarModel.cpp b/mozilla/calendar/modules/core/src/nsCalendarModel.cpp deleted file mode 100644 index 633e98996ef..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalendarModel.cpp +++ /dev/null @@ -1,326 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include -#include "nscore.h" -#include "nsCalendarModel.h" -#include "nsCoreCIID.h" -#include "nsCalUICIID.h" -#include "nsxpfcCIID.h" -#include "nsICalendarUser.h" -#include "nsxpfcCIID.h" -#include "nsIXPFCCommand.h" -#include "nsIXPFCObserverManager.h" -#include "nsIServiceManager.h" -#include "nsXPFCNotificationStateCommand.h" -#include "nsCalFetchEventsCommand.h" -#include "nsXPFCModelUpdateCommand.h" -#include "nsIXPFCObserver.h" -#include "nsIXPFCSubject.h" - -static NS_DEFINE_IID(kCXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); -static NS_DEFINE_IID(kICalendarModelIID, NS_ICALENDAR_MODEL_IID); -static NS_DEFINE_IID(kIModelIID, NS_IMODEL_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); -static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); -static NS_DEFINE_IID(kXPFCCommandCID, NS_XPFC_COMMAND_CID); -static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); -static NS_DEFINE_IID(kIXPFCObserverManagerIID, NS_IXPFC_OBSERVERMANAGER_IID); -static NS_DEFINE_IID(kXPFCObserverIID, NS_IXPFC_OBSERVER_IID); -static NS_DEFINE_IID(kXPFCCommandReceiverIID, NS_IXPFC_COMMANDRECEIVER_IID); -static NS_DEFINE_IID(kCXPFCObserverIID, NS_IXPFC_OBSERVER_IID); - -nsCalendarModel::nsCalendarModel(nsISupports* outer) -{ - NS_INIT_REFCNT(); - mCalendarUser = nsnull; -} - -nsresult nsCalendarModel::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kClassIID, kICalendarModelIID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIModelIID)) { - *aInstancePtr = (void*)(nsIModel*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kXPFCObserverIID)) { - *aInstancePtr = (void*)(nsIXPFCObserver *) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kXPFCSubjectIID)) { - *aInstancePtr = (void*) (nsIXPFCSubject *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kXPFCCommandReceiverIID)) { - *aInstancePtr = (void*)(nsIXPFCCommandReceiver *) this; - AddRef(); - return NS_OK; - } - - return (NS_NOINTERFACE); - -} - - -NS_IMPL_ADDREF(nsCalendarModel) -NS_IMPL_RELEASE(nsCalendarModel) - -nsCalendarModel::~nsCalendarModel() -{ - nsIXPFCObserverManager* om; - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - nsIXPFCObserver * observer = (nsIXPFCObserver *) this; - nsIXPFCSubject * subject = (nsIXPFCSubject *) this; - om->UnregisterSubject(subject); - om->UnregisterObserver(observer); - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - mCalendarUser = nsnull; // Do Not Release -} - -nsresult nsCalendarModel::Init() -{ - /* - * We care about Command State Notifications, so register - * ourselves for them - */ - - nsIXPFCObserverManager* om; - nsIXPFCObserver * ob ; - - nsresult res = QueryInterface(kXPFCObserverIID, (void**)&ob); - - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - - res = om->RegisterForCommandState(ob,nsCommandState_eComplete); - - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - NS_RELEASE(ob); - - return NS_OK; -} - - -NS_IMETHODIMP nsCalendarModel :: GetCalendarUser(nsICalendarUser *& aCalendarUser) -{ - aCalendarUser = mCalendarUser; - return NS_OK; -} - -NS_IMETHODIMP nsCalendarModel :: SetCalendarUser(nsICalendarUser* aCalendarUser) -{ - mCalendarUser = aCalendarUser; - return NS_OK; -} - - -nsEventStatus nsCalendarModel::Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand) -{ - - nsEventStatus status; - - /* - * Update our internal structure based on this update - */ - - status = Action(aCommand); - - /* - * Tell others we are updated - * - * IDEA: Pass this event off to the canvas, who will update it's view - * based on the command, but wait with hourglass until the final - * ModelUpdated command comes in for rendering the contents of the - * view ... maybe this should be configurable - * - */ - - Notify(aCommand); - - return (nsEventStatus_eIgnore); -} - -nsEventStatus nsCalendarModel::Action(nsIXPFCCommand * aCommand) -{ - /* - * We can receive 2 general classes of events: - * - * 1) Events telling us a LayerCollection needs data of a specific range - * 2) Events telling us that a series of Commands have completed - * - */ - - nsEventStatus status = nsEventStatus_eIgnore; - nsXPFCNotificationStateCommand * notification_command = nsnull; - nsresult res; - - static NS_DEFINE_IID(kCXPFCNotificationStateCommandCID, NS_XPFC_NOTIFICATIONSTATE_COMMAND_CID); - - res = aCommand->QueryInterface(kCXPFCNotificationStateCommandCID,(void**)¬ification_command); - - if (NS_OK == res) - { - HandleNotificationCommand(notification_command); - - NS_RELEASE(notification_command); - - status = nsEventStatus_eConsumeNoDefault; - } - - nsCalFetchEventsCommand * fetch_command = nsnull; - - static NS_DEFINE_IID(kCalFetchEventsCommandCID, NS_CAL_FETCHEVENTS_COMMAND_CID); - - res = aCommand->QueryInterface(kCalFetchEventsCommandCID,(void**)&fetch_command); - - if (NS_OK == res) - { - HandleFetchCommand(fetch_command); - - NS_RELEASE(fetch_command); - - status = nsEventStatus_eConsumeNoDefault; - } - - return status; -} - -nsresult nsCalendarModel :: HandleNotificationCommand(nsXPFCNotificationStateCommand * aCommand) -{ - /* - * Steve, here is where you want to do the Flush() on CAPI - * to get the list of events. - * - * Be sure to check aCommand->mCommandState to ensure it has - * value nsCommandState_eComplete first. - * - * For Now, I've just passed the ModelUpdate Command directly to - * the Observers, but you should do this when data comes back, with - * the correct status in the model update (ie more data to come, data - * complete, etc...) - * - * .... Greg - */ - - SendModelUpdateCommand(); - - - return NS_OK; -} - -nsresult nsCalendarModel :: HandleFetchCommand(nsCalFetchEventsCommand * aCommand) -{ - /* - * Steve, here is where you want to do deal with a specific request - * for a range of data - * - * .... Greg - */ - - return NS_OK; -} - -nsresult nsCalendarModel :: Attach(nsIXPFCObserver * aObserver) -{ - return NS_OK; -} - -nsresult nsCalendarModel :: Detach(nsIXPFCObserver * aObserver) -{ - return NS_OK; -} - -nsresult nsCalendarModel :: SendModelUpdateCommand() -{ - nsXPFCModelUpdateCommand * command = nsnull; - nsresult res; - - static NS_DEFINE_IID(kModelUpdateCommandCID, NS_XPFC_MODELUPDATE_COMMAND_CID); - - res = nsRepository::CreateInstance(kModelUpdateCommandCID, - nsnull, - kXPFCCommandIID, - (void **)&command); - - if (NS_OK == res) - { - nsIModel * model; - - QueryInterface(kIModelIID, (void**)&model); - - command->Init(); - - command->mModel = model; - - Notify(command); - - NS_IF_RELEASE(command); - NS_RELEASE(model); - } - - return NS_OK; - -} - -nsresult nsCalendarModel :: Notify(nsIXPFCCommand * aCommand) -{ - nsresult res = NS_OK; - - nsIXPFCSubject * subject; - - res = QueryInterface(kXPFCSubjectIID,(void **)&subject); - - if (res != NS_OK) - return res; - - nsIXPFCObserverManager* om; - - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - - res = om->Notify(subject,aCommand); - - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - NS_RELEASE(subject); - - return(res); -} diff --git a/mozilla/calendar/modules/core/src/nsCalendarUser.cpp b/mozilla/calendar/modules/core/src/nsCalendarUser.cpp deleted file mode 100644 index 9d1652abff2..00000000000 --- a/mozilla/calendar/modules/core/src/nsCalendarUser.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include -#include "nsCalendarUser.h" -#include "nsCoreCIID.h" -#include "nsxpfcCIID.h" - -static NS_DEFINE_IID(kICalendarUserIID, NS_ICALENDAR_USER_IID); -static NS_DEFINE_IID(kIUserIID, NS_IUSER_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCUserCID, NS_USER_CID); -static NS_DEFINE_IID(kILayerIID, NS_ILAYER_IID); -static NS_DEFINE_IID(kCLayerCollectionCID, NS_LAYER_COLLECTION_CID); - -nsCalendarUser::nsCalendarUser(nsISupports* outer) -{ - NS_INIT_REFCNT(); - mpUserSupports = nsnull; - mpLayer = nsnull; -} - -nsresult nsCalendarUser::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kClassIID, kICalendarUserIID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - - if (nsnull != mpUserSupports) - return mpUserSupports->QueryInterface(aIID, aInstancePtr); - - return (NS_NOINTERFACE); - -} - - -NS_IMPL_ADDREF(nsCalendarUser) - -nsrefcnt nsCalendarUser::Release(void) -{ - NS_PRECONDITION(0 != mRefCnt, "dup release"); - - --mRefCnt; - - if (mRefCnt == 1) { - nsISupports * inner = mpUserSupports; - mpUserSupports = nsnull; - NS_IF_RELEASE(inner); - return 0; - } - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} - - -nsCalendarUser::~nsCalendarUser() -{ - NS_IF_RELEASE(mpUserSupports); - NS_IF_RELEASE(mpLayer); -} - -nsresult nsCalendarUser::Init() -{ - nsresult res; - - /* - * Aggregate in the XPFC User Implementation - */ - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - - res = nsRepository::CreateInstance(kCUserCID, - (nsISupports *)this, - kISupportsIID, - (void**)&mpUserSupports); - - if (NS_OK != res) - { - mpUserSupports->Release(); - mpUserSupports = NULL; - } - - /* - * Create a LayerCollection for this User, by default - */ - res = nsRepository::CreateInstance( - kCLayerCollectionCID, // class id that we want to create - nsnull, // not aggregating anything (this is the aggregatable interface) - kILayerIID, // interface id of the object we want to get back - (void**)&mpLayer); // pointer to the interface object - - if (NS_OK == res) - mpLayer->Init(); - - return res; -} - - -NS_IMETHODIMP nsCalendarUser :: GetLayer(nsILayer *& aLayer) -{ - aLayer = mpLayer; - NS_ADDREF(mpLayer); - return NS_OK; -} - -NS_IMETHODIMP nsCalendarUser :: SetLayer(nsILayer* aLayer) -{ - NS_IF_RELEASE(mpLayer); - mpLayer = aLayer; - NS_ADDREF(mpLayer); - return NS_OK; -} - -NS_IMETHODIMP nsCalendarUser::HasLayer(const JulianString& aCurl, PRBool& aContains) -{ - return mpLayer->URLMatch(aCurl,aContains); -} diff --git a/mozilla/calendar/modules/core/src/nsCapiCallbackReader.cpp b/mozilla/calendar/modules/core/src/nsCapiCallbackReader.cpp deleted file mode 100644 index c7133e1dfc8..00000000000 --- a/mozilla/calendar/modules/core/src/nsCapiCallbackReader.cpp +++ /dev/null @@ -1,405 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#include "nsCapiCallbackReader.h" -#include "nspr.h" - -const t_int32 nsCapiCallbackReader::m_MAXBUFFERSIZE = 1024; -const t_int32 nsCapiCallbackReader::m_NOMORECHUNKS = 404; -//--------------------------------------------------------------------- -nsCapiCallbackReader::nsCapiCallbackReader() -{ - PR_ASSERT(FALSE); -} -//--------------------------------------------------------------------- - -void -nsCapiCallbackReader::AddBuffer(nsCapiBufferStruct * cBuf) -{ - if (m_Chunks == 0) - m_Chunks = new JulianPtrArray(); - PR_ASSERT(m_Chunks != 0); - if (m_Chunks != 0) - { - m_Chunks->Add(cBuf); - } -} - -//--------------------------------------------------------------------- - -nsCapiCallbackReader::nsCapiCallbackReader(PRMonitor * monitor, - nsCalUtility::MimeEncoding encoding) -{ - m_Monitor = monitor; - m_bFinished = FALSE; - - m_ChunkIndex = 0; - m_Chunks = 0; - m_Init = TRUE; - m_Pos = 0; - m_Mark = -1; - m_ChunkMark = -1; - m_Encoding = encoding; -} - -//--------------------------------------------------------------------- - -void nsCapiCallbackReader::deleteCapiBufferStructVector(JulianPtrArray * bufferVector) -{ - t_int32 i; - if (bufferVector != 0) - { - nsCapiBufferStruct * cbBuf; - for (i = bufferVector->GetSize() - 1; i >= 0; i--) - { - cbBuf = (nsCapiBufferStruct *) bufferVector->GetAt(i); - if (0 != cbBuf->m_pBuf) - { - delete [] (cbBuf->m_pBuf); - cbBuf->m_pBuf = 0; - } - delete cbBuf; cbBuf = 0; - } - } -} - -//--------------------------------------------------------------------- - -nsCapiCallbackReader::~nsCapiCallbackReader() -{ - if (m_Chunks != 0) - { - deleteCapiBufferStructVector(m_Chunks); - delete m_Chunks; m_Chunks = 0; - } -} - -//--------------------------------------------------------------------- - -t_int8 nsCapiCallbackReader::read(ErrorCode & status) -{ - t_int32 i = 0; - status = ZERO_ERROR; - - while (TRUE) - { - if (m_Chunks == 0 || m_Chunks->GetSize() == 0 || - m_ChunkIndex >= m_Chunks->GetSize()) - { - status = m_NOMORECHUNKS; // no more chunks, should block - return -1; - } - else - { - // read from linked list of UnicodeString's - // delete front string when finished reading from it - - nsCapiBufferStruct * cbBuf = (nsCapiBufferStruct *) m_Chunks->GetAt(m_ChunkIndex); - char * buf = cbBuf->m_pBuf; - char c; - if ((size_t) m_Pos < cbBuf->m_pBufSize) - { - if (nsCalUtility::MimeEncoding_QuotedPrintable == m_Encoding) - { - char * buf = cbBuf->m_pBuf; - c = buf[m_Pos]; - if ('=' == c) - { - if (cbBuf->m_pBufSize >= (size_t) (m_Pos + 3)) - { - if (ICalReader::isHex(buf[m_Pos + 1]) && ICalReader::isHex(buf[m_Pos + 2])) - { - c = ICalReader::convertHex(buf[m_Pos + 1], buf[m_Pos + 2]); - m_Pos += 3; - return c; - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - else - { - PRInt32 lenDiff = cbBuf->m_pBufSize - m_Pos; - char fToken, sToken; - PRBool bSetFToken = FALSE; - PRInt32 tempIndex = m_ChunkIndex; - UnicodeString token; - - while (TRUE) - { - // lenDiff = 1, 2 always - // the =XX spans different chunks - // if last chunk, return out of chunks status - if (tempIndex == m_Chunks->GetSize() - 1) - { - status = m_NOMORECHUNKS; - return -1; - } - else - { - nsCapiBufferStruct * cbNextBuf = (nsCapiBufferStruct *) m_Chunks->GetAt(tempIndex + 1); - char * nextBuf = cbNextBuf->m_pBuf; - tempIndex++; - if (cbNextBuf->m_pBufSize >= 2) - { - if (lenDiff == 2) - { - fToken = buf[cbBuf->m_pBufSize - 1]; - sToken = nextBuf[0]; - if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken)) - { - c = ICalReader::convertHex(fToken, sToken); - - m_Pos = 1; - m_ChunkIndex = tempIndex; - bSetFToken = FALSE; - return c; - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - else - { - // lenDiff = 1 - if (bSetFToken) - { - sToken = nextBuf[0]; - } - else - { - fToken = nextBuf[0]; - sToken = nextBuf[1]; - } - if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken)) - { - c = ICalReader::convertHex(fToken, sToken); - - m_Pos = 2; - m_ChunkIndex = tempIndex; - bSetFToken = FALSE; - return c; - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - } - else - { - if (cbNextBuf->m_pBufSize > 0) - { - if (!bSetFToken) - { - fToken = nextBuf[0]; - bSetFToken = TRUE; - } - else - { - sToken = nextBuf[0]; - if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken)) - { - c = ICalReader::convertHex(fToken, sToken); - - m_Pos = 1; - m_ChunkIndex = tempIndex; - bSetFToken = FALSE; - return c; - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - } - } - } - } - } - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - else - { - m_ChunkIndex++; - m_Pos = 0; - } - } - } - status = 1; - return -1; -} - -//--------------------------------------------------------------------- - -UnicodeString & -nsCapiCallbackReader::createLine(t_int32 oldPos, t_int32 oldChunkIndex, - t_int32 newPos, t_int32 newChunkIndex, - UnicodeString & aLine) -{ - PR_ASSERT(oldChunkIndex <= newChunkIndex); - UnicodeString u; - if (oldChunkIndex == newChunkIndex) - { - u = *((UnicodeString *) m_Chunks->GetAt(oldChunkIndex)); - u.extractBetween(oldPos, newPos, aLine); - return aLine; - } - else { - //(oldChunkIndex < newChunkIndex) - - t_int32 i; - UnicodeString v, temp; - u = *((UnicodeString *) m_Chunks->GetAt(oldChunkIndex)); - u.extractBetween(oldPos, u.size(), aLine); - v = *((UnicodeString *) m_Chunks->GetAt(newChunkIndex)); - v.extractBetween(0, newPos, temp); - i = oldChunkIndex + 1; - while (i < newChunkIndex) - { - v = *((UnicodeString *) m_Chunks->GetAt(i)); - aLine += v; - i++; - } - aLine += temp; - return aLine; - } -} -//--------------------------------------------------------------------- -UnicodeString & -nsCapiCallbackReader::readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 iTemp) -{ - status = ZERO_ERROR; - t_int32 i; - - PR_EnterMonitor(m_Monitor); - - t_int32 oldpos = m_Pos; - t_int32 oldChunkIndex = m_ChunkIndex; - - readLine(aLine, status); - if (status == m_NOMORECHUNKS) - { - if (m_bFinished) - { - // do nothing. - } - else - { - PR_Wait(m_Monitor,PR_INTERVAL_NO_TIMEOUT); - } - } - - UnicodeString aSubLine; - while (TRUE) - { - mark(); - i = read(status); - if (status == m_NOMORECHUNKS) - { - if (m_bFinished) - { - // do nothing - break; - } - else - { - PR_Wait(m_Monitor,PR_INTERVAL_NO_TIMEOUT); - } - } - else if (i == ' ') - { - aLine += readLine(aSubLine, status); - } - else - { - reset(); - break; - } - } - - PR_ExitMonitor(m_Monitor); - - return aLine; -} -//--------------------------------------------------------------------- -UnicodeString & -nsCapiCallbackReader::readLine(UnicodeString & aLine, ErrorCode & status) -{ - aLine = ""; - - if (m_Chunks == 0 || m_Chunks->GetSize() == 0 || - m_ChunkIndex >= m_Chunks->GetSize()) - { - status = m_NOMORECHUNKS; // no more chunks, should block - return aLine; - } - else - { - nsCapiBufferStruct * cbBuf = - (nsCapiBufferStruct *) m_Chunks->GetAt(m_ChunkIndex); - char * currentBuf = cbBuf->m_pBuf; - char * line = 0; - PRInt32 i; - t_bool bFoundNewLine = FALSE; - for (i = m_Pos; 0 != currentBuf[i] && - ((size_t) i < cbBuf->m_pBufSize); i++) - { - if ('\n' == currentBuf[i]) - { - currentBuf[i] = 0; - bFoundNewLine = TRUE; - break; - } - } - if (!bFoundNewLine) - { - // todo: mark this chunk needs to be saved - if (m_ChunkIndex < m_Chunks->GetSize() - 1) - { - m_ChunkIndex++; - m_Pos = 0; - } - //else - //{ - // status = m_NOMORECHUNKS; - //} - return aLine; - } - line = currentBuf + m_Pos; - m_Pos = i + 1; - aLine = line; - return aLine; - } -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/core/src/nsCoreFactory.cpp b/mozilla/calendar/modules/core/src/nsCoreFactory.cpp deleted file mode 100644 index 4d19dd33c6f..00000000000 --- a/mozilla/calendar/modules/core/src/nsCoreFactory.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsIFactory.h" -#include "nsISupports.h" -#include "nsCoreCIID.h" - -#include "nsLayer.h" -#include "nsLayerCollection.h" -#include "nsCalendarUser.h" -#include "nsCalendarModel.h" - -static NS_DEFINE_IID(kILayerIID, NS_ILAYER_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); -static NS_DEFINE_IID(kICalUSerIID, NS_ICALENDAR_USER_IID); -static NS_DEFINE_IID(kCLayerCID, NS_LAYER_CID); -static NS_DEFINE_IID(kCLayerCollectionCID, NS_LAYER_COLLECTION_CID); -static NS_DEFINE_IID(kCCalendarUserCID, NS_CALENDAR_USER_CID); -static NS_DEFINE_IID(kCCalendarModelCID, NS_CALENDAR_MODEL_CID); - -class nsCoreFactory : public nsIFactory -{ - public: - // nsISupports methods - NS_IMETHOD QueryInterface(const nsIID &aIID, - void **aResult); - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - // nsIFactory methods - NS_IMETHOD CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult); - - NS_IMETHOD LockFactory(PRBool aLock); - - nsCoreFactory(const nsCID &aClass); - ~nsCoreFactory(); - - private: - nsrefcnt mRefCnt; - nsCID mClassID; -}; - -nsCoreFactory::nsCoreFactory(const nsCID &aClass) -{ - mRefCnt = 0; - mClassID = aClass; -} - -nsCoreFactory::~nsCoreFactory() -{ - NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); -} - -nsresult nsCoreFactory::QueryInterface(const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - // Always NULL result, in case of failure - *aResult = NULL; - - 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; -} - -nsrefcnt nsCoreFactory::AddRef() -{ - return ++mRefCnt; -} - -nsrefcnt nsCoreFactory::Release() -{ - if (--mRefCnt == 0) { - delete this; - return 0; // Don't access mRefCnt after deleting! - } - return mRefCnt; -} - -nsresult nsCoreFactory::CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - *aResult = NULL; - - nsISupports *inst = nsnull; - - if (mClassID.Equals(kCLayerCID)) { - inst = (nsISupports *)new nsLayer(aOuter); - } else if (mClassID.Equals(kCLayerCollectionCID)) { - inst = (nsISupports *)(nsILayerCollection*) new nsLayerCollection(aOuter); - } else if (mClassID.Equals(kCCalendarUserCID)) { - inst = (nsISupports *)new nsCalendarUser(aOuter); - } else if (mClassID.Equals(kCCalendarModelCID)) { - inst = (nsISupports *)(nsICalendarModel*)new nsCalendarModel(aOuter); - } - - if (inst == NULL) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult res = inst->QueryInterface(aIID, aResult); - - if (res != NS_OK) { - // We didn't get the right interface, so clean up - delete inst; - } - - return res; -} - -nsresult nsCoreFactory::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; - } - - *aFactory = new nsCoreFactory(aClass); - - if (nsnull == aFactory) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); -} - diff --git a/mozilla/calendar/modules/core/src/nsLayer.cpp b/mozilla/calendar/modules/core/src/nsLayer.cpp deleted file mode 100644 index c531e7da4c7..00000000000 --- a/mozilla/calendar/modules/core/src/nsLayer.cpp +++ /dev/null @@ -1,533 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include -#include "nscore.h" -#include "nsError.h" -#include "nsCom.h" -#include "capi.h" -#include "julnstr.h" -#include "nsDateTime.h" -#include "nscalexport.h" -#include "nsLayer.h" -#include "nsCurlParser.h" -#include "nsCalendarShell.h" -#include "jdefines.h" -#include "nsCalShellFactory.h" -#include "nsString.h" -#include "nsFont.h" -#include "nsCalShellCIID.h" -#include "nsCRT.h" -#include "plstr.h" -#include "prmem.h" -#include "prenv.h" -#include "icalfrdr.h" -#include "nsIPref.h" -#include "nsCalendarShell.h" -#include "nscalstrings.h" -#include "nsxpfcCIID.h" -#include "nsIAppShell.h" -#include "nsICommandServer.h" -#include "nsCalUICIID.h" -#include "nsCalCommandCanvas.h" -#include "nlsloc.h" -#include "nsCapiCIID.h" -#include "nspr.h" -#include "prcvar.h" -#include "nsCalStreamReader.h" -#include "nsCalSessionMgr.h" - -static NS_DEFINE_IID(kILayerIID, NS_ILAYER_IID); - -nsLayer::nsLayer(nsISupports* outer) -{ - NS_INIT_REFCNT(); - mpCal = 0; - mpShell = 0; -} - -NS_IMPL_QUERY_INTERFACE(nsLayer, kILayerIID) -NS_IMPL_ADDREF(nsLayer) -NS_IMPL_RELEASE(nsLayer) - -nsLayer::~nsLayer() -{ - if (nsnull != mpCal) - { - delete mpCal; - mpCal = nsnull; - } -} - -nsresult nsLayer::Init() -{ - mpCal = new NSCalendar(0); - - return (NS_OK); -} - -nsresult nsLayer::SetCurl(const JulianString& s) -{ - msCurl = s; - return (NS_OK); -} - -nsresult nsLayer::GetCurl(JulianString& s) -{ - s = msCurl; - return (NS_OK); -} - - -nsresult nsLayer::SetCal(NSCalendar* aCal) -{ - mpCal = aCal; - return (NS_OK); -} - - -nsresult nsLayer::GetCal(NSCalendar*& aCal) -{ - aCal = mpCal; - return (NS_OK); -} - -/** - * Check to see if the layer matches the supplied curl. - * In this case, matching means that the host and CSID - * values are equal. - * @param s the curl - * @return NS_OK on success - */ -nsresult nsLayer::URLMatch(const JulianString& aCurl, PRBool& aMatch) -{ - nsCurlParser curlA(msCurl); - nsCurlParser curlB(aCurl); - - aMatch = 0; - - if ( ( curlA.GetHost() == curlB.GetHost() ) && - ( curlA.GetCSID() == curlB.GetCSID() ) ) - aMatch = 1; - - return NS_OK; -} - - -/* - * CAPI Callback used to fetch data from a general CAPI location - * Gets nsCalStreamReader object. - * If parse not started yet. - * Start the parser - the parser will block automatically when - * no more data to parse. - * When parse is blocked, set size handled - */ -static int RcvData(void * pData, - char * pBuf, - size_t iSize, - size_t * piTransferred) -{ - nsCalStreamReader * pCalStreamReader = (nsCalStreamReader *) pData; - nsCapiCallbackReader * pCapiCallbackReader = pCalStreamReader->getReader(); - if (!pCalStreamReader->isParseStarted()) - { - PRMonitor * pMon = (PRMonitor*) pCalStreamReader->getCallerData(); - pCalStreamReader->setParseStarted(); - - /* - * Start up the thread that will receive the ical data - */ - PR_ExitMonitor(pMon); - } - - /* - * We're going to be adding a new buffer (unicode string) to the - * list of data. We don't want the other thread accessing the list - * while we're doing this. So, we enter the monitor... - */ - PR_EnterMonitor((PRMonitor *)pCapiCallbackReader->getMonitor()); - - /* - * if we're finished, set the CapiCallbackReader to finished. - */ - if (iSize == 0) - { - pCapiCallbackReader->setFinished(); - } - else - { - /* - * XXX: may want to ensure that pBuf is 0 terminated. - */ - char * pBufCopy = new char[strlen(pBuf)]; - strncpy(pBufCopy, pBuf, (size_t) strlen(pBuf)); - nsCapiBufferStruct * capiBuffer = new nsCapiBufferStruct(); - capiBuffer->m_pBuf = pBufCopy; - capiBuffer->m_pBufSize = iSize; - pCapiCallbackReader->AddBuffer(capiBuffer); - *piTransferred = iSize; - } - - /* - * The parsing thread may be waiting on more data before it - * can continue. When this happens, it enters a PR_WAIT for - * this monitor. We've just finished adding more data, so we - * want to notify the other thread now if it's waiting. - */ - PR_Notify((PRMonitor *)pCapiCallbackReader->getMonitor()); - PR_ExitMonitor((PRMonitor *)pCapiCallbackReader->getMonitor()); - - /* - * Now that another buffer is available for parsing, we want - * the parsing thread to take over. This will help keep the - * list of unparsed buffers to a minimum. - */ - // PR_Sleep(PR_INTERVAL_NO_WAIT); - return iSize > 0 ? 0 : -1; -} - -/* - * required to set gasViewPropList and giViewPropListCount for now - * will need to change local CAPI so null gasViewPropList will return - * all properties. - */ -static char * gasViewPropList[10] = { - "ATTENDEE", "DTSTART", "DTEND", "UID", "RECURRENCE-ID", - "DTSTAMP", "SUMMARY", "DESCRIPTION", "ORGANIZER", "TRANSP" -}; -static int giViewPropListCount = 10; - -/** - * Given an nsICapi interface, log in and get some initial data. - * @return NS_OK on success. - */ -nsresult nsLayer::FetchEventsByRange( - DateTime* aStart, - DateTime* aStop, - JulianPtrArray* anArray - ) -{ - /* - * Before we do anything, see if we've cached the info.. - */ - if ( aStart->compareTo(mpCal->getEventsSpanStart()) >= 0 && - 0 >= aStop->compareTo(mpCal->getEventsSpanEnd()) ) - { - mpCal->getEventsByRange(anArray, *aStart, *aStop); - return NS_OK; - } - - - ErrorCode status = ZERO_ERROR; - DateTime d; - char * psDTStart = 0; - char * psDTEnd = 0; - CAPIStream RcvStream = 0; - CAPIStatus capiStatus; - JulianPtrArray * pParsedCalList = new JulianPtrArray(); // destroyed - nsCalStreamReader * pCalStreamReader = 0; // destroyed - PRThread * parseThread = 0; - PRThread * mainThread = 0; - PRMonitor * pCBReaderMonitor = 0; // destroyed - PRMonitor *pThreadMonitor = 0; // destroyed - - NS_ASSERTION(0 != mpShell, "null shell in fetchEventsByRange"); - if (0 == mpShell) - return 1; // XXX fix this - - /* - * Select the capi interface to use for this operation... - * Each layer stores its curl, ask for a session based on - * the curl... - */ - nsICapi* pCapi = 0; - nsCalSession *pSession; - nsCurlParser curl(msCurl); - if (NS_OK == (mpShell->mSessionMgr.GetSession(msCurl, 0, curl.GetPassword().GetBuffer(), pSession))) - { - if (0 != pSession) - { - pCapi = pSession->mCapi; - } - } - else - { - NS_ASSERTION(1,"Could not get a session"); - pCapi = mpShell->mSessionMgr.GetAt(0L)->mCapi; // should comment this - } - - /* - * Set up the range of time for which we'll pull events... - */ - psDTStart = aStart->toISO8601().toCString(""); - psDTEnd = aStop->toISO8601().toCString(""); - - /* - * The data is actually read and parsed in another thread. Set it all - * up here... - */ - mainThread = PR_CurrentThread(); - pCBReaderMonitor = PR_NewMonitor(); // destroyed - nsCapiCallbackReader * capiReader = new nsCapiCallbackReader(pCBReaderMonitor); - pThreadMonitor = ::PR_NewMonitor(); // destroyed - PR_EnterMonitor(pThreadMonitor); - pCalStreamReader = new nsCalStreamReader(capiReader, pParsedCalList, parseThread, pThreadMonitor); - parseThread = PR_CreateThread(PR_USER_THREAD, - main_CalStreamReader, - pCalStreamReader, - PR_PRIORITY_NORMAL, - PR_LOCAL_THREAD, - PR_UNJOINABLE_THREAD, - 0); - - capiStatus = pCapi->CAPI_SetStreamCallbacks( - pSession->m_Session, &RcvStream, 0,0 ,RcvData, pCalStreamReader,0); - - if (CAPI_ERR_OK != capiStatus) - return 1; /* XXX: really need to fix this up */ - - { - /* XXX: Get rid of the local variables as soon as - * local capi can take a null list or as soon as - * cs&t capi can take a list. - */ - nsCurlParser sessionURL(msCurl); - char** asList = gasViewPropList; - int iListSize = giViewPropListCount; - - if (nsCurlParser::eCAPI == sessionURL.GetProtocol()) - { - asList = 0; - iListSize = 0; - } - - CAPIHandle h = 0; - JulianString sHandle(sessionURL.GetCSID()); - - /* - * The handle name may be a file name. We need to make sure that - * the characters are in URL form. That is "C|/bla" instead of - * "C:/bla" - */ - nsCurlParser::ConvertToURLFileChars(sHandle); - capiStatus = pCapi->CAPI_GetHandle( - pSession->m_Session, - sHandle.GetBuffer(),0,&h); - if (0 != capiStatus) - return 1; /* XXX really need to fix this */ - capiStatus = pCapi->CAPI_FetchEventsByRange( - pSession->m_Session, &h, 1, 0, - psDTStart, psDTEnd, - asList, iListSize, RcvStream); - } - - if (CAPI_ERR_OK != capiStatus) - return 1; /* XXX: really need to fix this up */ - - /* - * Wait here until we know the thread completed. - */ - if (!pCalStreamReader->isParseFinished() ) - { - PR_EnterMonitor(pThreadMonitor); - PR_Wait(pThreadMonitor,PR_INTERVAL_NO_TIMEOUT); - PR_ExitMonitor(pThreadMonitor); - } - - /* - * Load the retrieved events ito our calendar... - */ - int i,j; - NSCalendar* pCal; - JulianPtrArray* pEventList; - ICalComponent* pEvent; - for ( i = 0; i < pParsedCalList->GetSize(); i++) - { - pCal = (NSCalendar*)pParsedCalList->GetAt(i); - pEventList = pCal->getEvents(); - if (0 != pEventList) - { - for (j = 0; j < pEventList->GetSize(); j++) - { - pEvent = (ICalComponent*)pEventList->GetAt(j); - if (0 != pEvent) - { -#if 0 - UnicodeString usFmt("%(yyyy-MMM-dd hh:mma)B-%(hh:mma)e %S"); // XXX this needs to be put in a resource, then a variable that can be switched - char *psBuf = pEvent->toStringFmt(usFmt).toCString(""); - delete psBuf; -#endif - anArray->Add(pEvent); - mpCal->addEvent(pEvent); - } - } - } - } - - /** - * cleanup allocated memory - */ - delete [] psDTStart; psDTStart = 0; - delete [] psDTEnd; psDTEnd = 0; - delete pCalStreamReader; pCalStreamReader = 0; - delete capiReader; capiReader = 0; - PR_DestroyMonitor(pThreadMonitor); - PR_DestroyMonitor(pCBReaderMonitor); - - /* - * now that we have successfully retrieved information from aStart - * to aStop, update the Calendar's known range for events. - */ - mpCal->updateEventsRange(*aStart, *aStop); - - /* - * todo: need to delete calendars in pParsedCalList without - * deleting events in it - */ - capiStatus = pCapi->CAPI_DestroyStreams(pSession->m_Session, &RcvStream, 1, 0); - if (CAPI_ERR_OK != capiStatus) - return 1; /* XXX: really need to fix this up */ - - /* - * register the calendar... - */ - mpShell->mCalList.Add(mpCal); - - return NS_OK; -} - -/** - * Send data to CAPI. This is invoked on calls such as CAPI_StoreEvent. - */ -int SndData(void* pData, char* pBuf, size_t iSize, size_t *piTransferred) -{ - nsCapiBufferStruct* pCtx = (nsCapiBufferStruct*)pData; - *piTransferred = (pCtx->m_pBufSize > iSize) ? iSize : pCtx->m_pBufSize; - memcpy(pBuf,pCtx->m_pBuf,*piTransferred); - pCtx->m_pBufSize -= *piTransferred; - pCtx->m_pBuf += *piTransferred; - return pCtx->m_pBufSize > 0 ? 0 : -1; -} - -/** - * Save this event - * @return NS_OK on success. - */ -nsresult -nsLayer::StoreEvent(VEvent& addEvent) -{ - ErrorCode status = ZERO_ERROR; - PRThread * mainThread = 0; - CAPIStream SndStream = 0; - CAPIStatus capiStatus; - PRMonitor * pCBReaderMonitor = 0; // destroyed - PRMonitor *pThreadMonitor = 0; // destroyed - - /* - * Select the capi interface to use for this operation... - * Each layer stores its curl, ask for a session based on - * the curl... - */ - nsICapi* pCapi = 0; - nsCalSession *pSession; - nsCurlParser curl(msCurl); - if (NS_OK == (mpShell->mSessionMgr.GetSession(msCurl, 0, curl.GetPassword().GetBuffer(), pSession))) - { - if (0 != pSession) - { - pCapi = pSession->mCapi; - } - } - else - { - NS_ASSERTION(1,"Could not get a session"); - pCapi = mpShell->mSessionMgr.GetAt(0L)->mCapi; // should comment this - } - - /* - * The data is actually read and parsed in another thread. Set it all - * up here... - */ -#if 0 - mainThread = PR_CurrentThread(); - pCBReaderMonitor = PR_NewMonitor(); // destroyed - nsCapiCallbackReader * capiReader = new nsCapiCallbackReader(pCBReaderMonitor); - pThreadMonitor = ::PR_NewMonitor(); // destroyed - PR_EnterMonitor(pThreadMonitor); - parseThread = PR_CreateThread(PR_USER_THREAD, - main_CalStreamReader, - pCalStreamReader, - PR_PRIORITY_NORMAL, - PR_LOCAL_THREAD, - PR_UNJOINABLE_THREAD, - 0); - - capiStatus = pCapi->CAPI_SetStreamCallbacks( - pSession->m_Session, &RcvStream, 0, 0, RcvData, pCalStreamReader,0); -#else - UnicodeString thisEvent; - nsCapiBufferStruct sBuf; - - thisEvent = "Content-type: text/calendar\nContent-encoding: 7bit\n\nBEGIN:VCALENDAR\n"; - thisEvent += "METHOD: PUBLISH\n"; - thisEvent += addEvent.toICALString(); - thisEvent += "END:VCALENDAR\n"; - - sBuf.m_pBuf = thisEvent.toCString(""); - sBuf.m_pBufSize = strlen(sBuf.m_pBuf); - capiStatus = pCapi->CAPI_SetStreamCallbacks(pSession->m_Session, &SndStream, &SndData, (void *)&sBuf, nsnull, nsnull, 0); - - nsCurlParser sessionURL(msCurl); - char** asList = gasViewPropList; - int iListSize = giViewPropListCount; - - if (nsCurlParser::eCAPI == sessionURL.GetProtocol()) - { - asList = 0; - iListSize = 0; - } - - CAPIHandle h = 0; - JulianString sHandle(sessionURL.GetCSID()); - - /* - * The handle name may be a file name. We need to make sure that - * the characters are in URL form. That is "C|/bla" instead of - * "C:/bla" - */ - nsCurlParser::ConvertToURLFileChars(sHandle); - capiStatus = pCapi->CAPI_GetHandle( pSession->m_Session, sHandle.GetBuffer(), 0, &h); - if (0 != capiStatus) - return 1; /* XXX really need to fix this */ - - if ( CAPI_ERR_OK != (pCapi->CAPI_StoreEvent( pSession->m_Session, &h, 1, 0, &SndStream))) - { - } - -#endif - if (CAPI_ERR_OK != capiStatus) - return 1; /* XXX: really need to fix this up */ - - return NS_OK; -} - - diff --git a/mozilla/calendar/modules/core/src/nsLayerCollection.cpp b/mozilla/calendar/modules/core/src/nsLayerCollection.cpp deleted file mode 100644 index d05d775ee98..00000000000 --- a/mozilla/calendar/modules/core/src/nsLayerCollection.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include -#include "nscore.h" -#include "jdefines.h" -#include "ptrarray.h" -#include "julnstr.h" -#include "nsLayerCollection.h" -#include "nsCurlParser.h" -#include "nsCoreCIID.h" -#include "nsxpfcCIID.h" - -static NS_DEFINE_IID(kILayerIID, NS_ILAYER_IID); -static NS_DEFINE_IID(kILayerCollectionIID, NS_ILAYER_COLLECTION_IID); -static NS_DEFINE_IID(kCLayerCollectionCID, NS_LAYER_COLLECTION_CID); -static NS_DEFINE_IID(kCLayerCID, NS_LAYER_CID); - -nsLayerCollection::nsLayerCollection(nsISupports* outer) -{ - NS_INIT_REFCNT(); - mLayers = nsnull; - -} - -nsresult nsLayerCollection::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCLayerCollectionCID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) (nsLayerCollection *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kILayerCollectionIID)) { - *aInstancePtr = (void*) (nsILayerCollection *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kILayerIID)) { - *aInstancePtr = (void*) (nsILayer *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this) ; - AddRef(); - return NS_OK; - } - return (NS_NOINTERFACE); -} - -NS_IMPL_ADDREF(nsLayerCollection) -NS_IMPL_RELEASE(nsLayerCollection) - -nsLayerCollection::~nsLayerCollection() -{ - // XXX: Need to add a way to remove ref when delete all! - nsILayer * pLayer; - - while (mLayers->Count() > 0 ) - { - pLayer = (nsILayer*)mLayers->ElementAt(0); - RemoveLayer(pLayer); - mLayers->RemoveAt(0); - } - - NS_IF_RELEASE(mLayers); -} - -nsresult nsLayerCollection::Init() -{ - static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID); - - nsresult res = nsRepository::CreateInstance(kCVectorCID, - nsnull, - kCVectorCID, - (void **)&mLayers); - - if (NS_OK != res) - return res ; - - mLayers->Init(); - - return (NS_OK); -} - - -nsresult nsLayerCollection :: CreateIterator(nsIIterator ** aIterator) -{ - if (mLayers) { - mLayers->CreateIterator(aIterator); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult nsLayerCollection :: AddLayer(nsILayer * aLayer) -{ - mLayers->Append(aLayer); - NS_ADDREF(aLayer); - return NS_OK; -} - -nsresult nsLayerCollection :: RemoveLayer(nsILayer * aLayer) -{ - mLayers->Remove(aLayer); - NS_IF_RELEASE(aLayer); - return NS_OK; -} - -/** - * Remove any existing layers, and create a layer for each - * of the supplied urls. - * @param sCurl A string of space-delimited calendar urls - * that form the layer list. - * @return NS_OK on success - */ -nsresult nsLayerCollection::SetCurl(const JulianString& sC) -{ - nsILayer* pLayer; - nsresult res; - JulianString sCurl = sC; - - /* - * Delete all layers we currently hold... - */ - while (mLayers->Count() > 0 ) - { - pLayer = (nsILayer*)mLayers->ElementAt(0); - RemoveLayer(pLayer); - mLayers->RemoveAt(0); - } - - /* - * Now build up the layers based on what we have... - */ - JulianString s; - int32 i,j; - for (i = 0; i >= 0 && i < (PRInt32)sCurl.GetStrlen(); i = j + 1 ) - { - while (' ' == sCurl.GetBuffer()[i] && i < (PRInt32)sCurl.GetStrlen()) - ++i; - if (i >= (PRInt32)sCurl.GetStrlen()) - break; - /* - * XXX: - * this is a complete hack. I want to use the commented out - * lines below. But if I - * do we get library link errors. Maybe it will go away when we make - * the big changeover to nsString. - */ - -#if 0 - if (-1 == (j = sCurl.Strpbrk(i," \t"))) - j = sCurl.GetStrlen()-1; - s = sCurl(i,j-i+1); -#endif - -#if 1 - { - /* - * XXX: REMOVE this code when replacing the string. - */ - char sBuf[1024]; - int k; - char c; - for ( k = 0, j = i; - (' ' != (c = sCurl.GetBuffer()[j])) && (j < (PRInt32)sCurl.GetStrlen()); - j++, k++) - { - sBuf[k] = c; - } - sBuf[k] = 0; - s = sBuf; - } -#endif - - /* - * create a new layer for this curl - */ - if (NS_OK != (res = nsRepository::CreateInstance( - kCLayerCID, // class id that we want to create - nsnull, // not aggregating anything (this is the aggregatable interface) - kILayerIID, // interface id of the object we want to get back - (void**)&pLayer))) - return 1; // XXX fix this - pLayer->Init(); - pLayer->SetCurl(s); - AddLayer(pLayer); - NS_RELEASE(pLayer); - } - return (NS_OK); -} - -/** - * Build a string containing all the layers in this collection. - * @param s the returned string - * @return NS_OK on success. - */ -nsresult nsLayerCollection::GetCurl(JulianString& s) -{ - PRInt32 i; - PRInt32 iSize = mLayers->Count(); - JulianString sTmp; - nsILayer* pLayer; - nsresult res; - - s = ""; - for ( i = 0; i < (PRInt32)mLayers->Count(); i++) - { - pLayer = (nsILayer*)mLayers->ElementAt(i); - if ( NS_OK != (res = pLayer->GetCurl(sTmp))) - return res; - if (i > 0) - s += " "; - s += sTmp; - } - return (NS_OK); -} - - -nsresult nsLayerCollection::SetCal(NSCalendar* aCal) -{ - return (NS_OK); -} - - -nsresult nsLayerCollection::GetCal(NSCalendar*& aCal) -{ - return (NS_OK); -} - - -/** - * @param aStart Starting time for fetch - * @param aStart ending time for fetch - * @param anArray Match a returned boolean value. If a match is found this value - * is returned as PR_TRUE. Otherwise, the it is set to PR_FALSE. - * - * @return NS_OK on success - */ -nsresult nsLayerCollection::FetchEventsByRange( - DateTime* aStart, - DateTime* aStop, - JulianPtrArray* anArray - ) -{ - PRInt32 i,j; - PRInt32 iSize = mLayers->Count(); - PRInt32 iTmpSize; - nsILayer *pLayer; - JulianPtrArray TmpArray; - - /* - * XXX: - * This should be made multi-threaded... - */ - for ( i = 0; i < iSize; i++) - { - pLayer = (nsILayer*)mLayers->ElementAt(i); - if (NS_OK == (pLayer->FetchEventsByRange(aStart,aStop,&TmpArray))) - { - /* - * copy the stuff in TmpArray into anArray... - */ - for (j = 0, iTmpSize = TmpArray.GetSize(); j < iTmpSize; j++) - { - /* - * XXX: should sort these chronologically - */ - anArray->Add( TmpArray.GetAt(j) ); - } - - TmpArray.RemoveAll(); - } - } - return NS_OK; -} - -#if 0 -nsresult nsLayerCollection::FetchEventsByRange( - DateTime* aStart, - DateTime* aStop, - JulianPtrArray* anArray - ) -{ - PRLock *pLock; - PRCondVar *pSomeThreadsCompleted; - nsArray PendingThreadCompletions; - PRInt32 i; - PRInt32 iTmpSize; - PRInt32 iFinishedThreadCount = 0; - PRInt32 iCount = mLayers->Count(); - nsILayer *pLayer = 0; - PRThread *pThread = 0; - - pLock = PR_NewLock(); - pAThreadCompleted = PR_NewCondVar(pLock); - - /* - * Create a thread for each layer in the collection... - */ - for ( i = 0; i < iCount; i++) - { - pLayer = (nsILayer*)mLayers->ElementAt(i); - /* - * create a thread for pLayer.. - */ - pThread = PR_CreateThread( - PR_USER_THREAD, - main_LayerOpHandler, - pLayerOp, - PR_PRIORITY_NORMAL, - PR_LOCAL_THREAD, - PR_UNJOINABLE_THREAD, - 0); - } - - while (iFinishedThreadCount < iCount) - { - /* - * Wait for individual layers to complete... - */ - PR_Lock(pLock); - while ( 0 == PendingThreadCompletions.Count() ) - { - PR_WaitCondVar(pSomeThreadsCompleted,PR_INTERVAL_NO_TIMEOUT); - } - - /* - * At least one layer is now complete. Remove any threads from - * the pending list and put them into the completed list - */ - iFinishedThreadCount += PendingThreadCompletions.Count(); - PendingThreadCompletions.RemoveAll(); - PR_Unlock(pLock); - } - - /* - * All threads are done. Send command indicating data collection is done. - */ - - - return NS_OK; -} - -#endif - -/** - * @param aUrl the url for comparison. In this case, we check to see if - * both the host and cal store id match on any layer in - * the list. - * @param aMatch a returned boolean value. If a match is found this value - * is returned as PR_TRUE. Otherwise, the it is set to PR_FALSE. - * - * @return NS_OK on success - */ -nsresult nsLayerCollection::URLMatch(const JulianString& aUrl, PRBool& aMatch) -{ - PRInt32 i; - PRInt32 iSize = mLayers->Count(); - nsILayer *pLayer; - aMatch = PR_FALSE; - for ( i = 0; i < iSize; i++) - { - pLayer = (nsILayer*)mLayers->ElementAt(i); - if (NS_OK == (pLayer->URLMatch(aUrl,aMatch))) - { - if (PR_TRUE == aMatch) - return NS_OK; - } - } - return NS_OK; -} - -/** - * @param aShell the shell object - * - * @return NS_OK on success - */ -nsresult nsLayerCollection::SetShell(nsCalendarShell* aShell) -{ - mpShell = aShell; - PRInt32 i; - PRInt32 iSize = mLayers->Count(); - nsILayer *pLayer; - for ( i = 0; i < iSize; i++) - { - pLayer = (nsILayer*)mLayers->ElementAt(i); - pLayer->SetShell(aShell); - } - return NS_OK; -} - -/** - * @param aStart Starting time for fetch - * @param aStart ending time for fetch - * @param anArray Match a returned boolean value. If a match is found this value - * is returned as PR_TRUE. Otherwise, the it is set to PR_FALSE. - * - * @return NS_OK on success - */ -nsresult nsLayerCollection::StoreEvent(VEvent& addEvent) -{ - PRInt32 i,j; - PRInt32 iSize = mLayers->Count(); - PRInt32 iTmpSize; - nsILayer *pLayer; - JulianPtrArray TmpArray; - - /* - * XXX: - * This should be made multi-threaded... - */ - for ( i = 0; i < iSize; i++) - { - pLayer = (nsILayer*)mLayers->ElementAt(i); - if (NS_OK == (pLayer->StoreEvent(addEvent))) - { - break; - } - } - return NS_OK; -} diff --git a/mozilla/calendar/modules/install/windows/BUILD.BAT b/mozilla/calendar/modules/install/windows/BUILD.BAT deleted file mode 100755 index 68ab8502216..00000000000 --- a/mozilla/calendar/modules/install/windows/BUILD.BAT +++ /dev/null @@ -1,45 +0,0 @@ -@echo off - -if "%1" == "debug" goto debug -if "%1" == "release" goto release - -echo Usage: build [target] -echo Where target is one of the following: debug, release. -if "%1" == "" goto default -goto next - -:default -echo No target specified. Selecting debug as default target. - -:debug -copy ..\..\..\..\dist\win32_d.obj\bin\*.dll data\Program -copy ..\..\..\..\dist\win32_d.obj\bin\trex.exe data\Program -copy ..\..\..\..\dist\win32_d.obj\bin\netscape.cfg data\Program -goto next - -:release -copy ..\..\..\..\dist\win32_o.obj\bin\*.dll data\Program -copy ..\..\..\..\dist\win32_o.obj\bin\trex.exe data\Program -copy ..\..\..\..\dist\win32_o.obj\bin\netscape.cfg data\Program - - -:next -rem ....Build components... -setup\compile setup\setup.rul -g -copy setup\setup.ins disk1 -copy setup\setup.dbg disk1 -copy ..\..\..\..\trex\modules\parser\calxml\res\julian.cal data\ui -del data\data.z -icomp -i data\*.* data\data.z -copy data\data.z disk1 -del data\data.z -cd setup -del setup.pkg -packlist setup.lst -copy setup.pkg ..\disk1 -cd .. -copy setup\setup.bmp disk1 -del dist\setupex.exe -rmdir /s /q dist -mkdir dist -start /wait exebuild .\build.ini \ No newline at end of file diff --git a/mozilla/calendar/modules/install/windows/DATA/README.TXT b/mozilla/calendar/modules/install/windows/DATA/README.TXT deleted file mode 100644 index 8478239d7f2..00000000000 --- a/mozilla/calendar/modules/install/windows/DATA/README.TXT +++ /dev/null @@ -1,6 +0,0 @@ - - - Netscape Julian 0.1 Readme Goes Here! - - - diff --git a/mozilla/calendar/modules/install/windows/DATA/program/MSVCRTD.DLL b/mozilla/calendar/modules/install/windows/DATA/program/MSVCRTD.DLL deleted file mode 100644 index 024b2c15e1e..00000000000 Binary files a/mozilla/calendar/modules/install/windows/DATA/program/MSVCRTD.DLL and /dev/null differ diff --git a/mozilla/calendar/modules/install/windows/EXTSTUB.EXE b/mozilla/calendar/modules/install/windows/EXTSTUB.EXE deleted file mode 100755 index 21dc5866dd5..00000000000 Binary files a/mozilla/calendar/modules/install/windows/EXTSTUB.EXE and /dev/null differ diff --git a/mozilla/calendar/modules/install/windows/EXTSTUBC.EXE b/mozilla/calendar/modules/install/windows/EXTSTUBC.EXE deleted file mode 100755 index 54ced7cc2d9..00000000000 Binary files a/mozilla/calendar/modules/install/windows/EXTSTUBC.EXE and /dev/null differ diff --git a/mozilla/calendar/modules/install/windows/Exebuild.exe b/mozilla/calendar/modules/install/windows/Exebuild.exe deleted file mode 100755 index e84f27d03df..00000000000 Binary files a/mozilla/calendar/modules/install/windows/Exebuild.exe and /dev/null differ diff --git a/mozilla/calendar/modules/install/windows/ICOMP.EXE b/mozilla/calendar/modules/install/windows/ICOMP.EXE deleted file mode 100755 index 32ca4fc7318..00000000000 Binary files a/mozilla/calendar/modules/install/windows/ICOMP.EXE and /dev/null differ diff --git a/mozilla/calendar/modules/install/windows/build.ini b/mozilla/calendar/modules/install/windows/build.ini deleted file mode 100644 index d5b6cc0cea0..00000000000 --- a/mozilla/calendar/modules/install/windows/build.ini +++ /dev/null @@ -1,7 +0,0 @@ -[EXE Builder] -SrcDir=disk1 -DestDir=dist -CmdLine=Setup.exe -Password= -Title=Julian Calendar 0.1 -Compress=1 diff --git a/mozilla/calendar/modules/install/windows/i32stub.exe b/mozilla/calendar/modules/install/windows/i32stub.exe deleted file mode 100755 index 4d79c700927..00000000000 Binary files a/mozilla/calendar/modules/install/windows/i32stub.exe and /dev/null differ diff --git a/mozilla/calendar/modules/install/windows/i32stubc.exe b/mozilla/calendar/modules/install/windows/i32stubc.exe deleted file mode 100755 index e4eaf325bd4..00000000000 Binary files a/mozilla/calendar/modules/install/windows/i32stubc.exe and /dev/null differ diff --git a/mozilla/calendar/modules/manifest.mn b/mozilla/calendar/modules/manifest.mn deleted file mode 100644 index 47ab0eba6d3..00000000000 --- a/mozilla/calendar/modules/manifest.mn +++ /dev/null @@ -1,20 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../.. -DEPTH = ../.. - -ifeq ($(MOZ_ZULU_FREE), 1) -DIRS += nls -endif - -DIRS += util network parser core ui shell test - - - diff --git a/mozilla/calendar/modules/network/Makefile b/mozilla/calendar/modules/network/Makefile deleted file mode 100644 index 30edd04901f..00000000000 --- a/mozilla/calendar/modules/network/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - - diff --git a/mozilla/calendar/modules/network/capi/Makefile b/mozilla/calendar/modules/network/capi/Makefile deleted file mode 100644 index 980c28963b6..00000000000 --- a/mozilla/calendar/modules/network/capi/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/config.mk b/mozilla/calendar/modules/network/capi/config.mk deleted file mode 100644 index 1b8ad8c30d5..00000000000 --- a/mozilla/calendar/modules/network/capi/config.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR - -LD_LIBS += \ - raptorbase \ - xpcom$(MOZ_BITS) \ - $(NATIVE_LIBNLS_LIBS) \ - util10 \ - $(XP_REG_LIB) - -AR_LIBS += \ - capicore \ - capiinterface \ - $(NULL) - -EXTRA_LIBS += $(NSPR_LIBS) - diff --git a/mozilla/calendar/modules/network/capi/core/Makefile b/mozilla/calendar/modules/network/capi/core/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/core/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/core/inc/Makefile b/mozilla/calendar/modules/network/capi/core/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/core/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/core/inc/manifest.mn b/mozilla/calendar/modules/network/capi/core/inc/manifest.mn deleted file mode 100644 index 3ca5fe4ab4c..00000000000 --- a/mozilla/calendar/modules/network/capi/core/inc/manifest.mn +++ /dev/null @@ -1,21 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../.. - -EXPORTS = \ - nsCapiCIID.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/network/capi/core/inc/nsCapiCIID.h b/mozilla/calendar/modules/network/capi/core/inc/nsCapiCIID.h deleted file mode 100644 index 6f0cbd6d081..00000000000 --- a/mozilla/calendar/modules/network/capi/core/inc/nsCapiCIID.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCapiCIID_h__ -#define nsCapiCIID_h__ - -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsRepository.h" - -// b27849f0-41f9-11d2-924a-00805f8a7ab6 -#define NS_CAPI_LOCAL_CID \ -{ 0xb27849f0, 0x41f9, 0x11d2, \ - {0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } - -// 9e3dc500-41fa-11d2-924a-00805f8a7ab6 -#define NS_CAPI_CST_CID \ -{ 0x9e3dc500, 0x41fa, 0x11d2, \ - {0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } - - -#endif diff --git a/mozilla/calendar/modules/network/capi/core/manifest.mn b/mozilla/calendar/modules/network/capi/core/manifest.mn deleted file mode 100644 index 0a8efdb6b39..00000000000 --- a/mozilla/calendar/modules/network/capi/core/manifest.mn +++ /dev/null @@ -1,14 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/network/capi/core/src/Makefile b/mozilla/calendar/modules/network/capi/core/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/network/capi/core/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/core/src/config.mk b/mozilla/calendar/modules/network/capi/core/src/config.mk deleted file mode 100644 index 865f05e65a5..00000000000 --- a/mozilla/calendar/modules/network/capi/core/src/config.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include - -LIBRARY_NAME = capicore -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) - diff --git a/mozilla/calendar/modules/network/capi/core/src/manifest.mn b/mozilla/calendar/modules/network/capi/core/src/manifest.mn deleted file mode 100644 index 8f790040d54..00000000000 --- a/mozilla/calendar/modules/network/capi/core/src/manifest.mn +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCapiFactory.cpp \ - $(NULL) - -REQUIRES = raptor xpcom julian nls - diff --git a/mozilla/calendar/modules/network/capi/core/src/nsCapiFactory.cpp b/mozilla/calendar/modules/network/capi/core/src/nsCapiFactory.cpp deleted file mode 100644 index f6732ed3c2d..00000000000 --- a/mozilla/calendar/modules/network/capi/core/src/nsCapiFactory.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsIFactory.h" -#include "nsISupports.h" -#include "nsCapiCIID.h" - -#include "nsCapiLocal.h" -#include "nsCapiCST.h" - -static NS_DEFINE_IID(kCCapiIID, NS_ICAPI_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); - -static NS_DEFINE_IID(kCCapiLocalCID, NS_CAPI_LOCAL_CID); -static NS_DEFINE_IID(kCCapiCSTCID, NS_CAPI_CST_CID); - - -class nsCapiFactory : public nsIFactory -{ - public: - // nsISupports methods - NS_IMETHOD QueryInterface(const nsIID &aIID, - void **aResult); - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - // nsIFactory methods - NS_IMETHOD CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult); - - NS_IMETHOD LockFactory(PRBool aLock); - - nsCapiFactory(const nsCID &aClass); - ~nsCapiFactory(); - - private: - nsrefcnt mRefCnt; - nsCID mClassID; -}; - -nsCapiFactory::nsCapiFactory(const nsCID &aClass) -{ - mRefCnt = 0; - mClassID = aClass; -} - -nsCapiFactory::~nsCapiFactory() -{ - NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); -} - -nsresult nsCapiFactory::QueryInterface(const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - // Always NULL result, in case of failure - *aResult = NULL; - - 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; -} - -nsrefcnt nsCapiFactory::AddRef() -{ - return ++mRefCnt; -} - -nsrefcnt nsCapiFactory::Release() -{ - if (--mRefCnt == 0) { - delete this; - return 0; // Don't access mRefCnt after deleting! - } - return mRefCnt; -} - -nsresult nsCapiFactory::CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - *aResult = NULL; - - nsISupports *inst = nsnull; - - if (mClassID.Equals(kCCapiLocalCID)) { - inst = (nsISupports *)(nsICapi *)new nsCapiLocal(aOuter); - } else if (mClassID.Equals(kCCapiCSTCID)) { - inst = (nsISupports *)new nsCapiCST(aOuter); - } - - if (inst == NULL) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult res = inst->QueryInterface(aIID, aResult); - - if (res != NS_OK) { - // We didn't get the right interface, so clean up - delete inst; - } - - return res; -} - -nsresult nsCapiFactory::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; - } - - *aFactory = new nsCapiFactory(aClass); - - if (nsnull == aFactory) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); -} - diff --git a/mozilla/calendar/modules/network/capi/cst/Makefile b/mozilla/calendar/modules/network/capi/cst/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/cst/bin/Makefile b/mozilla/calendar/modules/network/capi/cst/bin/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/bin/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/cst/bin/manifest.mn b/mozilla/calendar/modules/network/capi/cst/bin/manifest.mn deleted file mode 100644 index 85fc4d83558..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/bin/manifest.mn +++ /dev/null @@ -1,12 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../.. - -DIRS = $(PLATFORM_DIRECTORY) diff --git a/mozilla/calendar/modules/network/capi/cst/bin/unix/Makefile b/mozilla/calendar/modules/network/capi/cst/bin/unix/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/bin/unix/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/cst/bin/unix/manifest.mn b/mozilla/calendar/modules/network/capi/cst/bin/unix/manifest.mn deleted file mode 100644 index 4ad08254bb8..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/bin/unix/manifest.mn +++ /dev/null @@ -1,16 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../../.. - -MODULE = trex - -REQUIRES = raptor - -libs:: diff --git a/mozilla/calendar/modules/network/capi/cst/bin/windows/Makefile b/mozilla/calendar/modules/network/capi/cst/bin/windows/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/bin/windows/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/cst/bin/windows/capi.dll b/mozilla/calendar/modules/network/capi/cst/bin/windows/capi.dll deleted file mode 100644 index 9446e08c601..00000000000 Binary files a/mozilla/calendar/modules/network/capi/cst/bin/windows/capi.dll and /dev/null differ diff --git a/mozilla/calendar/modules/network/capi/cst/bin/windows/manifest.mn b/mozilla/calendar/modules/network/capi/cst/bin/windows/manifest.mn deleted file mode 100644 index 9c5615bde3d..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/bin/windows/manifest.mn +++ /dev/null @@ -1,17 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../../.. - -MODULE = trex - -REQUIRES = raptor - -libs:: - $(INSTALL) capi.dll $(DIST)/bin diff --git a/mozilla/calendar/modules/network/capi/cst/inc/Makefile b/mozilla/calendar/modules/network/capi/cst/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/cst/inc/capi.h b/mozilla/calendar/modules/network/capi/cst/inc/capi.h deleted file mode 100644 index 8f8fb973d26..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/inc/capi.h +++ /dev/null @@ -1,207 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * capi.h - * - * sman - * 30-Jun-98 - */ - -#ifndef __JULIAN_LOCAL_CAPI_H -#define __JULIAN_LOCAL_CAPI_H - - -/* At this point you should define the macro NS_CALENDAR for function declarations. - -Some appropriate definitions are - -Win32 with MSVC: - -#define NS_CALENDAR(a) __declspec(dllimport) a - -Solaris: - -#define NS_CALENDAR(a) a - -*/ - -typedef void* CAPISession; -typedef void* CAPIHandle; -typedef void* CAPIStream; -typedef long CAPIStatus; - -#define CAPI_THISINSTANCE 1 -#define CAPI_THISANDPRIOR 2 -#define CAPI_THISANDFUTURE 3 - -#define CAPI_CALLBACK_CONTINUE 0 -#define CAPI_CALLBACK_DONE -1 - -#ifdef CAPI_ERRCODES /* These are not yet supported */ - -#define CAPI_ERR_OK 0 - -#define CAPI_ERR_CALLBACK 1 -#define CAPI_ERR_COMP_NOT_FOUND 2 -#define CAPI_ERR_CORRUPT_HANDLE 3 -#define CAPI_ERR_CORRUPT_SESSION 4 -#define CAPI_ERR_CORRUPT_STREAM 5 -#define CAPI_ERR_DATE 6 -#define CAPI_ERR_DATE_RANGE 7 -#define CAPI_ERR_EXPIRED 8 -#define CAPI_ERR_FLAGS 9 -#define CAPI_ERR_HOST 10 -#define CAPI_ERR_INTERNAL 11 -#define CAPI_ERR_IO 12 -#define CAPI_ERR_NO_MEMORY 13 -#define CAPI_ERR_NOT_IMPLEMENTED 14 -#define CAPI_ERR_NULL_PARAMETER 15 -#define CAPI_ERR_PROPERTIES_BLOCKED 16 -#define CAPI_ERR_REQUIRED_PROPERTY_MISSING 17 -#define CAPI_ERR_SECURITY 18 -#define CAPI_ERR_SERVER 19 -#define CAPI_ERR_UID 20 -#define CAPI_ERR_USERNAME_PASSWORD 21 - -#endif - -typedef int (*CAPICallback)( - void* pData, /* i: caller-defined data, the value */ - /* supplied in CAPI_SetStreamCallbacks */ - char* pBuf, /* i: buffer to read or write */ - size_t iSize, /* i: the number of characters in pBuf */ - size_t* piTransferred); /* o: the number of characters from pBuf that */ - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -NS_CALENDAR (CAPIStatus) CAPI_Capabilities( - const char** ppsVal, /* o: a string describing the capabilities */ - const char* psHost, /* i: server host */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - /* were processed. */ - -NS_CALENDAR (CAPIStatus) CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier); /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - -NS_CALENDAR (CAPIStatus) CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: pointer to a list of handles to destroy */ - int iHandleCount, /* i: number of valid handles in pHList */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR (CAPIStatus) CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iHandlCount, /* i: number of valid handles in ppH */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR (CAPIStatus) CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_CALENDAR (CAPIStatus) CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_CALENDAR (CAPIStatus) CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_CALENDAR (CAPIStatus) CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH); /* o: handle */ - -NS_CALENDAR (CAPIStatus) CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR (CAPIStatus) CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession); /* o: the session */ - -NS_CALENDAR (CAPIStatus) CAPI_SetStreamCallbacks ( - CAPISession s, /* i: The login session */ - CAPIStream* pStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback,/* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback,/* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR (CAPIStatus) CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream stream ); /* i: stream for reading data to store */ - -#ifdef __cplusplus -} -#endif - -/* Finally include additional vendor specific information */ - -#include "cstcapi.h" - - -#endif /* __JULIAN_LOCAL_CAPI_H */ diff --git a/mozilla/calendar/modules/network/capi/cst/inc/cstcapi.h b/mozilla/calendar/modules/network/capi/cst/inc/cstcapi.h deleted file mode 100644 index 3d2226e33c4..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/inc/cstcapi.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - - The contents of this file are subject to the Mozilla Public - License Version 1.1 (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/MPL/ - - 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 this file as it was released on September 3, 1998. - - The Initial Developer of the Original Code is Corporate Software & - Technologies Int, Inc. Portions created by Corporate Software & Technologies - Int, Inc are Copyright (C) 1998 Corporate Software & Technologies Int, - Inc. All Rights Reserved. - - */ - - -/* This is the vendor specific header file for the capi C API library. - - This header file contains a few miscellaneous definitions, the function - prototypes, datastructre and error code definitions, specific to CS&T. - -*/ - - -#ifndef _CAPI_HEADER_ -#define _CAPI_HEADER_ - -/* Version information */ - -#define CAPI_VERSION_NAME "CAPI Version 0.4" -#define CAPI_VERSION_NUMBER "//CS&T//CAPI B.00.04 private beta//EN" -#define CAPI_VERSION_EXPIRY_DATE "19980918T040000Z" - -/* #define FUNCTION_DEF in the following place. */ - -#ifndef FUNCTION_DEF -/* please #define FUNCTION_DEF(a) here */ -#endif - -/* To make the header C++ friendly: */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Stuff for using the functions, a few definitions */ - - - /* If a callback function returns an error this error will be returned by the - * function which used the callback. To allow the unambiguous identification - * of an error which was returned by the call back they will be returned cast - * to type CAPIStatus with the bits in the following mask set. A regular - * CAPI error will never have these bits set. - **/ - -#define CAPI_CALLBACK_ERR_MASK ((CAPIStatus) 0x80000000) - - - /* There is one additional function for this API. */ - - -NS_CALENDAR(CAPIStatus) CAPI_GetLastStoredUIDs( - CAPISession pSession, /* i: The session to fetch UID from */ - char *** UIDs, /* o: malloced array of strings containing UIDs */ - long * size, /* o: size of array */ - long lFlags); /* i: 0 at this time */ - - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/* - * The error codes returned by CAPI library functions follow. Error codes are - * often context-sensitive, so explanations of their meanings are included with - * the function descriptions. - **/ - - -#ifndef CAPI_ID_ERR -#define CAPI_ID_ERR 0x00019800 -#endif - -#define CAPI_ERR_OK ((CAPIStatus) 0x00) - - /* Critical errors */ - -#define CAPI_ERR_EXPIRED ((CAPIStatus) CAPI_ID_ERR + 0x01) -#define CAPI_ERR_FLAGS ((CAPIStatus) CAPI_ID_ERR + 0x02) -#define CAPI_ERR_NO_MEMORY ((CAPIStatus) CAPI_ID_ERR + 0x03) -#define CAPI_ERR_NULL_PARAMETER ((CAPIStatus) CAPI_ID_ERR + 0x04) -#define CAPI_ERR_INIFILE ((CAPIStatus) CAPI_ID_ERR + 0x05) -#define CAPI_ERR_CORRUPT_SESSION ((CAPIStatus) CAPI_ID_ERR + 0x06) -#define CAPI_ERR_CORRUPT_HANDLE ((CAPIStatus) CAPI_ID_ERR + 0x07) -#define CAPI_ERR_CORRUPT_STREAM ((CAPIStatus) CAPI_ID_ERR + 0x08) -#define CAPI_ERR_IO ((CAPIStatus) CAPI_ID_ERR + 0x09) -#define CAPI_ERR_FILE ((CAPIStatus) CAPI_ID_ERR + 0x0A) -#define CAPI_ERR_CALLBACK ((CAPIStatus) CAPI_ID_ERR + 0x0B) -#define CAPI_ERR_SECURITY ((CAPIStatus) CAPI_ID_ERR + 0x0C) -#define CAPI_ERR_NOT_SUPPORTED ((CAPIStatus) CAPI_ID_ERR + 0x0D) - - /* Data errors */ - -#define CAPI_ERR_NULL_HANDLE ((CAPIStatus) CAPI_ID_ERR + 0x21) -#define CAPI_ERR_NULL_STREAM ((CAPIStatus) CAPI_ID_ERR + 0x22) -#define CAPI_ERR_NULL_SESSION ((CAPIStatus) CAPI_ID_ERR + 0x23) -#define CAPI_ERR_BAD_PARAMETER ((CAPIStatus) CAPI_ID_ERR + 0x24) -#define CAPI_ERR_USER_X400 ((CAPIStatus) CAPI_ID_ERR + 0x25) -#define CAPI_ERR_USER_NONE ((CAPIStatus) CAPI_ID_ERR + 0x26) -#define CAPI_ERR_USER_MANY ((CAPIStatus) CAPI_ID_ERR + 0x27) -#define CAPI_ERR_PASS ((CAPIStatus) CAPI_ID_ERR + 0x28) -#define CAPI_ERR_HOST ((CAPIStatus) CAPI_ID_ERR + 0x29) -#define CAPI_ERR_SERVER ((CAPIStatus) CAPI_ID_ERR + 0x2A) -#define CAPI_ERR_NODE ((CAPIStatus) CAPI_ID_ERR + 0x2B) -#define CAPI_ERR_DATE_RANGE ((CAPIStatus) CAPI_ID_ERR + 0x2C) -#define CAPI_ERR_DATE_STRING ((CAPIStatus) CAPI_ID_ERR + 0x2D) -#define CAPI_ERR_UID ((CAPIStatus) CAPI_ID_ERR + 0x2E) -#define CAPI_ERR_AGENDA ((CAPIStatus) CAPI_ID_ERR + 0x2F) - - /* Parse errors (Data errors for MIME and Icalendar parsing. */ - -#define CAPI_ERR_PARSE_ICAL ((CAPIStatus) CAPI_ID_ERR + 0x31) -#define CAPI_ERR_PARSE_MIME ((CAPIStatus) CAPI_ID_ERR + 0x32) - - /* An internal error occurred, either the result of an unexpected event, - or a bug. */ - -#define CAPI_ERR_INTERNAL ((CAPIStatus) CAPI_ID_ERR + 0x40) - - /* non-fatal errors, indicating that the operation was successful, but under - unusual circumstances, which could be a mistake. These errors are not all - implemented in the code yet. */ - -#define CAPI_NOHANDLES_NONFATAL_ERR ((CAPIStatus) CAPI_ID_ERR + 0xC1) -#define CAPI_NOEVENTS_NONFATAL_ERR ((CAPIStatus) CAPI_ID_ERR + 0xC2) -#define CAPI_CANTINVITE_NONFATAL_ERR ((CAPIStatus) CAPI_ID_ERR + 0xC3) -#define CAPI_STORE_NONFATAL_ERR ((CAPIStatus) CAPI_ID_ERR + 0xC4) -#define CAPI_BADINPUT_NONFATAL_ERR ((CAPIStatus) CAPI_ID_ERR + 0xC5) -#define CAPI_ERR_NONFATAL_EVENT_IGNORED ((CAPIStatus) CAPI_ID_ERR + 0xC6) -#define CAPI_ERR_NONFATAL_PROP_RESTRICT ((CAPIStatus) CAPI_ID_ERR + 0xC7) - -#endif /* _CAPI_HEADER_ */ diff --git a/mozilla/calendar/modules/network/capi/cst/inc/manifest.mn b/mozilla/calendar/modules/network/capi/cst/inc/manifest.mn deleted file mode 100644 index bdc84c6918b..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/inc/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - capi.h \ - cstcapi.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor julian nls shell trex diff --git a/mozilla/calendar/modules/network/capi/cst/lib/Makefile b/mozilla/calendar/modules/network/capi/cst/lib/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/lib/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/cst/lib/manifest.mn b/mozilla/calendar/modules/network/capi/cst/lib/manifest.mn deleted file mode 100644 index 85fc4d83558..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/lib/manifest.mn +++ /dev/null @@ -1,12 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../.. - -DIRS = $(PLATFORM_DIRECTORY) diff --git a/mozilla/calendar/modules/network/capi/cst/lib/unix/Makefile b/mozilla/calendar/modules/network/capi/cst/lib/unix/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/lib/unix/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/cst/lib/unix/manifest.mn b/mozilla/calendar/modules/network/capi/cst/lib/unix/manifest.mn deleted file mode 100644 index 4ad08254bb8..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/lib/unix/manifest.mn +++ /dev/null @@ -1,16 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../../.. - -MODULE = trex - -REQUIRES = raptor - -libs:: diff --git a/mozilla/calendar/modules/network/capi/cst/lib/windows/Makefile b/mozilla/calendar/modules/network/capi/cst/lib/windows/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/lib/windows/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/cst/lib/windows/capi.lib b/mozilla/calendar/modules/network/capi/cst/lib/windows/capi.lib deleted file mode 100644 index db87e6c3218..00000000000 Binary files a/mozilla/calendar/modules/network/capi/cst/lib/windows/capi.lib and /dev/null differ diff --git a/mozilla/calendar/modules/network/capi/cst/lib/windows/manifest.mn b/mozilla/calendar/modules/network/capi/cst/lib/windows/manifest.mn deleted file mode 100644 index 1fc299ab45a..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/lib/windows/manifest.mn +++ /dev/null @@ -1,17 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../../.. - -MODULE = trex - -REQUIRES = raptor - -libs:: - $(INSTALL) capi.lib $(DIST)/lib diff --git a/mozilla/calendar/modules/network/capi/cst/manifest.mn b/mozilla/calendar/modules/network/capi/cst/manifest.mn deleted file mode 100644 index 216456d9ee6..00000000000 --- a/mozilla/calendar/modules/network/capi/cst/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = lib bin - diff --git a/mozilla/calendar/modules/network/capi/inc/JulianParser.h b/mozilla/calendar/modules/network/capi/inc/JulianParser.h deleted file mode 100644 index ae473dd6fef..00000000000 --- a/mozilla/calendar/modules/network/capi/inc/JulianParser.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * jparser.h - * John Sun - * 4/28/98 10:45:21 AM - */ -#ifndef __NSQQnsCalStreamReader_H_ -#define __NSQQnsCalStreamReader_H_ - -#include "ptrarray.h" -#include "icalredr.h" -#include "nsCapiCallbackReader.h" -#include "jutility.h" -#include "nspr.h" - -/** - * This class will be removed later. It is a hack I created to - * parse the MIME-message from the CS&T server fetch results. - * I will try to extract the iCalendar information from it. - * I will need to handle multi-threaded parsing somehow as well. - */ -class nsCalStreamReader -{ -private: - /*char * m_Buffer;*/ - - static nsCalUtility::MimeEncoding stringToEncodingType(UnicodeString & propVal); - - JulianPtrArray * m_OutCalendars; - nsCapiCallbackReader * m_Reader; - t_bool m_bParseStarted; - t_bool m_bParseFinished; - PRThread * m_Thread; - -public: - nsCalStreamReader(); - nsCalStreamReader(nsCapiCallbackReader * reader, JulianPtrArray * outCalendars, - PRThread * thread); - /* - void setBuffer(char * buf) - { - strcat(m_Buffer, buf); - } - */ - - t_bool isParseStarted() const { return m_bParseStarted; } - void setParseStarted() { m_bParseStarted = TRUE; } - - t_bool isParseFinished() const { return m_bParseFinished; } - void setParseFinished() { m_bParseFinished = TRUE; } - - nsCapiCallbackReader * getReader() const { return m_Reader; } - PRThread * getThread() const { return m_Thread; } - - void ParseCalendars(ICalReader * reader, - JulianPtrArray * outCalendars); - - void ParseCalendars(); - -}; - -#ifdef XP_CPLUSPLUS -extern "C"{ -#endif - - void jparser_ParseCalendarsZero(void * jp, void *); - -#ifdef XP_CPLUSPLUS -}; -#endif - -#endif /* __NSQQnsCalStreamReader_H_ */ - diff --git a/mozilla/calendar/modules/network/capi/inc/Makefile b/mozilla/calendar/modules/network/capi/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/inc/manifest.mn b/mozilla/calendar/modules/network/capi/inc/manifest.mn deleted file mode 100644 index d2be5451a5c..00000000000 --- a/mozilla/calendar/modules/network/capi/inc/manifest.mn +++ /dev/null @@ -1,23 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsCapiLocal.h \ - nsCapiCST.h \ - nscapiexport.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/network/capi/inc/nsCalStreamReader.h b/mozilla/calendar/modules/network/capi/inc/nsCalStreamReader.h deleted file mode 100644 index 71d4447695b..00000000000 --- a/mozilla/calendar/modules/network/capi/inc/nsCalStreamReader.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef __NSQQnsCalStreamReader_H_ -#define __NSQQnsCalStreamReader_H_ - -#include "nscapiexport.h" -#include "ptrarray.h" -#include "icalredr.h" -#include "nsCapiCallbackReader.h" -#include "jutility.h" -#include "nspr.h" - -/** - * This class will be removed later. It is a hack I created to - * parse the MIME-message from the CS&T server fetch results. - * I will try to extract the iCalendar information from it. - * I will need to handle multi-threaded parsing somehow as well. - */ -CLASS_EXPORT_CAPI nsCalStreamReader -{ -private: - static nsCalUtility::MimeEncoding stringToEncodingType(UnicodeString & propVal); - - - /* dont deallocate these */ - JulianPtrArray * m_OutCalendars; - nsCapiCallbackReader * m_Reader; - t_bool m_bParseStarted; - t_bool m_bParseFinished; - PRThread * m_Thread; - void * m_CallerData; - -public: - nsCalStreamReader(); - ~nsCalStreamReader(); - nsCalStreamReader( - nsCapiCallbackReader * reader, - JulianPtrArray * outCalendars, - PRThread * thread, - void* condvar); - t_bool isParseStarted() const { return m_bParseStarted; } - void setParseStarted() { m_bParseStarted = TRUE; } - - t_bool isParseFinished() const { return m_bParseFinished; } - void setParseFinished() { m_bParseFinished = TRUE; } - - nsCapiCallbackReader * getReader() const { return m_Reader; } - PRThread * getThread() const { return m_Thread; } - void * getCallerData() const { return m_CallerData; } - - void ParseCalendars( - ICalReader * reader, - JulianPtrArray * outCalendars); - - void ParseCalendars(); -}; - -#ifdef XP_CPLUSPLUS -extern "C"{ -#endif - - void NS_CAPIEXPORT main_CalStreamReader(void * jp); - -#ifdef XP_CPLUSPLUS -}; -#endif - -#endif /* __NSQQnsCalStreamReader_H_ */ - diff --git a/mozilla/calendar/modules/network/capi/inc/nsCapiCST.h b/mozilla/calendar/modules/network/capi/inc/nsCapiCST.h deleted file mode 100644 index 88fe5b3466c..00000000000 --- a/mozilla/calendar/modules/network/capi/inc/nsCapiCST.h +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCapiCST_h___ -#define nsCapiCST_h___ - -#include "nsICapi.h" -#include "nspr.h" -#include "capi.h" - -typedef CAPIStatus (*Capabilities)(const char** ppsVal,const char* psHost,long lFlags); -typedef CAPIStatus (*DeleteEvent)(CAPISession s,CAPIHandle* pH,int iHandleCount,long lFlags,char* psUID,char* dtRecurrenceID,int iModifier); -typedef CAPIStatus (*DestroyHandles)(CAPISession s,CAPIHandle* pHList,int iHandleCount,long lFlags); -typedef CAPIStatus (*DestroyStreams)(CAPISession s,CAPIStream* pS,int iHandleCount,long lFlags); -typedef CAPIStatus (*FetchEventsByAlarmRange)(CAPISession s,CAPIHandle* pH,int iHandleCount,long lFlags,char* dStart,char* dEnd,char** ppsPropList,int iPropCount,CAPIStream stream); -typedef CAPIStatus (*FetchEventsByID)(CAPISession s,CAPIHandle h,long lFlags,char* psUID,char* dtRecurrenceID,int iModifier,char** ppsPropList,int iPropCount,CAPIStream stream); -typedef CAPIStatus (*FetchEventsByRange)(CAPISession s,CAPIHandle* pH,int iHandleCount,long lFlags,char* dStart,char* dEnd,char** ppsPropList,int iPropCount,CAPIStream stream) ; -typedef CAPIStatus (*GetHandle)(CAPISession s,char* u,long lFlags,CAPIHandle* pH); -typedef CAPIStatus (*Logoff)(CAPISession* s,long lFlags); -typedef CAPIStatus (*Logon)(const char* psUser,const char* psPassword,const char* psHost,long lFlags,CAPISession* pSession); -typedef CAPIStatus (*SetStreamCallbacks)(CAPISession s,CAPIStream* pStream,CAPICallback pfnSndCallback,void* userDataSnd,CAPICallback pfnRcvCallback,void* userDataRcv,long lFlags ); -typedef CAPIStatus (*StoreEvent)(CAPISession s,CAPIHandle* pH,int iHandleCount,long lFlags,CAPIStream stream ); -typedef CAPIStatus (*LogonCurl)(const char* psCurl,const char* psPassword,long lFlags,CAPISession* pSession); - -typedef struct { - Capabilities capabilities; - DeleteEvent delete_event; - DestroyHandles destroy_handles; - DestroyStreams destroy_streams; - FetchEventsByAlarmRange fetch_events_by_alarm_range; - FetchEventsByID fetch_events_by_id; - FetchEventsByRange fetch_events_by_range; - GetHandle get_handle; - Logoff logoff; - Logon logon; - SetStreamCallbacks set_stream_callbacks; - StoreEvent store_event; -} capi_cst_funcs ; - - -class nsCapiCST : public nsICapi -{ -public: - nsCapiCST(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - - NS_IMETHOD_(CAPIStatus) CAPI_Capabilities( - const char** ppsVal, /* o: a string describing the capabilities */ - const char* psHost, /* i: server host */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - /* were processed. */ - -NS_IMETHOD_(CAPIStatus) CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier); /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - -NS_IMETHOD_(CAPIStatus) CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: pointer to a list of handles to destroy */ - int iHandleCount, /* i: number of valid handles in pHList */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iHandlCount, /* i: number of valid handles in ppH */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_IMETHOD_(CAPIStatus) CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_IMETHOD_(CAPIStatus) CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_IMETHOD_(CAPIStatus) CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH); /* o: handle */ - -NS_IMETHOD_(CAPIStatus) CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession); /* o: the session */ - -NS_IMETHOD_(CAPIStatus) CAPI_SetStreamCallbacks ( - CAPISession s, - CAPIStream* pStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback,/* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback,/* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream stream ); /* i: stream for reading data to store */ - -protected: - ~nsCapiCST(); - -private: - PRLibrary * mLibrary; - capi_cst_funcs mFunctions; - -}; - -#endif /* nsCapiCST_h___ */ diff --git a/mozilla/calendar/modules/network/capi/inc/nsCapiCallbackReader.h b/mozilla/calendar/modules/network/capi/inc/nsCapiCallbackReader.h deleted file mode 100644 index 8a42ed9bd79..00000000000 --- a/mozilla/calendar/modules/network/capi/inc/nsCapiCallbackReader.h +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * capiredr.h - * John Sun - * 4/16/98 3:31:51 PM - */ -#ifndef __NSQQnsCapiCallbackReader_H_ -#define __NSQQnsCapiCallbackReader_H_ - -#include "nscapiexport.h" -#include "jdefines.h" -#include -#include "ptrarray.h" -#include "icalredr.h" -#include "prmon.h" -#include "jutility.h" - -/** - * nsCapiBufferStruct is contains the data passed in by the callback in CAPI. - * This struct encapsulates the data in m_pBuf, - * and the size of the passed in data in m_pBufSize. - */ -CLASS_EXPORT_CAPI nsCapiBufferStruct -{ -public: - char * m_pBuf; - size_t m_pBufSize; -}; - -/** - * nsCapiCallbackReader is a subclass of ICalReader. It implements - * the ICalReader interface to work with CAPI callback method - * to parse from stream. - * Uses multiple threads. - */ -CLASS_EXPORT_CAPI nsCapiCallbackReader -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - - /* current buffer of iCal information, - * when CAPI has information to return to - * the buffer, it must append to this buffer - * when no more full-lines can be made from the - * buffer, block on the monitor. Will be - * notified when CAPI gets back more information - */ - char * m_Buffer; - - t_int32 m_BufferSize; - t_bool m_Init; - t_int32 m_Mark; - t_int32 m_ChunkMark; - t_int32 m_Pos; - t_int32 m_ChunkIndex; - - - /** encoding of stream */ - nsCalUtility::MimeEncoding m_Encoding; - - /** need to deallocate */ - JulianPtrArray * m_Chunks; - - static const t_int32 m_MAXBUFFERSIZE; - static const t_int32 m_NOMORECHUNKS; - - /* finished getting input from CAPI callback */ - t_bool m_bFinished; - - /** do not deallocate */ - PRMonitor * m_Monitor; - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - - UnicodeString & createLine(t_int32 oldPos, t_int32 oldChunkIndex, - t_int32 newPos, t_int32 newChunkIndex, UnicodeString & aLine); - - static void deleteCapiBufferStructVector(JulianPtrArray * bufferVector); - - nsCapiCallbackReader(); -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - nsCapiCallbackReader(PRMonitor * monitor, - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit); - ~nsCapiCallbackReader(); - - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - - virtual void * getMonitor() { return m_Monitor; } - - void setFinished() { m_bFinished = TRUE; } - void setEncoding(nsCalUtility::MimeEncoding encoding) { m_Encoding = encoding; } - t_bool isFinished() const { return m_bFinished; } - - /** - * Don't delete u until this object is deleted. - * @param nsCapiBufferStruct * cBuf - * - * @return void - */ - void AddBuffer(nsCapiBufferStruct * cBuf); - /*----------------------------- - ** UTILITIES - **---------------------------*/ - - void mark() { m_Mark = m_Pos; m_ChunkMark = m_ChunkIndex;} - - void reset() { m_Pos = m_Mark; m_ChunkIndex = m_ChunkMark; m_Mark = -1; m_ChunkMark = -1; } - - /** - * Read next character from file. - * - * @param status, return 1 if no more characters - * @return next character of string - */ - virtual t_int8 read(ErrorCode & status); - - /** - * Read the next ICAL full line of the file. The definition - * of a full ICAL line can be found in the ICAL spec. - * Basically, a line followed by a CRLF and a space character - * signifies that the next line is a continuation of the previous line. - * Uses the readLine, read methods. - * - * @param aLine, returns next full line of string - * @param status, return 1 if no more lines - * - * @return next full line of string - */ - virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0); - - /** - * Read next line of file. A line is defined to be - * characters terminated by either a '\n', '\r' or "\r\n". - * @param aLine, return next line of string - * @param status, return 1 if no more lines - * - * @return next line of string - */ - virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status); - -}; - -#endif /* __NSQQnsCapiCallbackReader_H_ */ - diff --git a/mozilla/calendar/modules/network/capi/inc/nsCapiLocal.h b/mozilla/calendar/modules/network/capi/inc/nsCapiLocal.h deleted file mode 100644 index ba6c5c1669a..00000000000 --- a/mozilla/calendar/modules/network/capi/inc/nsCapiLocal.h +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCapiLocal_h___ -#define nsCapiLocal_h___ - -#include "nsICapi.h" -#include "nsICapiLocal.h" -#include "nspr.h" -#include "capi.h" - -typedef CAPIStatus (*Capabilities)(const char** ppsVal,const char* psHost,long lFlags); -typedef CAPIStatus (*DeleteEvent)(CAPISession s,CAPIHandle* pH,int iHandleCount,long lFlags,char* psUID,char* dtRecurrenceID,int iModifier); -typedef CAPIStatus (*DestroyHandles)(CAPISession s,CAPIHandle* pHList,int iHandleCount,long lFlags); -typedef CAPIStatus (*DestroyStreams)(CAPISession s,CAPIStream* pS,int iHandleCount,long lFlags); -typedef CAPIStatus (*FetchEventsByAlarmRange)(CAPISession s,CAPIHandle* pH,int iHandleCount,long lFlags,char* dStart,char* dEnd,char** ppsPropList,int iPropCount,CAPIStream stream); -typedef CAPIStatus (*FetchEventsByID)(CAPISession s,CAPIHandle h,long lFlags,char* psUID,char* dtRecurrenceID,int iModifier,char** ppsPropList,int iPropCount,CAPIStream stream); -typedef CAPIStatus (*FetchEventsByRange)(CAPISession s,CAPIHandle* pH,int iHandleCount,long lFlags,char* dStart,char* dEnd,char** ppsPropList,int iPropCount,CAPIStream stream) ; -typedef CAPIStatus (*GetHandle)(CAPISession s,char* u,long lFlags,CAPIHandle* pH); -typedef CAPIStatus (*Logoff)(CAPISession* s,long lFlags); -typedef CAPIStatus (*Logon)(const char* psUser,const char* psPassword,const char* psHost,long lFlags,CAPISession* pSession); -typedef CAPIStatus (*SetStreamCallbacks)(CAPISession s,CAPIStream* pStream,CAPICallback pfnSndCallback,void* userDataSnd,CAPICallback pfnRcvCallback,void* userDataRcv,long lFlags ); -typedef CAPIStatus (*StoreEvent)(CAPISession s,CAPIHandle* pH,int iHandleCount,long lFlags,CAPIStream stream ); -typedef CAPIStatus (*LogonCurl)(const char* psCurl,const char* psPassword,long lFlags,CAPISession* pSession); - -typedef struct { - Capabilities capabilities; - DeleteEvent delete_event; - DestroyHandles destroy_handles; - DestroyStreams destroy_streams; - FetchEventsByAlarmRange fetch_events_by_alarm_range; - FetchEventsByID fetch_events_by_id; - FetchEventsByRange fetch_events_by_range; - GetHandle get_handle; - Logoff logoff; - Logon logon; - SetStreamCallbacks set_stream_callbacks; - StoreEvent store_event; - LogonCurl logon_curl; -} capi_local_funcs ; - -class nsCapiLocal : public nsICapi, - public nsICapiLocal -{ -public: - nsCapiLocal(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - - NS_IMETHOD_(CAPIStatus) CAPI_Capabilities( - const char** ppsVal, /* o: a string describing the capabilities */ - const char* psHost, /* i: server host */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - /* were processed. */ - -NS_IMETHOD_(CAPIStatus) CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier); /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - -NS_IMETHOD_(CAPIStatus) CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: pointer to a list of handles to destroy */ - int iHandleCount, /* i: number of valid handles in pHList */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iHandlCount, /* i: number of valid handles in ppH */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_IMETHOD_(CAPIStatus) CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_IMETHOD_(CAPIStatus) CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_IMETHOD_(CAPIStatus) CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH); /* o: handle */ - -NS_IMETHOD_(CAPIStatus) CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession); /* o: the session */ - -NS_IMETHOD_(CAPIStatus) CAPI_SetStreamCallbacks ( - CAPISession s, - CAPIStream* pStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback,/* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback,/* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream stream ); /* i: stream for reading data to store */ - -NS_IMETHOD_(CAPIStatus) CAPI_LogonCurl( - const char* psCurl, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession); /* o: the session */ - -protected: - ~nsCapiLocal(); - -private: - PRLibrary * mLibrary; - capi_local_funcs mFunctions; -}; - -#endif /* nsCapiLocal_h___ */ diff --git a/mozilla/calendar/modules/network/capi/inc/nscapiexport.h b/mozilla/calendar/modules/network/capi/inc/nscapiexport.h deleted file mode 100644 index 8a364045e03..00000000000 --- a/mozilla/calendar/modules/network/capi/inc/nscapiexport.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * MODULE NOTES: - * @update gess 4/1/98 - */ - -#ifndef nscapiexport_h___ -#define nscapiexport_h___ - -#include "nscore.h" - -#ifdef _IMPL_NS_CAPI -#define NS_CAPIEXPORT NS_EXPORT -#else -#define NS_CAPIEXPORT NS_IMPORT -#endif - -#if defined(XP_MAC) - #define CLASS_EXPORT_CAPI NS_CAPIEXPORT class -#else - #define CLASS_EXPORT_CAPI class NS_CAPIEXPORT -#endif - -#endif /* nscapiexport_h___ */ - - diff --git a/mozilla/calendar/modules/network/capi/local/Makefile b/mozilla/calendar/modules/network/capi/local/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/local/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/local/inc/Makefile b/mozilla/calendar/modules/network/capi/local/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/local/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/local/inc/capi.h b/mozilla/calendar/modules/network/capi/local/inc/capi.h deleted file mode 100644 index 1fc84e70f7a..00000000000 --- a/mozilla/calendar/modules/network/capi/local/inc/capi.h +++ /dev/null @@ -1,315 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * capi.h - * - * sman - * 30-Jun-98 - */ - -#ifndef __JULIAN_LOCAL_CAPI_H -#define __JULIAN_LOCAL_CAPI_H - -#include "jdefines.h" -#include -#include "nscore.h" -#include "nscalexport.h" - -typedef void* CAPISession; -typedef void* CAPIHandle; -typedef void* CAPIStream; -typedef long CAPIStatus; - -#define CAPI_THISINSTANCE 1 -#define CAPI_THISANDPRIOR 2 -#define CAPI_THISANDFUTURE 3 - -#define CAPI_CALLBACK_CONTINUE 0 -#define CAPI_CALLBACK_DONE -1 - -#if 0 -#define CAPI_ERR_OK 0 - -#define CAPI_ERR_CALLBACK 1 -#define CAPI_ERR_COMP_NOT_FOUND 2 -#define CAPI_ERR_CORRUPT_HANDLE 3 -#define CAPI_ERR_CORRUPT_SESSION 4 -#define CAPI_ERR_CORRUPT_STREAM 5 -#define CAPI_ERR_DATE 6 -#define CAPI_ERR_DATE_RANGE 7 -#define CAPI_ERR_EXPIRED 8 -#define CAPI_ERR_FLAGS 9 -#define CAPI_ERR_HOST 10 -#define CAPI_ERR_INTERNAL 11 -#define CAPI_ERR_IO 12 -#define CAPI_ERR_NO_MEMORY 13 -#define CAPI_ERR_NOT_IMPLEMENTED 14 -#define CAPI_ERR_NULL_PARAMETER 15 -#define CAPI_ERR_PROPERTIES_BLOCKED 16 -#define CAPI_ERR_REQUIRED_PROPERTY_MISSING 17 -#define CAPI_ERR_SECURITY 18 -#define CAPI_ERR_SERVER 19 -#define CAPI_ERR_UID 20 -#define CAPI_ERR_USERNAME_PASSWORD 21 -#endif - -typedef int (*CAPICallback)( - void* pData, /* i: caller-defined data, the value */ - /* supplied in CAPI_SetStreamCallbacks */ - char* pBuf, /* i: buffer to read or write */ - size_t iSize, /* i: the number of characters in pBuf */ - size_t* piTransferred); /* o: the number of characters from pBuf that */ - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -NS_CALENDAR CAPIStatus CAPI_Capabilities( - const char** ppsVal, /* o: a string describing the capabilities */ - const char* psHost, /* i: server host */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - /* were processed. */ - -NS_CALENDAR CAPIStatus CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier); /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - -NS_CALENDAR CAPIStatus CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: pointer to a list of handles to destroy */ - int iHandleCount, /* i: number of valid handles in pHList */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR CAPIStatus CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iCount, /* i: number of valid handles in ppH */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR CAPIStatus CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_CALENDAR CAPIStatus CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_CALENDAR CAPIStatus CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream); /* i: stream to which solution set will be written */ - -NS_CALENDAR CAPIStatus CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH); /* o: handle */ - -NS_CALENDAR CAPIStatus CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR CAPIStatus CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession); /* o: the session */ - -NS_CALENDAR CAPIStatus CAPI_SetStreamCallbacks ( - CAPISession s, /* i: login session handle */ - CAPIStream* pStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback,/* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback,/* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ); /* i: bit flags (none at this time; set to 0) */ - -NS_CALENDAR CAPIStatus CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream stream ); /* i: stream for reading data to store */ - - -/* - * NETSCAPE EXTENSIONS TO CAPI - */ -NS_CALENDAR CAPIStatus CAPI_LogonCurl( - const char* psCurl, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession); /* o: the session */ - - -#ifdef __cplusplus -} -#endif - -/* The ok error */ -#define CAPI_ERR_OK ((CAPIStatus) 0x00) - -/* Masks for checking for fields of error codes */ -#define CAPI_ERRMASK_MODE_FIELD ((CAPIStatus) 0xFF << 24) -#define CAPI_ERRMASK_TYPE_FIELD ((CAPIStatus) 0x1F << 19) -#define CAPI_ERRMASK_ERR1_FIELD ((CAPIStatus) 0x1F << 14) -#define CAPI_ERRMASK_ERR2_FIELD ((CAPIStatus) 0x3F << 8) -#define CAPI_ERRMASK_VENDOR_FIELD ((CAPIStatus) 0xFF) - -/* Masks for checking for errors at various levels */ - -#define CAPI_ERRMASK_TYPE ((CAPIStatus) CAPI_ERRMASK_TYPE_FIELD) -#define CAPI_ERRMASK_ERR1 ((CAPIStatus) CAPI_ERRMASK_TYPE + CAPI_ERRMASK_ERR1_FIELD) -#define CAPI_ERRMASK_ERR2 ((CAPIStatus) CAPI_ERRMASK_ERR1 + CAPI_ERRMASK_ERR2_FIELD) -#define CAPI_ERRMASK_VENDOR ((CAPIStatus) CAPI_ERRMASK_ERR2 + CAPI_ERRMASK_VENDOR_FIELD) - -/* The non fatal error bit */ - -#define CAPI_ERRMODE_FATAL ((CAPIStatus) 0x1 << 24)) - -/* The various error types (field 2) */ -#define CAPI_ERRTYPE_DATA ((CAPIStatus) 0x1 << 19) -#define CAPI_ERRTYPE_SERVICE ((CAPIStatus) 0x2 << 19) -#define CAPI_ERRTYPE_API ((CAPIStatus) 0x3 << 19) -#define CAPI_ERRTYPE_SECURITY ((CAPIStatus) 0x4 << 19) -#define CAPI_ERRTYPE_LIBRARY ((CAPIStatus) 0x5 << 19) - -/* Data errors */ - -/* field 3 values */ -#define CAPI_ERR1_ICAL ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x1 << 14 )) -#define CAPI_ERR1_MIME ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x2 << 14 )) -#define CAPI_ERR1_DATE ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x3 << 14 )) -#define CAPI_ERR1_ID ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x4 << 14 )) - -/* field 4 values */ -#define CAPI_ERR2_MIME_NONE ((CAPIStatus) CAPI_ERR1_MIME + (0x1 << 8)) -#define CAPI_ERR2_MIME_NOICAL ((CAPIStatus) CAPI_ERR1_MIME + (0x2 << 8)) - -#define CAPI_ERR2_DATE_RANGE ((CAPIStatus) CAPI_ERR1_DATE + (0x1 << 8)) -#define CAPI_ERR2_DATE_FORMAT ((CAPIStatus) CAPI_ERR1_DATE + (0x2 << 8)) - -#define CAPI_ERR2_ID_USERID ((CAPIStatus) CAPI_ERR1_ID + (0x1 << 8)) -#define CAPI_ERR2_ID_HOSTNAME ((CAPIStatus) CAPI_ERR1_ID + (0x2 << 8)) - -/* field 5 values (Vendor specific errors) */ - -#define CAPI_ERR_IDUSERID_INIFILE ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x01) -#define CAPI_ERR_IDUSERID_FORMAT ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x02) -#define CAPI_ERR_IDUSERID_NONE ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x03) -#define CAPI_ERR_IDUSERID_MANY ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x04) -#define CAPI_ERR_IDUSERID_NODE ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x05) - -/* - * Service errors - */ - -/* field 3 values */ -#define CAPI_ERR1_MEMORY ((CAPIStatus) CAPI_ERRTYPE_SERVICE + (0x1 << 14 )) -#define CAPI_ERR1_FILE ((CAPIStatus) CAPI_ERRTYPE_SERVICE + (0x2 << 14 )) -#define CAPI_ERR1_NETWORK ((CAPIStatus) CAPI_ERRTYPE_SERVICE + (0x3 << 14 )) - -/* field 4 values */ -#define CAPI_ERR2_NETWORK_TIMEOUT ((CAPIStatus) CAPI_ERR1_NETWORK + (0x1 << 8)) - - -/* - * API errors - */ - -/* field 3 values */ -#define CAPI_ERR1_FLAGS ((CAPIStatus) CAPI_ERRTYPE_API + (0x1 << 14)) -#define CAPI_ERR1_NULLPARAM ((CAPIStatus) CAPI_ERRTYPE_API + (0x2 << 14)) -#define CAPI_ERR1_CALLBACK ((CAPIStatus) CAPI_ERRTYPE_API + (0x3 << 14)) -#define CAPI_ERR1_HANDLE ((CAPIStatus) CAPI_ERRTYPE_API + (0x4 << 14)) -#define CAPI_ERR1_SESSION ((CAPIStatus) CAPI_ERRTYPE_API + (0x5 << 14)) -#define CAPI_ERR1_STREAM ((CAPIStatus) CAPI_ERRTYPE_API + (0x6 << 14)) - -/* field 4 values */ -#define CAPI_ERR2_HANDLE_NULL ((CAPIStatus) CAPI_ERR1_HANDLE + (0x1 << 8)) -#define CAPI_ERR2_HANDLE_BAD ((CAPIStatus) CAPI_ERR1_HANDLE + (0x2 << 8)) - -#define CAPI_ERR2_SESSION_NULL ((CAPIStatus) CAPI_ERR1_SESSION + (0x1 << 8)) -#define CAPI_ERR2_SESSION_BAD ((CAPIStatus) CAPI_ERR1_SESSION + (0x2 << 8)) - -#define CAPI_ERR2_STREAM_NULL ((CAPIStatus) CAPI_ERR1_STREAM + (0x1 << 8)) -#define CAPI_ERR2_STREAM_BAD ((CAPIStatus) CAPI_ERR1_STREAM + (0x2 << 8)) - -/* - * Security errors - */ - -/* field 3 values */ -#define CAPI_ERR1_READ ((CAPIStatus) CAPI_ERRTYPE_SECURITY + (0x1 << 14)) -#define CAPI_ERR1_WRITE ((CAPIStatus) CAPI_ERRTYPE_SECURITY + (0x2 << 14)) - -/* field 4 values */ -#define CAPI_ERR2_READ_PROPS ((CAPIStatus) CAPI_ERR1_READ + (0x1 << 8)) - -#define CAPI_ERR2_WRITE_AGENDA ((CAPIStatus) CAPI_ERR1_WRITE + (0x1 << 8)) -#define CAPI_ERR2_WRITE_EVENT ((CAPIStatus) CAPI_ERR1_WRITE + (0x2 << 8)) - - -/* - * Library errors - */ -/* field 3 values */ -#define CAPI_ERR1_INTERNAL ((CAPIStatus) CAPI_ERRTYPE_LIBRARY + (0x1 << 14)) -#define CAPI_ERR1_IMPLENTATION ((CAPIStatus) CAPI_ERRTYPE_LIBRARY + (0x2 << 14)) - -/* field 4 values */ -#define CAPI_ERR2_INTERNALEXPIRY ((CAPIStatus) CAPI_ERR_INTERNAL + (0x1 << 8)) - -#endif /* __JULIAN_LOCAL_CAPI_H */ diff --git a/mozilla/calendar/modules/network/capi/local/inc/manifest.mn b/mozilla/calendar/modules/network/capi/local/inc/manifest.mn deleted file mode 100644 index 7a8cd0167e7..00000000000 --- a/mozilla/calendar/modules/network/capi/local/inc/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - capi.h \ - privcapi.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor julian nls shell trex diff --git a/mozilla/calendar/modules/network/capi/local/inc/privcapi.h b/mozilla/calendar/modules/network/capi/local/inc/privcapi.h deleted file mode 100644 index e7f6665ee97..00000000000 --- a/mozilla/calendar/modules/network/capi/local/inc/privcapi.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** -*** Private CAPI header file. -*** Defines the opaque types. -**/ -#ifndef __JULIAN_PRIVATE_CAPI_H -#define __JULIAN_PRIVATE_CAPI_H - -#include "nsString.h" -#include "xp_mcom.h" -#include "jdefines.h" -#include "julnstr.h" -#include "nspr.h" -#include "plstr.h" -#include "nsCurlParser.h" - -typedef struct -{ - nsCurlParser* pCurl; - char* psUser; /* i: Calendar store (and ":extra" information ) */ - char* psPassword; /* i: password for sUser */ - char* psHost; /* i: calendar server host (and :port) */ -} PCAPISESSION; - -typedef struct -{ - PCAPISESSION *pSession; - char* psFile; - nsCurlParser* pCurl; -} PCAPIHANDLE; - -typedef struct -{ - CAPICallback pfnSndCallback; /* i: Snd iCalendar data */ - void* pCallerSndDataBuf; /* i: Data buffer pointer Snd function */ - void* userDataRcv; /* i: a user supplied value */ - CAPICallback pfnRcvCallback; /* i: Rcv iCalendar data */ - void* userDataSnd; /* i: a user supplied value */ - long lFlags; /* i: bit flags (none at this time; set to 0) */ -} PCAPIStream; - -#endif /* __JULIAN_PRIVATE_CAPI_H */ \ No newline at end of file diff --git a/mozilla/calendar/modules/network/capi/local/manifest.mn b/mozilla/calendar/modules/network/capi/local/manifest.mn deleted file mode 100644 index e94c397fe52..00000000000 --- a/mozilla/calendar/modules/network/capi/local/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/network/capi/local/src/Makefile b/mozilla/calendar/modules/network/capi/local/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/network/capi/local/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/network/capi/local/src/capi.cpp b/mozilla/calendar/modules/network/capi/local/src/capi.cpp deleted file mode 100644 index 1c04af9f894..00000000000 --- a/mozilla/calendar/modules/network/capi/local/src/capi.cpp +++ /dev/null @@ -1,1404 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/**************************************************************** -*** Local CAPI -*** Steve Mansour -*****************************************************************/ -#include "jdefines.h" -#include -#include -#include -#include - -#include "capi.h" /* public capi file */ -#include "privcapi.h" /* private capi implementation */ - - -/* julian includes */ -#include "nscal.h" -#include "icalcomp.h" -#include "icalredr.h" -#include "icalfrdr.h" -#include "ptrarray.h" -#include "jlog.h" - -#ifdef XP_PC -#include "io.h" -#endif - -/**************************************************************** -*** UTILITY ROUTINES -*** In case we want to actually put this code into a dll, -*** this section should contain all the external calls. -*****************************************************************/ -size_t CAPI_strlen(const char * s) -{ - return strlen(s); -} - -char *CAPI_mktemp( char *psTemplate ) -{ -// XXX: Port this -#ifdef XP_PC - return _mktemp(psTemplate); -#endif -} - -int CAPI_access( const char *path, int mode ) -{ - return JXP_ACCESS(path,mode); -} - -void *CAPI_malloc(size_t i) -{ - return malloc( i ); -} - -void CAPI_free(void *p) -{ - if (0 != p) - free(p); -} - -int CAPI_unlink( const char *filename ) -{ -// XXX: Port this -#ifdef XP_PC - int iStatus = _unlink(filename); - if (iStatus < 0) - { - int iError = errno; - //TRACE( _sys_errlist[errno] ); - return iError; - } -#endif - return 0; -} - -char *CAPI_strdup(const char* s) -{ - if (0 != s) - { - char* p = (char *) malloc( 1 + strlen(s) ); - if (0 == p) - return 0; - return strcpy(p,s); - } - return 0; -} - -FILE *CAPI_fopen(const char *psFile, const char *psFlags) -{ - return fopen(psFile,psFlags); -} - -size_t CAPI_fread( void *buffer, size_t size, size_t count, FILE *stream ) -{ - return fread( buffer, size, count, stream ); -} - -size_t CAPI_fwrite( const void *buffer, size_t size, size_t count, FILE *stream ) -{ - return fwrite( buffer, size, count, stream ); -} - -int CAPI_fclose(FILE *pFile ) -{ - return fclose(pFile); -} - -void *CAPI_memcpy( void *dest, const void *src, size_t count ) -{ - return memcpy(dest,src,count); -} - -void *CAPI_memset( void *dest, int c, size_t count ) -{ - return memset(dest,c,count); -} - -/************************************************************************/ - -/** - * This is a useful piece of code but it's in the wrong - * place. Given a path, it ensures that the path exists, creating - * whatever needs to be created. - * @return 0 on success - * file creation errors otherwise. - */ -PRInt32 CAPI_EnsureUserPath( JulianString& sPath ) -{ - JulianString sTmp; - PRInt32 i; - nsCurlParser::ConvertToFileChars(sPath); - for (i = 0; -1 != (i = sPath.Strpbrk(i,"/\\")); i++ ) - { - sTmp = sPath.Left(i); - if (PR_SUCCESS != PR_Access(sTmp.GetBuffer(), PR_ACCESS_EXISTS)) - { - /* - * Try to create it... - */ - if (PR_SUCCESS != PR_MkDir(sTmp.GetBuffer(),PR_RDWR)) - { - PRInt32 iError = PR_GetError(); - return iError; - } - } - } - - /* - * OK, the path was there or it has been created. Now make - * sure we can write to it. - */ - if (PR_SUCCESS != PR_Access(sPath.GetBuffer(), PR_ACCESS_WRITE_OK)) - { - PRInt32 iError = PR_GetError(); - return iError; - } - - return 0; -} - - - -/**************************************************************** -*** MIME / ICAL ASSEMBLY FUNCTIONS -*****************************************************************/ -UnicodeString & createMimeStartHeader(UnicodeString & u) -{ - u = "MIME-Version: 1.0\r\n"; - u += "Content-Type: multipart/text\r\n"; - u += " boundary=\"5ZY4HSUIYKHTPFPN7Q30ROE94YXWQNBI\"\r\n"; - u += "Content-Transfer-Encoding: 7bit\r\n"; - u += "\r\n"; - u += "This is a multipart message in MIME format containing iCalendar data.\r\n"; - return u; -} - -UnicodeString & appendSeperator(UnicodeString & u) -{ - u += "--5ZY4HSUIYKHTPFPN7Q30ROE94YXWQNBI\r\n"; - return u; -} - -UnicodeString & appendMultipartMessageHeader(UnicodeString & u, UnicodeString & filename) -{ - appendSeperator(u); - u += "Content-Type: text/calendar\r\n"; - u += "Content-Disposition: attachment; filename=\""; - u += filename; - u += "\"\r\n"; - u += "Content-Transfer-Encoding: 7-bit\r\n\r\n"; - return u; -} - -UnicodeString & appendBeginVCalendar(UnicodeString & u) -{ - u += "BEGIN:VCALENDAR\r\n"; - return u; -} - -UnicodeString & appendEndVCalendar(UnicodeString & u) -{ - u += "END:VCALENDAR\r\n\r\n"; - return u; -} - - -/**************************************************************** -*** CAPI FUNCTIONS -*****************************************************************/ - -/** - * return the implementation specific information - */ -CAPIStatus CAPI_Capabilities( - const char** ppsVal, /* o: a string describing the capabilities */ - const char* psHost, /* i: server host */ - long lFlags ) /* i: bit flags (none at this time; set to 0) */ -{ - static char* tpsCap = "Vendor: Netscape\n\ -Version: 1.0\n\ -ServerVersion: 1.0 (localhost)\n\ -CAPIVersion: 1.0\n\ -fanout: no\n\ -atomicTransactions: no\n"; - - *ppsVal = tpsCap; - - return CAPI_ERR_OK; -} - -/** - * Delete an event from a list of calendar handles - */ -#define DEL_EXIT(x) {iRetStatus = x; goto DELEVENT_EXIT;} - -CAPIStatus CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier) /* i: one of CAPI_THISINSTANCE, CAPI_THISANDPRIOR, - CAPI_THISANDFUTURE only valid if recurrence-id - is non-NULL */ -{ - - /* - * Read the entire calendar into an NSCalendar : pCal - * Read the supplied event to delete into another ns calendar : pCalDel - * Search for the event in pCalDel in pCal. - * If found delete it from pCal then save pCal - */ - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIHANDLE* pHandle; - NSCalendar *pCal = 0; - CAPIStatus iRetStatus = CAPI_ERR_OK; - ICalReader * pRedr = 0; - JLog* pLog = 0; - UnicodeString uFilename; - t_bool bWriteStatus; - size_t iHits; - ErrorCode status = ZERO_ERROR; - VEvent *pEvent; - JulianPtrArray* pEventList = 0; - - if (0 == pSession) - return CAPI_ERR2_SESSION_BAD; - if (0 == pHList) - return CAPI_ERR2_HANDLE_BAD; - - for (int i = 0; i < iHandleCount; i++) - { - pHandle = (PCAPIHANDLE*) pHList[i]; - if (0 == pHandle) - DEL_EXIT(CAPI_ERR2_HANDLE_BAD) - - /* - * create an NSCalendar, pCal - */ - pCal = new NSCalendar(pLog); - if (pCal == 0) - DEL_EXIT(CAPI_ERR1_INTERNAL) - - /* - * Try to load pHandle->psFile in pCal. - * If the file doesn't exist, we don't have to create it and - * load it, because we're deleting events anyway. If there's nothing - * there to start with, there's nothing to delete. - */ - if (CAPI_access(pHandle->psFile, 00 /*F_OK*/)) - continue; - pRedr = (ICalReader *) new ICalFileReader(pHandle->psFile, status); - if (pRedr == 0) - DEL_EXIT(CAPI_ERR1_INTERNAL) - if (FAILURE(status)) - DEL_EXIT(CAPI_ERR1_INTERNAL) - - /* - * Load original datastore... - */ - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - delete pRedr; pRedr = 0; - - /* - * Try to find the event - */ - pEventList = pCal->getEvents(); - if (0 != pEventList) - { - pEvent = 0; - iHits = 0; - for (int j = 0; j < pEventList->GetSize(); j++) - { - pEvent = (VEvent *) pEventList->GetAt(j); - if (0 == pEvent) - continue; - if (0 == (pEvent->getUID().compare(psUID))) - { - /* - * need to check recurrence id here... - */ - iHits++; - pEventList->RemoveAt(j); - delete pEvent; - pEvent = 0; - --j; - } - } - } - - - /* - * Write the updated calendar store out to disk... - */ - if (iHits > 0) - { - pCal->export(pHandle->psFile, bWriteStatus); - if (!bWriteStatus) - DEL_EXIT(CAPI_ERR1_INTERNAL); - } - - delete pCal; - pCal = 0; - - } - - -DELEVENT_EXIT: - if (0 != pCal) - delete pCal; - if (0 != pRedr) - delete pRedr; - - return iRetStatus; -} - -/** - * Destroy a list of handles. - */ -CAPIStatus CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: array of handles to destroy */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - PCAPIHANDLE* pHandle; - int i; - for (i = 0; i < iHandleCount; i++ ) - { - pHandle = (PCAPIHANDLE *)pHList[i]; - if (pHandle != 0) - { - if (pHandle->pCurl) - delete pHandle->pCurl; - CAPI_free(pHandle->psFile); - CAPI_free(pHandle); - } - } - return CAPI_ERR_OK; -} - -/** - * Destroy a list of streams - */ -CAPIStatus CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iCount, /* i: number of valid handles in ppH */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - PCAPIStream** paS = (PCAPIStream **) pS; - for (int i = 0; i < iCount; i++) - delete paS[i]; - return CAPI_ERR_OK; -} - -/** - * return events that have alarms set to go off in the supplied time range. - */ -CAPIStatus CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream) /* i: stream to which solution set will be written */ -{ - return CAPI_ERR1_IMPLENTATION; -} - -#define FBID_EXIT(x) {iRetStatus = x; goto FBID_EXIT;} -#define FBRANGE_EXIT(x) {iRetStatus = x; goto FBRANGE_EXIT;} -/** - * Fetch an event from the local data store that matches the supplied UID, - * recurrence id, and modifier. - */ -CAPIStatus CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream str) /* i: stream to which solution set will be written */ -{ - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIHANDLE* pHandle = (PCAPIHANDLE*)h; - PCAPIStream* pStream = (PCAPIStream*)str; - - size_t iLen; - size_t iAmountHandled; - char *p; - CAPIStatus iStatus; - CAPIStatus iRetStatus = CAPI_ERR_OK; - char *pBuf = 0; - size_t iBufSize = BUFSIZ; - NSCalendar * pCal = 0; - ICalReader * pRedr = 0; - JulianPtrArray * evtVctr = 0; - ICalComponent * ic = 0; - JLog * pLog = 0; - UnicodeString usEvt; - UnicodeString u; - UnicodeString uRid; - UnicodeString uModifier; - UnicodeString strFmt; - ErrorCode status = ZERO_ERROR; - int32 i = 0; - UnicodeString uFilename = "calendar.ics"; - char * pCopy = 0; - - if (0 == pSession) - return CAPI_ERR2_SESSION_BAD; - if (0 == pHandle) - return CAPI_ERR2_HANDLE_BAD; - if (0 == pStream) - return CAPI_ERR2_STREAM_BAD; - - /* - * For this trivial implementation, we're going to read - * everything in the file and send it to the handler... - */ - if (0 != pStream->pfnRcvCallback) - { - /* - * We need an NSCalendar to do in-memory manipulations. - */ - pCal = new NSCalendar(pLog); - if (pCal == 0) - return CAPI_ERR1_INTERNAL; - evtVctr = new JulianPtrArray(); - if (evtVctr == 0) - FBID_EXIT(CAPI_ERR1_INTERNAL); - - /* - * Try to load pHandle->psFile in pCal - * if file error, return CAPI_ERR1_INTERNAL - */ - - if (CAPI_access(pHandle->psFile, 00 /*F_OK*/)) - { - FILE *pFile = 0; - if ( 0 == (pFile =CAPI_fopen(pHandle->psFile,"w"))) - FBID_EXIT(CAPI_ERR1_INTERNAL); - - if (0 != CAPI_fclose(pFile)) - FBID_EXIT(CAPI_ERR1_INTERNAL); - } - pRedr = (ICalReader *) new ICalFileReader(pHandle->psFile, status); - if (pRedr == 0) - FBID_EXIT(CAPI_ERR1_INTERNAL); - if (FAILURE(status)) - FBID_EXIT(CAPI_ERR1_INTERNAL); - - /* parse reader */ - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - - /* - * Apply the filter: - * JulianPtrArray EventVector - * pCal->GetEventsByID(&EventVector, psUID,dtRecurrenceID,iModifier ); - */ - /* TODO: use getEvents(uid, rid, range) */ - - u = psUID; - uRid = dtRecurrenceID; - uModifier = ""; - if (iModifier == CAPI_THISANDPRIOR) - uModifier = "THISANDPRIOR"; - else if (iModifier == CAPI_THISANDFUTURE) - uModifier = "THISANDFUTURE"; - - //pCal->getEvents(evtVctr, u); - pCal->getEventsByComponentID(evtVctr, u, uRid, uModifier); - - /* - * Stream out initialization ICAL: - * MIME header: - * Multipart-mime header: - * BEGIN:VCALENDAR - * separator - * END:VCALENDAR - */ - u = createMimeStartHeader(u); - appendMultipartMessageHeader(u, uFilename); - appendBeginVCalendar(u); - - if (0 == evtVctr->GetSize()) - { - appendEndVCalendar(u); - appendSeperator(u); - pCopy = u.toCString(""); - - if (pCopy != 0) - { - for(p = pCopy, iLen = CAPI_strlen(pCopy);iLen > 0; p += iAmountHandled) - { - iStatus = (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,iLen,&iAmountHandled); - if (CAPI_CALLBACK_CONTINUE != iStatus) - FBID_EXIT(CAPI_ERR1_CALLBACK); - iLen -= iAmountHandled; - } - delete [] pCopy; pCopy = 0; - } - else - { - FBID_EXIT(CAPI_ERR1_CALLBACK); - } - } - - /* - * For each event in EventVector... - * 0. TODO LATER: filter the event string by the supplied property list - * 1. Put an ICAL version of the event into sEvent - * - */ - ICalComponent::makeFormatString(ppsPropList, iPropCount, strFmt); - for (i = 0; i < evtVctr->GetSize(); i++) - { - ic = (ICalComponent *) evtVctr->GetAt(i); - - usEvt = ic->format(ICalComponent::componentToString(ic->GetType()), - strFmt, "", FALSE); - - // prepend MIME header to first event - // append END to last event - if (i == 0) - { - usEvt.insert(0, u); - } - if (i == evtVctr->GetSize() - 1) - { - appendEndVCalendar(usEvt); - appendSeperator(usEvt); - } - pCopy = usEvt.toCString(""); - if (pCopy == 0) - FBID_EXIT(CAPI_ERR1_MEMORY); - - for(p = pCopy, iLen = CAPI_strlen(pCopy);iLen > 0; p += iAmountHandled) - { - iStatus = (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,iLen,&iAmountHandled); - if (CAPI_CALLBACK_CONTINUE != iStatus) - FBID_EXIT(CAPI_ERR1_CALLBACK); - iLen -= iAmountHandled; - } - delete [] pCopy; pCopy = 0; - } - - /* - * Signal the end of transmission... - */ - (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,0,&iAmountHandled); - - -FBID_EXIT: - if (0 != pCal) - delete pCal; - if (0 != evtVctr) - delete evtVctr; - if (0 != pRedr) - delete pRedr; - if (0 != pCopy) - delete [] pCopy; - - } - return iRetStatus; -} - -/** - * Get a list of all the events that overlap a time range. - */ -CAPIStatus CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream str) /* i: stream to which solution set will be written */ -{ - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIHANDLE* pHandle = (PCAPIHANDLE*)pH; - PCAPIStream* pStream = (PCAPIStream*)str; - - size_t iLen; - size_t iAmountHandled; - char *p; - int i; - CAPIStatus iStatus; - CAPIStatus iRetStatus = CAPI_ERR_OK; - char *pBuf = 0; - size_t iBufSize = BUFSIZ; - - /* julian variables */ - NSCalendar * pCal = 0; - ICalReader * pRedr = 0; - JulianPtrArray * evtVctr = 0; - ICalComponent * ic = 0; - JLog * pLog = 0; - UnicodeString usEvt; - UnicodeString usHeader; - UnicodeString strFmt; - ErrorCode status = ZERO_ERROR; - char * pCopy = 0; - int32 j = 0; - DateTime start; - DateTime end; - UnicodeString uFilename; - UnicodeString uTemp; - - if (0 == pSession) - return CAPI_ERR2_SESSION_BAD; - if (0 == pH) - return CAPI_ERR2_HANDLE_BAD; - if (0 == pStream) - return CAPI_ERR2_STREAM_BAD; - - /* - * For this trivial implementation, we're going to read - * everything in the file and send it to the handler... - */ - if (0 != pStream->pfnRcvCallback) - { - /* - * For each handle, fetch events by range, print out event - * print mime-header if first handle. - * print mime-multipart stuff if first event. - */ - for (i = 0; i < iHandleCount; i++) - { - /*pCal = 0; - evtVctr = 0; - pRedr = 0; - pCopy = 0;*/ - pHandle = (PCAPIHANDLE *) pH[i]; - if (pHandle == 0) - { - return CAPI_ERR2_HANDLE_BAD; - } - - pCal = new NSCalendar(pLog); - if (pCal == 0) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - - evtVctr = new JulianPtrArray(); - if (evtVctr == 0) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - - /* - * Try to load pHandle->psFile in pCal - * if file error, return CAPI_ERR1_INTERNAL - */ - - if (CAPI_access(pHandle->psFile, 00 /*F_OK*/)) - { - FILE * pFile = 0; - if ( 0 == (pFile =CAPI_fopen(pHandle->psFile,"w"))) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - if (0 != CAPI_fclose(pFile)) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - } - - pRedr = (ICalReader *) new ICalFileReader(pHandle->psFile, status); - if (pRedr == 0) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - if (FAILURE(status)) - FBRANGE_EXIT(CAPI_ERR1_INTERNAL); - - /* parse reader */ - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - - /* apply filter */ - uTemp = dStart; - start.setTimeString(uTemp); - uTemp = dEnd; - end.setTimeString(uTemp); - pCal->getEventsByRange(evtVctr, start, end); - - /* - * Stream out initialization ICAL: - * Mime headers, Multipart headers, seperator, BEGIN:VCALENDAR, END:VCALENDAR - */ - - /** - * create mime start header if this is the first handle of the list - */ - if (i == 0) - { - usHeader = createMimeStartHeader(usHeader); - } - else - { - usHeader = ""; - } - /** - * append mime-multipart header and BEGIN:VCALENDAR - */ - appendMultipartMessageHeader(usHeader, uFilename); - appendBeginVCalendar(usHeader); - - if (0 == evtVctr->GetSize()) - { - appendEndVCalendar(usHeader); - if (i == iHandleCount - 1) - { - appendSeperator(usHeader); - } - pCopy = usHeader.toCString(""); - - if (pCopy != 0) - { - for(p = pCopy, iLen = CAPI_strlen(pCopy);iLen > 0; p += iAmountHandled) - { - iStatus = (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,iLen,&iAmountHandled); - if (CAPI_CALLBACK_CONTINUE != iStatus) - FBRANGE_EXIT(CAPI_ERR1_CALLBACK); - iLen -= iAmountHandled; - } - delete [] pCopy; pCopy = 0; - } - else - { - FBRANGE_EXIT(CAPI_ERR1_CALLBACK); - } - } - else - { - ICalComponent::makeFormatString(ppsPropList, iPropCount, strFmt); - for (j = 0; j < evtVctr->GetSize(); j++) - { - ic = (ICalComponent *) evtVctr->GetAt(j); - - usEvt = ic->format(ICalComponent::componentToString(ic->GetType()), - strFmt, "", FALSE); - - // prepend mime-header to first handle, first event - // prepend multipart-header to first event, non-first handle - if (j == 0) - { - if (i == 0) - { - usEvt.insert(0, usHeader); - } - else - { - uTemp = ""; - appendMultipartMessageHeader(uTemp, uFilename); - usEvt.insert(0, uTemp); - } - } - // append END:VCALENDAR to last event. - if (j == evtVctr->GetSize() - 1) - { - appendEndVCalendar(usEvt); - if (i == iHandleCount - 1) - { - appendSeperator(usEvt); - } - } - - pCopy = usEvt.toCString(""); - if (pCopy == 0) - FBRANGE_EXIT(CAPI_ERR1_MEMORY); - - for(p = pCopy, iLen = CAPI_strlen(pCopy);iLen > 0; p += iAmountHandled) - { - iStatus = (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,iLen,&iAmountHandled); - if (CAPI_CALLBACK_CONTINUE != iStatus) - FBRANGE_EXIT(CAPI_ERR1_CALLBACK); - iLen -= iAmountHandled; - } - delete [] pCopy; pCopy = 0; - } - } - - /* - * we're paranoid about a path that doesn't delete something - */ - if (0 != pCal) - { - delete pCal; - pCal = 0; - } - if (0 != evtVctr) - { - delete evtVctr; - evtVctr = 0; - } - if (0 != pRedr) - { - delete pRedr; - pRedr = 0; - } - if (0 != pCopy) - { - delete pCopy; - pCopy = 0; - } - } - - /* - * Signal the end of transmission... - */ - (*pStream->pfnRcvCallback)(pStream->userDataRcv,p,0,&iAmountHandled); - - } - -FBRANGE_EXIT: - if (0 != pCal) - delete pCal; - if (0 != evtVctr) - delete evtVctr; - if (0 != pRedr) - delete pRedr; - if (0 != pCopy) - delete pCopy; - - return iRetStatus; -} - -/** - * Return a handle to a specific calendar. In this implementation, - * the "user" should be the name of the file you want to open. - */ -CAPIStatus CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH) /* o: handle */ -{ - PCAPISESSION* pSession = (PCAPISESSION *) s; - PCAPIHANDLE* pHandle = (PCAPIHANDLE *) CAPI_malloc(sizeof(PCAPIHANDLE)); - if (0 == pSession) - return CAPI_ERR2_SESSION_NULL; - *pH = 0; - if (0 == pHandle) - return CAPI_ERR1_MEMORY; - - pHandle->pSession = pSession; - pHandle->pCurl = new nsCurlParser(u); - - /* - * For local capi, the user name is a file name. If it is not fully - * qualified, use the Curl in the session to fill in the missing parts. - */ - *pHandle->pCurl |= *pSession->pCurl; - - char* psLocalFile = pHandle->pCurl->ToLocalFile(); - pHandle->psFile = CAPI_strdup(psLocalFile); - PR_Free(psLocalFile); - - JulianString sPath = pHandle->pCurl->CSIDPath(); - if (NS_OK != CAPI_EnsureUserPath( sPath )) - { - // XXX do some error thing here... - // we should probably pop up a file dialog and let - // the user point us to a path to use. - return 1; - } - - *pH = pHandle; - return CAPI_ERR_OK; -} - -/** - * Close a session, release any associated memory. - */ -CAPIStatus CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - if (0 != s) - { - PCAPISESSION* pSession = (PCAPISESSION *) *s; - CAPI_free(pSession->psUser); - CAPI_free(pSession->psPassword); - CAPI_free(pSession->psHost); - delete pSession->pCurl; - CAPI_free(pSession); - *s = 0; - return CAPI_ERR_OK; - } - return CAPI_ERR2_SESSION_NULL; -} - -/** - * Open a session. - */ -CAPIStatus CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* ps) /* io: the session */ -{ - PCAPISESSION* pSession = (PCAPISESSION *) CAPI_malloc(sizeof(PCAPISESSION)); - *ps = 0; - if (0 == pSession) - return CAPI_ERR1_MEMORY; - pSession->psUser = CAPI_strdup(psUser); - pSession->psPassword = CAPI_strdup(psPassword); - pSession->psHost = CAPI_strdup(psHost); - - pSession->pCurl = new nsCurlParser(); - pSession->pCurl->SetHost(psHost); - pSession->pCurl->SetCSID(psUser); - - /* - * TODO: - * find / create the file associated with this user - */ - - *ps = (CAPISession) pSession; - return CAPI_ERR_OK; -} - -/** - * Open a session. - */ -CAPIStatus CAPI_LogonCurl( - const char* psCurl, /* i: the calendar url */ - const char* psPassword, /* i: password for sUser */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* ps) /* io: the session */ -{ - PCAPISESSION* pSession = (PCAPISESSION *) CAPI_malloc(sizeof(PCAPISESSION)); - *ps = 0; - if (0 == pSession) - return CAPI_ERR1_MEMORY; - pSession->psPassword = CAPI_strdup(psPassword); - - pSession->pCurl = new nsCurlParser(psCurl); - pSession->psUser = CAPI_strdup(pSession->pCurl->GetCSID().GetBuffer()); - pSession->psHost = CAPI_strdup(pSession->pCurl->GetHost().GetBuffer()); - - /* - * TODO: - * find / create the file associated with this user - */ - - *ps = (CAPISession) pSession; - return CAPI_ERR_OK; -} - -/** - * Set CAPI_Stream values - * pOpaqueStream is allocated if it is null. - */ -CAPIStatus CAPI_SetStreamCallbacks ( - CAPISession s, /* i: login session handle */ - CAPIStream* pOpaqueStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback, /* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback, /* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ) /* i: bit flags (none at this time; set to 0) */ -{ - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIStream* pRet = (PCAPIStream *)pOpaqueStream; - - if (0 == *pOpaqueStream) - { - pRet = (PCAPIStream *) CAPI_malloc(sizeof(PCAPIStream)); - if (0 == pRet) - return CAPI_ERR1_MEMORY; - CAPI_memset(pRet,0,sizeof(PCAPIStream)); - } - - pRet->pfnSndCallback = pfnSndCallback; - pRet->userDataSnd = userDataSnd; - pRet->pfnRcvCallback = pfnRcvCallback; - pRet->userDataRcv = userDataRcv; - - *pOpaqueStream = pRet; - - return CAPI_ERR_OK; -} - - -#define STOR_EXIT(x) {iRetStatus = x; goto STOREVENT_EXIT;} -/** - * Store the supplied event stream into the list of calendar stores pointed to - * by the supplied list of handles. - */ -CAPIStatus CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream str ) /* i: stream for reading data to store */ -{ - FILE *pFile; - PCAPISESSION *pSession = (PCAPISESSION*)s; - PCAPIHANDLE* pHandle; - PCAPIStream* pStream = (PCAPIStream*)str; - NSCalendar *pCal = 0; - char* pBuf = 0; - size_t iBufSize = BUFSIZ; - CAPIStatus iRetStatus = CAPI_ERR_OK; - CAPIStatus iStatus; - ICalReader * pRedr = 0; - JLog* pLog = 0; - UnicodeString uFilename; - int iTempFileCreated = 0; - int iWorking; - t_bool bWriteStatus; - size_t iLen; - ErrorCode status = ZERO_ERROR; - - if (0 == pSession) - return CAPI_ERR2_SESSION_BAD; - if (0 == pHList) - return CAPI_ERR2_HANDLE_BAD; - if (0 == pStream) - return CAPI_ERR2_STREAM_BAD; - - /* - * import the user supplied stream into pCal. - * In the interest of minimizing development time (ie, we're lazy) - * we're just going to save the user supplied data into a temporary file, - * import it into pCal, and write the result. - */ - - /* - * get a temporary file name... - */ - - char sTemplate[20]; - char* psTempFile; - sprintf(sTemplate,"CAPIXXXXXX"); - psTempFile = CAPI_mktemp( sTemplate ); - if( 0 == psTempFile) - return CAPI_ERR1_INTERNAL; - if( 0 == (pFile = CAPI_fopen(psTempFile,"w"))) - return CAPI_ERR1_INTERNAL; - - iTempFileCreated = 1; - pBuf = (char *) CAPI_malloc(iBufSize); - if (0 == pBuf) - STOR_EXIT(CAPI_ERR1_MEMORY); - - for( iWorking = 1; iWorking != 0; ) - { - iStatus = (*pStream->pfnSndCallback)( - pStream->userDataSnd, /* user data */ - pBuf, /* place to put the supplied data */ - iBufSize, /* the size of the buffer */ - &iLen); /* how much data was put in the buffer */ - if (iStatus > 0) - { - STOR_EXIT(CAPI_ERR1_CALLBACK); - } - else - { - if (iStatus == -1) - iWorking = 0; - if (iLen > 0) - { - if (iLen != CAPI_fwrite(pBuf,1,iLen,pFile)) - STOR_EXIT(CAPI_ERR1_CALLBACK); - } - } - } - - /* - * Temporary file has been written. Close pFile and import its contents into each - * of the caller supplied CAPI_handles - */ - if (0 != CAPI_fclose(pFile)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - pFile = 0; - CAPI_free(pBuf); - pBuf = 0; - - if (0 != pStream->pfnSndCallback) - { - - for (int i = 0; i < iHandleCount; i++) - { - pHandle = (PCAPIHANDLE*) pHList[i]; - if (0 == pHandle) - STOR_EXIT(CAPI_ERR2_HANDLE_BAD); - - /* - * create an NSCalendar, pCal - */ - pCal = new NSCalendar(pLog); - if (pCal == 0) - STOR_EXIT(CAPI_ERR1_INTERNAL); - - /* - * Try to load pHandle->psFile in pCal - * if file error, return CAPI_ERR1_INTERNAL - */ - - if (CAPI_access(pHandle->psFile, 00 /*F_OK*/)) - { - pFile = 0; - if ( 0 == (pFile =CAPI_fopen(pHandle->psFile,"w"))) - STOR_EXIT(CAPI_ERR1_INTERNAL); - - if (0 != CAPI_fclose(pFile)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - pFile = 0; - } - pRedr = (ICalReader *) new ICalFileReader(pHandle->psFile, status); - if (pRedr == 0) - STOR_EXIT(CAPI_ERR1_INTERNAL); - if (FAILURE(status)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - - /* - * Load original datastore... - */ - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - delete pRedr; pRedr = 0; - - - /* - * Import new event to store - */ - pRedr = (ICalReader *) new ICalFileReader(psTempFile, status); - if (pRedr == 0) - STOR_EXIT(CAPI_ERR1_INTERNAL); - if (FAILURE(status)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - uFilename = pHandle->psFile; - pCal->parse(pRedr, uFilename); - delete pRedr; pRedr = 0; - - /* - * Write the updated calendar store out to disk... - */ - pCal->export(pHandle->psFile, bWriteStatus); - if (!bWriteStatus) - STOR_EXIT(CAPI_ERR1_INTERNAL); - - delete pCal; - pCal = 0; - - } - } - - if (0 != CAPI_unlink(psTempFile)) - STOR_EXIT(CAPI_ERR1_INTERNAL); - iTempFileCreated = 0; - -STOREVENT_EXIT: - if (0 != pFile) - CAPI_fclose(pFile); - if (0 != pCal) - delete pCal; - if (0 != pRedr) - delete pRedr; - if (iTempFileCreated) - CAPI_unlink(psTempFile); - if (0 != pBuf) - CAPI_free(pBuf); - - return iRetStatus; -} - -/*************************************************************************************** -*** Simple test program -****************************************************************************************/ -#if 0 /* define test program */ -typedef struct -{ - char *p; - size_t iSize; -} CAPICTX; - -/** - * Send data to CAPI. This is invoked on calls such as CAPI_StoreEvent. - */ -int SndData(void* pData, char* pBuf, size_t iSize, size_t *piTransferred) -{ - CAPICTX* pCtx = (CAPICTX*)pData; - *piTransferred = (pCtx->iSize > iSize) ? iSize : pCtx->iSize; - CAPI_memcpy(pBuf, pCtx->p, *piTransferred ); - pCtx->iSize -= *piTransferred; - pCtx->p += *piTransferred; - return pCtx->iSize > 0 ? CAPI_CALLBACK_CONTINUE : CAPI_CALLBACK_DONE; -} - -/** - * Receive data from CAPI. This is invoked on calls such as - * CAPI_FetchEventsByID, CAPI_FetchEventsByRange. - */ -int RcvData(void* pData, char* pBuf, size_t iSize, size_t *piTransferred) -{ - CAPICTX* pCtx = (CAPICTX*)pData; - *piTransferred = (pCtx->iSize > iSize) ? iSize : pCtx->iSize; - CAPI_memcpy(pCtx->p, pBuf, *piTransferred ); - - /* - * for now, we're just going to print out whatever we get... - */ - { - char sBuf[2000]; - CAPI_memcpy(sBuf,pCtx->p,*piTransferred); - sBuf[*piTransferred]=0; - printf( "%s", sBuf ); - } - return CAPI_CALLBACK_CONTINUE; /* return values > 0 are error numbers. */ -} - -void main( int argc, char *argv[], char *envp[] ) -{ - char* psCap; - CAPIStatus s; - CAPISession Session; - CAPIHandle Handle; - char sBuf[BUFSIZ]; - CAPIStream SndStream; - CAPIStream RcvStream; - - CAPICTX MyCtx; - - if (CAPI_ERR_OK != (s = CAPI_Capabilities( &psCap, "localhost", 0 ))) - { - fprintf(stderr,"CAPI_Capabilities(): %ld\n", s); - exit(1); - } - - /* - * CAPABILITIES - */ - printf( "CAPI_Capabilities:\n%s\n", psCap ); - - /* - * LOGON - */ - if (CAPI_ERR_OK != (s = CAPI_Logon( "sman", "bla", "localhost", 0L, &Session ))) - { - fprintf(stderr,"CAPI_Logon(): %ld\n", s ); - exit(1); - } - printf("CAPI_Logon(): success\n" ); - - /* - * GET HANDLE - */ - if (CAPI_ERR_OK != (s = CAPI_GetHandle( Session, "c:/temp/junk.txt", 0, &Handle ))) - { - fprintf(stderr,"CAPI_Logon(): %ld\n", s ); - exit(1); - } - printf("CAPI_GetHandle(): success\n" ); - - /* - * STORE EVENT - */ - strcpy(sBuf,"Content-type: text/calendar\n\ -Content-encoding: 7bit\n\ -\n\ -BEGIN:VCALENDAR\n\ -METHOD:PUBLISH\n\ -PRODID:-//ACME/DesktopCalendar//EN\n\ -VERSION:2.0\n\ -BEGIN:VEVENT\n\ -ORGANIZER:mailto:a@example.com\n\ -DTSTART:19970701T200000Z\n\ -DTEND:19970701T220000Z\n\ -DTSTAMP:19970701T180000Z\n\ -SUMMARY:BIG TIME local capi store event\n\ -UID:QQIIDDLL098503945-34059873405-340598340@example.com\n\ -END:VEVENT\n\ -END:VCALENDAR\n" ); - MyCtx.p = sBuf; - MyCtx.iSize = strlen(sBuf); - if ( CAPI_ERR_OK != (s = CAPI_SetStreamCallbacks(Session, &SndStream, SndData, &MyCtx, 0, &MyCtx,0))) - { - fprintf(stderr,"CAPI_SetStreamCallbacks(): %ld\n", s ); - exit(1); - } - if ( CAPI_ERR_OK != (s = CAPI_StoreEvent( Session,&Handle,1,0,&SndStream))) - { - fprintf(stderr,"CAPI_StoreEvent(): %ld\n", s ); - exit(1); - } - - /* - * FETCH EVENT - */ - MyCtx.p = sBuf; - MyCtx.iSize = sizeof(sBuf); - if ( CAPI_ERR_OK != (s = CAPI_SetStreamCallbacks(Session, &RcvStream, 0,0,RcvData, &MyCtx,0))) - { - fprintf(stderr,"CAPI_SetStreamCallbacks(): %ld\n", s ); - exit(1); - } - if ( CAPI_ERR_OK != (s = CAPI_FetchEventsByID( Session,Handle,0,"098503945-34059873405-340598340@example.com",0,0,0,0,&RcvStream))) - { - fprintf(stderr,"CAPI_FetchEventsByID(): %ld\n", s ); - exit(1); - } - - /* - * DESTROY HANDLES - */ - if (CAPI_ERR_OK != (s = CAPI_DestroyHandles(Session, &Handle, 1, 0L))) - { - fprintf(stderr,"CAPI_DestroyHandles(): %ld\n", s ); - exit(1); - } - printf("CAPI_DestroyHandles(): success\n" ); - - /* - * LOGOFF - */ - if (CAPI_ERR_OK != (s = CAPI_Logoff( &Session, 0L))) - { - fprintf(stderr,"CAPI_Logoff(): %ld\n", s ); - exit(1); - } - printf("CAPI_Logoff(): success\n" ); - - if (0 != Session) - { - fprintf(stderr,"Session was not NULL after CAPI_Logoff\n"); - exit(1); - } - printf("CAPI Test Program: normal exit\n" ); -} -#endif /* define test program */ diff --git a/mozilla/calendar/modules/network/capi/local/src/config.mk b/mozilla/calendar/modules/network/capi/local/src/config.mk deleted file mode 100644 index 777d865eb7f..00000000000 --- a/mozilla/calendar/modules/network/capi/local/src/config.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -DNLS_DEFINE_STANDARD_TYPES=1 -INCLUDES += -I../inc -I$(GDEPTH)/include - - -LD_LIBS += \ - $(NATIVE_LIBNLS_LIBS) \ - util10 - -EXTRA_LIBS += $(NSPR_LIBS) - diff --git a/mozilla/calendar/modules/network/capi/local/src/manifest.mn b/mozilla/calendar/modules/network/capi/local/src/manifest.mn deleted file mode 100644 index 1c7c2b7f0cd..00000000000 --- a/mozilla/calendar/modules/network/capi/local/src/manifest.mn +++ /dev/null @@ -1,27 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -LIBRARY_NAME = capilocal - -MODULE = trex - -CPPSRCS = \ - capi.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls netlib - diff --git a/mozilla/calendar/modules/network/capi/manifest.mn b/mozilla/calendar/modules/network/capi/manifest.mn deleted file mode 100644 index 7764c3f4873..00000000000 --- a/mozilla/calendar/modules/network/capi/manifest.mn +++ /dev/null @@ -1,30 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS = cst core -DIRS_EXPORT = public inc -DIRS_LIBS = src - -LIBRARY_NAME = calcapi - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - - -MODULE = trex - -REQUIRES = xpcom raptor shell trex - - diff --git a/mozilla/calendar/modules/network/capi/public/Makefile b/mozilla/calendar/modules/network/capi/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/capi/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/capi/public/manifest.mn b/mozilla/calendar/modules/network/capi/public/manifest.mn deleted file mode 100644 index 5fc69a44fd0..00000000000 --- a/mozilla/calendar/modules/network/capi/public/manifest.mn +++ /dev/null @@ -1,23 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -EXPORTS = \ - nsICapi.h \ - nsICapiLocal.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/network/capi/public/nsICapi.h b/mozilla/calendar/modules/network/capi/public/nsICapi.h deleted file mode 100644 index d5082b661f6..00000000000 --- a/mozilla/calendar/modules/network/capi/public/nsICapi.h +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICapi_h___ -#define nsICapi_h___ - -#include "nsISupports.h" - -#include "capi.h" - -//88e55e80-41fa-11d2-924a-00805f8a7ab6 -#define NS_ICAPI_IID \ -{ 0x88e55e80, 0x41fa, 0x11d2, \ -{ 0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -class nsICapi : public nsISupports -{ - -public: - - NS_IMETHOD Init() = 0; - - NS_IMETHOD_(CAPIStatus) CAPI_Capabilities( - const char** ppsVal, /* o: a string describing the capabilities */ - const char* psHost, /* i: server host */ - long lFlags ) = 0; /* i: bit flags (none at this time; set to 0) */ - /* were processed. */ - -NS_IMETHOD_(CAPIStatus) CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier) = 0; /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - -NS_IMETHOD_(CAPIStatus) CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: pointer to a list of handles to destroy */ - int iHandleCount, /* i: number of valid handles in pHList */ - long lFlags) = 0; /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iHandlCount, /* i: number of valid handles in ppH */ - long lFlags) = 0; /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream) = 0; /* i: stream to which solution set will be written */ - -NS_IMETHOD_(CAPIStatus) CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream) = 0; /* i: stream to which solution set will be written */ - -NS_IMETHOD_(CAPIStatus) CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream) = 0; /* i: stream to which solution set will be written */ - -NS_IMETHOD_(CAPIStatus) CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH) = 0; /* o: handle */ - -NS_IMETHOD_(CAPIStatus) CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags) = 0; /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession) = 0; /* o: the session */ - -NS_IMETHOD_(CAPIStatus) CAPI_SetStreamCallbacks ( - CAPISession s, - CAPIStream* pStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback,/* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback,/* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ) = 0; /* i: bit flags (none at this time; set to 0) */ - -NS_IMETHOD_(CAPIStatus) CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream stream ) = 0; /* i: stream for reading data to store */ - -}; - -#endif /* nsICapi_h___ */ diff --git a/mozilla/calendar/modules/network/capi/public/nsICapiLocal.h b/mozilla/calendar/modules/network/capi/public/nsICapiLocal.h deleted file mode 100644 index acbcbdb842e..00000000000 --- a/mozilla/calendar/modules/network/capi/public/nsICapiLocal.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICapiLocal_h___ -#define nsICapiLocal_h___ - -#include "nsISupports.h" -#include "nsString.h" - -#include "capi.h" - -//0bd252a0-41fc-11d2-924a-00805f8a7ab6 -#define NS_ICAPI_LOCAL_IID \ -{ 0x0bd252a0, 0x41fc, 0x11d2, \ -{ 0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -class nsICapiLocal : public nsISupports -{ - -public: - - NS_IMETHOD Init() = 0; - -NS_IMETHOD_(CAPIStatus) CAPI_LogonCurl( - const char* psCurl, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession) = 0; /* o: the session */ - - -}; - -#endif /* nsICapiLocal_h___ */ diff --git a/mozilla/calendar/modules/network/capi/src/Makefile b/mozilla/calendar/modules/network/capi/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/network/capi/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/network/capi/src/config.mk b/mozilla/calendar/modules/network/capi/src/config.mk deleted file mode 100644 index 8bf81526e88..00000000000 --- a/mozilla/calendar/modules/network/capi/src/config.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CAPI -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include - -LIBRARY_NAME = capiinterface -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) diff --git a/mozilla/calendar/modules/network/capi/src/manifest.mn b/mozilla/calendar/modules/network/capi/src/manifest.mn deleted file mode 100644 index 85c8a024e56..00000000000 --- a/mozilla/calendar/modules/network/capi/src/manifest.mn +++ /dev/null @@ -1,26 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCapiLocal.cpp \ - nsCapiCST.cpp \ - $(NULL) - -REQUIRES = raptor xpcom trex julian nls - diff --git a/mozilla/calendar/modules/network/capi/src/nsCalStreamReader.cpp b/mozilla/calendar/modules/network/capi/src/nsCalStreamReader.cpp deleted file mode 100644 index 18721f2e771..00000000000 --- a/mozilla/calendar/modules/network/capi/src/nsCalStreamReader.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - - -#include "jdefines.h" - -#include -#include "nsCalStreamReader.h" -#include "prprty.h" -#include "tmbevent.h" -#include "nscal.h" -#include "jlog.h" -#include "keyword.h" -#include "icalsrdr.h" - -#include "nspr.h" - -//--------------------------------------------------------------------- - -nsCalStreamReader::nsCalStreamReader() -{ - m_Reader = 0; - m_OutCalendars = 0; - m_Thread = 0; - m_CallerData = 0; - m_bParseStarted = FALSE; - m_bParseFinished = FALSE; -} - -//--------------------------------------------------------------------- - -nsCalStreamReader::~nsCalStreamReader() -{ -} - -//--------------------------------------------------------------------- - -nsCalStreamReader::nsCalStreamReader(nsCapiCallbackReader * reader, - JulianPtrArray * outCalendars, - PRThread * thread, void* condVar) -{ - m_Reader = reader; - m_OutCalendars = outCalendars; - m_Thread = thread; - m_CallerData = condVar; - m_bParseStarted = FALSE; - m_bParseFinished = FALSE; -} - -//--------------------------------------------------------------------- - -nsCalUtility::MimeEncoding -nsCalStreamReader::stringToEncodingType(UnicodeString & propVal) -{ - if (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_s7bit) == 0) - { - return nsCalUtility::MimeEncoding_7bit; - } - else if (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sQUOTED_PRINTABLE) == 0) - { - return nsCalUtility::MimeEncoding_QuotedPrintable; - } - else if (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBase64) == 0) - { - return nsCalUtility::MimeEncoding_Base64; - } - else - return nsCalUtility::MimeEncoding_7bit; -} - -//--------------------------------------------------------------------- - -void nsCalStreamReader::ParseCalendars() -{ - nsCalStreamReader::ParseCalendars((ICalReader *) m_Reader, m_OutCalendars); -} - -//--------------------------------------------------------------------- - -void nsCalStreamReader::ParseCalendars(ICalReader * reader, - JulianPtrArray * outCalendars) -{ - if (outCalendars == 0) - return; - - JulianPtrArray * parameters = new JulianPtrArray(); - - // TODO: this needs to be changed to capireader later - PR_ASSERT(parameters != 0); - if (parameters != 0) - { - JLog * log = 0; - ErrorCode status = ZERO_ERROR; - UnicodeString strLine, propName, propVal; - nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit; - - nsCapiCallbackReader * cr = (nsCapiCallbackReader *) reader; - - while(TRUE) - { - cr->readFullLine(strLine, status); - ICalProperty::Trim(strLine); - -#if TESTING_ITIPRIG - if (FALSE) TRACE("\t--Parser: line (size = %d) = ---%s---\r\n", - strLine.size(), strLine.toCString("")); -#endif - if (FAILURE(status) && strLine.size() == 0) - { - //PR_Notify((PRMonitor *) cr->getMonitor()); - if (cr->isFinished()) - { - break; - } -#if TESTING_ITIPRIG - if (FALSE) TRACE("\t--jParser: yielding\r\n"); -#endif - PR_Sleep(PR_INTERVAL_NO_WAIT); - //break; - } - - ICalProperty::parsePropertyLine(strLine, propName, - propVal, parameters); - -#if TESTING_ITIPRIG - if (TRUE) TRACE("\t--Parser: propName = --%s--, propVal = --%s--,paramSize = %d\r\n", - propName.toCString(""), propVal.toCString(""), parameters->GetSize()); -#endif - if ((propName.compareIgnoreCase(nsCalKeyword::Instance()->ms_sBEGIN) == 0) && - (propVal.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVCALENDAR) == 0)) - { - // parse an NSCalendar, add it to outCalendars - NSCalendar * cal = new NSCalendar(log); - UnicodeString fileName; - cal->parse(reader, fileName, encoding); - outCalendars->Add(cal); - } - else if (propName.compareIgnoreCase( - nsCalKeyword::Instance()->ms_sCONTENT_TRANSFER_ENCODING) == 0) - { - ICalProperty::Trim(propVal); - encoding = stringToEncodingType(propVal); - cr->setEncoding(encoding); - } - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - - //PR_ExitMonitor((PRMonitor *)cr->getMonitor()); - } - - ICalProperty::deleteICalParameterVector(parameters); - parameters->RemoveAll(); - delete parameters; parameters = 0; - setParseFinished(); - } -} -//--------------------------------------------------------------------- - -void main_CalStreamReader(void* p) -{ - /* - * We've been started. We must wait until our parent thread - * signals to begin working... - */ - nsCalStreamReader * pStreamReader = (nsCalStreamReader *) p; - PRMonitor * pMon = (PRMonitor*)pStreamReader->getCallerData(); - PR_EnterMonitor(pMon); /* wait until the other thread releases this */ - PR_ExitMonitor(pMon); /* now that we've got it, let both threads run */ - - /* - * We only enter the Monitor when the parent has exited it. So, - * our parent thread has signaled us to begin the work at hand. - */ - pStreamReader->ParseCalendars(); - - /* - * The parent will try to re-enter the monitor when it is waiting for - * this thread to complete parsing the calendars. - */ - PR_EnterMonitor(pMon); - pStreamReader->setParseFinished(); - PR_Notify(pMon); - PR_ExitMonitor(pMon); - - /* - * We're done. - */ -#if 0 - PR_ProcessExit(0); -#endif -} - -//--------------------------------------------------------------------- - - - diff --git a/mozilla/calendar/modules/network/capi/src/nsCapiCST.cpp b/mozilla/calendar/modules/network/capi/src/nsCapiCST.cpp deleted file mode 100644 index 02be86d4fc4..00000000000 --- a/mozilla/calendar/modules/network/capi/src/nsCapiCST.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCapiCST.h" -#include "nsCapiCIID.h" -#include "nspr.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCCapiCSTCID, NS_CAPI_CST_CID); -static NS_DEFINE_IID(kICapiIID, NS_ICAPI_IID); - -#ifdef XP_PC - #define CAPI_LOCAL_NAME "capi.dll" -#else - #define CAPI_LOCAL_NAME "bogus.dll" -#endif - - -nsCapiCST :: nsCapiCST(nsISupports* outer) -{ - NS_INIT_REFCNT(); - mLibrary = nsnull; -} - -nsCapiCST :: ~nsCapiCST() -{ - if (nsnull != mLibrary) - PR_UnloadLibrary(mLibrary); -} - -nsresult nsCapiCST::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCCapiCSTCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) (nsCapiCST *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kICapiIID)) { - *aInstancePtr = (void*) (nsICapi *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (NS_NOINTERFACE); -} - -NS_IMPL_ADDREF(nsCapiCST) -NS_IMPL_RELEASE(nsCapiCST) - -nsresult nsCapiCST :: Init() -{ - mLibrary = PR_LoadLibrary(CAPI_LOCAL_NAME); - - mFunctions.capabilities = (Capabilities) PR_FindSymbol(mLibrary, "CAPI_Capabilities"); - mFunctions.delete_event = (DeleteEvent) PR_FindSymbol(mLibrary, "CAPI_DeleteEvent"); - mFunctions.destroy_handles = (DestroyHandles) PR_FindSymbol(mLibrary, "CAPI_DestroyHandles"); - mFunctions.destroy_streams = (DestroyStreams) PR_FindSymbol(mLibrary, "CAPI_DestroyStreams"); - mFunctions.fetch_events_by_alarm_range = (FetchEventsByAlarmRange) PR_FindSymbol(mLibrary, "CAPI_FetchEventsByAlarmRange"); - mFunctions.fetch_events_by_id = (FetchEventsByID) PR_FindSymbol(mLibrary, "CAPI_FetchEventsByID"); - mFunctions.fetch_events_by_range = (FetchEventsByRange) PR_FindSymbol(mLibrary, "CAPI_FetchEventsByRange"); - mFunctions.get_handle = (GetHandle) PR_FindSymbol(mLibrary, "CAPI_GetHandle"); - mFunctions.logoff = (Logoff) PR_FindSymbol(mLibrary, "CAPI_Logoff"); - mFunctions.logon = (Logon) PR_FindSymbol(mLibrary, "CAPI_Logon"); - mFunctions.set_stream_callbacks = (SetStreamCallbacks) PR_FindSymbol(mLibrary, "CAPI_SetStreamCallbacks"); - mFunctions.store_event = (StoreEvent) PR_FindSymbol(mLibrary, "CAPI_StoreEvent"); - - return NS_OK; -} - - -CAPIStatus nsCapiCST :: CAPI_Capabilities(const char** ppsVal, - const char* psHost, - long lFlags) -{ - return (mFunctions.capabilities(ppsVal, psHost, lFlags)); -} - -CAPIStatus nsCapiCST :: CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier) /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ -{ - return (mFunctions.delete_event(s,pH,iHandleCount,lFlags,psUID,dtRecurrenceID,iModifier)); -} - - -CAPIStatus nsCapiCST :: CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: pointer to a list of handles to destroy */ - int iHandleCount, /* i: number of valid handles in pHList */ - long lFlags) -{ - return (mFunctions.destroy_handles(s,pHList,iHandleCount,lFlags)); -} - - -CAPIStatus nsCapiCST :: CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - return (mFunctions.destroy_streams(s,pS,iHandleCount,lFlags)); -} - -CAPIStatus nsCapiCST :: CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream) /* i: stream to which solution set will be written */ -{ - return (mFunctions.fetch_events_by_alarm_range(s,pH,iHandleCount,lFlags,dStart,dEnd,ppsPropList,iPropCount,stream)); -} - -CAPIStatus nsCapiCST :: CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream) /* i: stream to which solution set will be written */ -{ - return (mFunctions.fetch_events_by_id(s,h,lFlags,psUID,dtRecurrenceID,iModifier,ppsPropList,iPropCount,stream)); -} - -CAPIStatus nsCapiCST :: CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream) /* i: stream to which solution set will be written */ -{ - return (mFunctions.fetch_events_by_range(s,pH,iHandleCount,lFlags,dStart,dEnd,ppsPropList,iPropCount,stream)); -} - -CAPIStatus nsCapiCST :: CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH) /* o: handle */ -{ - return (mFunctions.get_handle(s,u,lFlags,pH)); -} - -CAPIStatus nsCapiCST :: CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - return (mFunctions.logoff(s,lFlags)); -} - -CAPIStatus nsCapiCST :: CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession) /* o: the session */ -{ - return (mFunctions.logon(psUser,psPassword,psHost,lFlags,pSession)); -} - -CAPIStatus nsCapiCST :: CAPI_SetStreamCallbacks ( - CAPISession s, - CAPIStream* pStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback,/* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback,/* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ) /* i: bit flags (none at this time; set to 0) */ -{ - return (mFunctions.set_stream_callbacks(s,pStream,pfnSndCallback,userDataSnd,pfnRcvCallback,userDataRcv,lFlags)); -} - -CAPIStatus nsCapiCST :: CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream stream ) /* i: stream for reading data to store */ -{ - return (mFunctions.store_event(s,pH,iHandleCount,lFlags,stream)); -} - diff --git a/mozilla/calendar/modules/network/capi/src/nsCapiCallbackReader.cpp b/mozilla/calendar/modules/network/capi/src/nsCapiCallbackReader.cpp deleted file mode 100644 index c7133e1dfc8..00000000000 --- a/mozilla/calendar/modules/network/capi/src/nsCapiCallbackReader.cpp +++ /dev/null @@ -1,405 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#include "nsCapiCallbackReader.h" -#include "nspr.h" - -const t_int32 nsCapiCallbackReader::m_MAXBUFFERSIZE = 1024; -const t_int32 nsCapiCallbackReader::m_NOMORECHUNKS = 404; -//--------------------------------------------------------------------- -nsCapiCallbackReader::nsCapiCallbackReader() -{ - PR_ASSERT(FALSE); -} -//--------------------------------------------------------------------- - -void -nsCapiCallbackReader::AddBuffer(nsCapiBufferStruct * cBuf) -{ - if (m_Chunks == 0) - m_Chunks = new JulianPtrArray(); - PR_ASSERT(m_Chunks != 0); - if (m_Chunks != 0) - { - m_Chunks->Add(cBuf); - } -} - -//--------------------------------------------------------------------- - -nsCapiCallbackReader::nsCapiCallbackReader(PRMonitor * monitor, - nsCalUtility::MimeEncoding encoding) -{ - m_Monitor = monitor; - m_bFinished = FALSE; - - m_ChunkIndex = 0; - m_Chunks = 0; - m_Init = TRUE; - m_Pos = 0; - m_Mark = -1; - m_ChunkMark = -1; - m_Encoding = encoding; -} - -//--------------------------------------------------------------------- - -void nsCapiCallbackReader::deleteCapiBufferStructVector(JulianPtrArray * bufferVector) -{ - t_int32 i; - if (bufferVector != 0) - { - nsCapiBufferStruct * cbBuf; - for (i = bufferVector->GetSize() - 1; i >= 0; i--) - { - cbBuf = (nsCapiBufferStruct *) bufferVector->GetAt(i); - if (0 != cbBuf->m_pBuf) - { - delete [] (cbBuf->m_pBuf); - cbBuf->m_pBuf = 0; - } - delete cbBuf; cbBuf = 0; - } - } -} - -//--------------------------------------------------------------------- - -nsCapiCallbackReader::~nsCapiCallbackReader() -{ - if (m_Chunks != 0) - { - deleteCapiBufferStructVector(m_Chunks); - delete m_Chunks; m_Chunks = 0; - } -} - -//--------------------------------------------------------------------- - -t_int8 nsCapiCallbackReader::read(ErrorCode & status) -{ - t_int32 i = 0; - status = ZERO_ERROR; - - while (TRUE) - { - if (m_Chunks == 0 || m_Chunks->GetSize() == 0 || - m_ChunkIndex >= m_Chunks->GetSize()) - { - status = m_NOMORECHUNKS; // no more chunks, should block - return -1; - } - else - { - // read from linked list of UnicodeString's - // delete front string when finished reading from it - - nsCapiBufferStruct * cbBuf = (nsCapiBufferStruct *) m_Chunks->GetAt(m_ChunkIndex); - char * buf = cbBuf->m_pBuf; - char c; - if ((size_t) m_Pos < cbBuf->m_pBufSize) - { - if (nsCalUtility::MimeEncoding_QuotedPrintable == m_Encoding) - { - char * buf = cbBuf->m_pBuf; - c = buf[m_Pos]; - if ('=' == c) - { - if (cbBuf->m_pBufSize >= (size_t) (m_Pos + 3)) - { - if (ICalReader::isHex(buf[m_Pos + 1]) && ICalReader::isHex(buf[m_Pos + 2])) - { - c = ICalReader::convertHex(buf[m_Pos + 1], buf[m_Pos + 2]); - m_Pos += 3; - return c; - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - else - { - PRInt32 lenDiff = cbBuf->m_pBufSize - m_Pos; - char fToken, sToken; - PRBool bSetFToken = FALSE; - PRInt32 tempIndex = m_ChunkIndex; - UnicodeString token; - - while (TRUE) - { - // lenDiff = 1, 2 always - // the =XX spans different chunks - // if last chunk, return out of chunks status - if (tempIndex == m_Chunks->GetSize() - 1) - { - status = m_NOMORECHUNKS; - return -1; - } - else - { - nsCapiBufferStruct * cbNextBuf = (nsCapiBufferStruct *) m_Chunks->GetAt(tempIndex + 1); - char * nextBuf = cbNextBuf->m_pBuf; - tempIndex++; - if (cbNextBuf->m_pBufSize >= 2) - { - if (lenDiff == 2) - { - fToken = buf[cbBuf->m_pBufSize - 1]; - sToken = nextBuf[0]; - if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken)) - { - c = ICalReader::convertHex(fToken, sToken); - - m_Pos = 1; - m_ChunkIndex = tempIndex; - bSetFToken = FALSE; - return c; - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - else - { - // lenDiff = 1 - if (bSetFToken) - { - sToken = nextBuf[0]; - } - else - { - fToken = nextBuf[0]; - sToken = nextBuf[1]; - } - if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken)) - { - c = ICalReader::convertHex(fToken, sToken); - - m_Pos = 2; - m_ChunkIndex = tempIndex; - bSetFToken = FALSE; - return c; - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - } - else - { - if (cbNextBuf->m_pBufSize > 0) - { - if (!bSetFToken) - { - fToken = nextBuf[0]; - bSetFToken = TRUE; - } - else - { - sToken = nextBuf[0]; - if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken)) - { - c = ICalReader::convertHex(fToken, sToken); - - m_Pos = 1; - m_ChunkIndex = tempIndex; - bSetFToken = FALSE; - return c; - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - } - } - } - } - } - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - else - { - return (t_int8) buf[m_Pos++]; - } - } - else - { - m_ChunkIndex++; - m_Pos = 0; - } - } - } - status = 1; - return -1; -} - -//--------------------------------------------------------------------- - -UnicodeString & -nsCapiCallbackReader::createLine(t_int32 oldPos, t_int32 oldChunkIndex, - t_int32 newPos, t_int32 newChunkIndex, - UnicodeString & aLine) -{ - PR_ASSERT(oldChunkIndex <= newChunkIndex); - UnicodeString u; - if (oldChunkIndex == newChunkIndex) - { - u = *((UnicodeString *) m_Chunks->GetAt(oldChunkIndex)); - u.extractBetween(oldPos, newPos, aLine); - return aLine; - } - else { - //(oldChunkIndex < newChunkIndex) - - t_int32 i; - UnicodeString v, temp; - u = *((UnicodeString *) m_Chunks->GetAt(oldChunkIndex)); - u.extractBetween(oldPos, u.size(), aLine); - v = *((UnicodeString *) m_Chunks->GetAt(newChunkIndex)); - v.extractBetween(0, newPos, temp); - i = oldChunkIndex + 1; - while (i < newChunkIndex) - { - v = *((UnicodeString *) m_Chunks->GetAt(i)); - aLine += v; - i++; - } - aLine += temp; - return aLine; - } -} -//--------------------------------------------------------------------- -UnicodeString & -nsCapiCallbackReader::readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 iTemp) -{ - status = ZERO_ERROR; - t_int32 i; - - PR_EnterMonitor(m_Monitor); - - t_int32 oldpos = m_Pos; - t_int32 oldChunkIndex = m_ChunkIndex; - - readLine(aLine, status); - if (status == m_NOMORECHUNKS) - { - if (m_bFinished) - { - // do nothing. - } - else - { - PR_Wait(m_Monitor,PR_INTERVAL_NO_TIMEOUT); - } - } - - UnicodeString aSubLine; - while (TRUE) - { - mark(); - i = read(status); - if (status == m_NOMORECHUNKS) - { - if (m_bFinished) - { - // do nothing - break; - } - else - { - PR_Wait(m_Monitor,PR_INTERVAL_NO_TIMEOUT); - } - } - else if (i == ' ') - { - aLine += readLine(aSubLine, status); - } - else - { - reset(); - break; - } - } - - PR_ExitMonitor(m_Monitor); - - return aLine; -} -//--------------------------------------------------------------------- -UnicodeString & -nsCapiCallbackReader::readLine(UnicodeString & aLine, ErrorCode & status) -{ - aLine = ""; - - if (m_Chunks == 0 || m_Chunks->GetSize() == 0 || - m_ChunkIndex >= m_Chunks->GetSize()) - { - status = m_NOMORECHUNKS; // no more chunks, should block - return aLine; - } - else - { - nsCapiBufferStruct * cbBuf = - (nsCapiBufferStruct *) m_Chunks->GetAt(m_ChunkIndex); - char * currentBuf = cbBuf->m_pBuf; - char * line = 0; - PRInt32 i; - t_bool bFoundNewLine = FALSE; - for (i = m_Pos; 0 != currentBuf[i] && - ((size_t) i < cbBuf->m_pBufSize); i++) - { - if ('\n' == currentBuf[i]) - { - currentBuf[i] = 0; - bFoundNewLine = TRUE; - break; - } - } - if (!bFoundNewLine) - { - // todo: mark this chunk needs to be saved - if (m_ChunkIndex < m_Chunks->GetSize() - 1) - { - m_ChunkIndex++; - m_Pos = 0; - } - //else - //{ - // status = m_NOMORECHUNKS; - //} - return aLine; - } - line = currentBuf + m_Pos; - m_Pos = i + 1; - aLine = line; - return aLine; - } -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/network/capi/src/nsCapiLocal.cpp b/mozilla/calendar/modules/network/capi/src/nsCapiLocal.cpp deleted file mode 100644 index 4efc713d93b..00000000000 --- a/mozilla/calendar/modules/network/capi/src/nsCapiLocal.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - - -#include "nsISupports.h" -#include "nsCapiCIID.h" -#include "nsCapiLocal.h" -#include "nspr.h" - - -#ifdef XP_PC - #define CAPI_LOCAL_NAME "capilocal10.dll" -#elif XP_UNIX - #define CAPI_LOCAL_NAME "libcapilocal10.so" -#else - #error MAC not yet supported ... send email to eyork@netscape.com :-) -#endif - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCCapiLocalCID, NS_CAPI_LOCAL_CID); -static NS_DEFINE_IID(kICapiLocalIID, NS_ICAPI_LOCAL_IID); -static NS_DEFINE_IID(kICapiIID, NS_ICAPI_IID); - -nsCapiLocal :: nsCapiLocal(nsISupports* outer) -{ - NS_INIT_REFCNT(); - mLibrary = nsnull; -} - -nsCapiLocal :: ~nsCapiLocal() -{ - if (nsnull != mLibrary) - PR_UnloadLibrary(mLibrary); -} - -nsresult nsCapiLocal::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCCapiLocalCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) (nsCapiLocal *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kICapiLocalIID)) { - *aInstancePtr = (void*) (nsICapiLocal *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kICapiIID)) { - *aInstancePtr = (void*) (nsICapi *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this) ; - AddRef(); - return NS_OK; - } - return (NS_NOINTERFACE); -} - -NS_IMPL_ADDREF(nsCapiLocal) -NS_IMPL_RELEASE(nsCapiLocal) - -nsresult nsCapiLocal :: Init() -{ - mLibrary = PR_LoadLibrary(CAPI_LOCAL_NAME); - - mFunctions.capabilities = (Capabilities) PR_FindSymbol(mLibrary, "CAPI_Capabilities"); - mFunctions.delete_event = (DeleteEvent) PR_FindSymbol(mLibrary, "CAPI_DeleteEvent"); - mFunctions.destroy_handles = (DestroyHandles) PR_FindSymbol(mLibrary, "CAPI_DestroyHandles"); - mFunctions.destroy_streams = (DestroyStreams) PR_FindSymbol(mLibrary, "CAPI_DestroyStreams"); - mFunctions.fetch_events_by_alarm_range = (FetchEventsByAlarmRange) PR_FindSymbol(mLibrary, "CAPI_FetchEventsByAlarmRange"); - mFunctions.fetch_events_by_id = (FetchEventsByID) PR_FindSymbol(mLibrary, "CAPI_FetchEventsByID"); - mFunctions.fetch_events_by_range = (FetchEventsByRange) PR_FindSymbol(mLibrary, "CAPI_FetchEventsByRange"); - mFunctions.get_handle = (GetHandle) PR_FindSymbol(mLibrary, "CAPI_GetHandle"); - mFunctions.logoff = (Logoff) PR_FindSymbol(mLibrary, "CAPI_Logoff"); - mFunctions.logon = (Logon) PR_FindSymbol(mLibrary, "CAPI_Logon"); - mFunctions.set_stream_callbacks = (SetStreamCallbacks) PR_FindSymbol(mLibrary, "CAPI_SetStreamCallbacks"); - mFunctions.store_event = (StoreEvent) PR_FindSymbol(mLibrary, "CAPI_StoreEvent"); - mFunctions.logon_curl = (LogonCurl) PR_FindSymbol(mLibrary, "CAPI_LogonCurl"); - - return NS_OK; -} - - -CAPIStatus nsCapiLocal :: CAPI_Capabilities(const char** ppsVal, - const char* psHost, - long lFlags) -{ - return (mFunctions.capabilities(ppsVal, psHost, lFlags)); -} - -CAPIStatus nsCapiLocal :: CAPI_DeleteEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for delete */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to delete */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier) /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ -{ - return (mFunctions.delete_event(s,pH,iHandleCount,lFlags,psUID,dtRecurrenceID,iModifier)); -} - - -CAPIStatus nsCapiLocal :: CAPI_DestroyHandles( - CAPISession s, /* i: login session handle */ - CAPIHandle* pHList, /* i: pointer to a list of handles to destroy */ - int iHandleCount, /* i: number of valid handles in pHList */ - long lFlags) -{ - return (mFunctions.destroy_handles(s,pHList,iHandleCount,lFlags)); -} - - -CAPIStatus nsCapiLocal :: CAPI_DestroyStreams( - CAPISession s, /* i: login session handle */ - CAPIStream* pS, /* i: array of streams to destroy */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - return (mFunctions.destroy_streams(s,pS,iHandleCount,lFlags)); -} - -CAPIStatus nsCapiLocal :: CAPI_FetchEventsByAlarmRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time, ex: "19980704T080000Z" */ - char* dEnd, /* i: range end time, ex: "19980704T180000Z" */ - char** ppsPropList, /* i: list of properties to return in events */ - int iPropCount, /* i: number of properties in *ppsPropList */ - CAPIStream stream) /* i: stream to which solution set will be written */ -{ - return (mFunctions.fetch_events_by_alarm_range(s,pH,iHandleCount,lFlags,dStart,dEnd,ppsPropList,iPropCount,stream)); -} - -CAPIStatus nsCapiLocal :: CAPI_FetchEventsByID( - CAPISession s, /* i: login session handle */ - CAPIHandle h, /* i: calendar from which to fetch events */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* psUID, /* i: UID of the event to fetch */ - char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */ - int iModifier, /* i: one of CAPI_THISINSTANCE, */ - /* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */ - /* only valid if recurrence-id is non-NULL */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream) /* i: stream to which solution set will be written */ -{ - return (mFunctions.fetch_events_by_id(s,h,lFlags,psUID,dtRecurrenceID,iModifier,ppsPropList,iPropCount,stream)); -} - -CAPIStatus nsCapiLocal :: CAPI_FetchEventsByRange( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for fetch */ - int iHandleCount, /* i: number of valid handles in ppH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - char* dStart, /* i: range start time */ - char* dEnd, /* i: range end time */ - char** ppsPropList, /* i: list of properties returned in events */ - int iPropCount, /* i: number of properties in the list */ - CAPIStream stream) /* i: stream to which solution set will be written */ -{ - return (mFunctions.fetch_events_by_range(s,pH,iHandleCount,lFlags,dStart,dEnd,ppsPropList,iPropCount,stream)); -} - -CAPIStatus nsCapiLocal :: CAPI_GetHandle( - CAPISession s, /* i: login session handle */ - char* u, /* i: user as defined in Login */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIHandle* pH) /* o: handle */ -{ - return (mFunctions.get_handle(s,u,lFlags,pH)); -} - -CAPIStatus nsCapiLocal :: CAPI_Logoff( - CAPISession* s, /* io: session from login */ - long lFlags) /* i: bit flags (none at this time; set to 0) */ -{ - return (mFunctions.logoff(s,lFlags)); -} - -CAPIStatus nsCapiLocal :: CAPI_Logon( - const char* psUser, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - const char* psHost, /* i: calendar server host (and :port) */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession) /* o: the session */ -{ - return (mFunctions.logon(psUser,psPassword,psHost,lFlags,pSession)); -} - -CAPIStatus nsCapiLocal :: CAPI_SetStreamCallbacks ( - CAPISession s, - CAPIStream* pStream, /* io: The stream to modify */ - CAPICallback pfnSndCallback,/* i: Snd iCalendar data */ - void* userDataSnd, /* i: a user supplied value */ - CAPICallback pfnRcvCallback,/* i: Rcv iCalendar data */ - void* userDataRcv, /* i: a user supplied value */ - long lFlags ) /* i: bit flags (none at this time; set to 0) */ -{ - return (mFunctions.set_stream_callbacks(s,pStream,pfnSndCallback,userDataSnd,pfnRcvCallback,userDataRcv,lFlags)); -} - -CAPIStatus nsCapiLocal :: CAPI_StoreEvent( - CAPISession s, /* i: login session handle */ - CAPIHandle* pH, /* i: list of CAPIHandles for store */ - int iHandleCount, /* i: number of valid handles in pH */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPIStream stream ) /* i: stream for reading data to store */ -{ - return (mFunctions.store_event(s,pH,iHandleCount,lFlags,stream)); -} - -CAPIStatus nsCapiLocal :: CAPI_LogonCurl( - const char* psCurl, /* i: Calendar store (and ":extra" information ) */ - const char* psPassword, /* i: password for sUser */ - long lFlags, /* i: bit flags (none at this time; set to 0) */ - CAPISession* pSession) /* o: the session */ -{ - return (mFunctions.logon_curl(psCurl,psPassword,lFlags,pSession)); -} - diff --git a/mozilla/calendar/modules/network/config.mk b/mozilla/calendar/modules/network/config.mk deleted file mode 100644 index b360851a987..00000000000 --- a/mozilla/calendar/modules/network/config.mk +++ /dev/null @@ -1,30 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR - -LD_LIBS += \ - raptorbase \ - $(NATIVE_RAPTOR_WIDGET) \ - xpcom$(MOZ_BITS) \ - $(NATIVE_LIBNLS_LIBS) \ - util10 \ - $(XP_REG_LIB) - -AR_LIBS += \ - $(NULL) - -EXTRA_LIBS += $(NSPR_LIBS) - diff --git a/mozilla/calendar/modules/network/itip/Makefile b/mozilla/calendar/modules/network/itip/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/itip/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/itip/inc/Makefile b/mozilla/calendar/modules/network/itip/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/network/itip/inc/detxnobj.h b/mozilla/calendar/modules/network/itip/inc/detxnobj.h deleted file mode 100644 index 4df4eb9ac76..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/detxnobj.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * detxnobj.h - * John Sun - * 4/13/98 11:05:55 AM - */ -#ifndef __DELETETRANSACTIONOBJECT_H_ -#define __DELETETRANSACTIONOBJECT_H_ - -#include "jdefines.h" -#include "txnobj.h" - -class DeleteTransactionObject : public TransactionObject -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - DeleteTransactionObject(); -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - DeleteTransactionObject(NSCalendar & cal, JulianPtrArray & components, - User & user, JulianPtrArray & recipients, - UnicodeString & subject, JulianPtrArray & modifiers, - JulianForm * jf, MWContext * context, - UnicodeString & attendeeName); - - virtual ~DeleteTransactionObject() {} - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - virtual ETxnType GetType() const { return TransactionObject::ETxnType_DELETE; } - /*----------------------------- - ** UTILITIES - **---------------------------*/ -#if CAPI_READY - /* older CAPI, TODO: remove later */ - virtual CAPIStatus handleCAPI(CAPISession & pS, CAPIHandle * pH, - t_int32 iHandleCount, t_int32 lFlags, - JulianPtrArray * inComponents, NSCalendar * inCal, - JulianPtrArray * modifiers, - JulianPtrArray * outCalendars, TransactionObject::EFetchType & out); - /* - virtual CAPIStatus handleCAPI(CAPISession & pS, CAPIHandle * pH, - t_int32 iHandleCount, t_int32 lFlags, - JulianPtrArray * modifiers, JulianPtrArray * outCalendars, - TransactionObject::EFetchType & out); - */ - - /* TODO: more recent CAPI version */ - /*virtual CAPIStatus executeCAPI(CAPISession * s, CAPIHandle ** ppH, - t_int32 iHandleCount, long lFlags, JulianPtrArray * modifiers, - JulianPtrArray * propList, CAPIStream * stream);*/ - - -#endif /* #if CAPI_READY */ - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - /*----------------------------- - ** OVERLOADED OPERATORS - **---------------------------*/ -}; - -#endif /* __DELETETRANSACTIONOBJECT_H_ */ - diff --git a/mozilla/calendar/modules/network/itip/inc/getxnobj.h b/mozilla/calendar/modules/network/itip/inc/getxnobj.h deleted file mode 100644 index ca59c27b33b..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/getxnobj.h +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * getxnobj.h - * John Sun - * 4/1/98 5:10:26 PM - */ -#ifndef __GETTRANSACTIONOBJECT_H_ -#define __GETTRANSACTIONOBJECT_H_ - -#include "jdefines.h" -#include "txnobj.h" -#include "nspr.h" - -class GetTransactionObject: public TransactionObject -{ -#if CAPI_READY - /* for debugging only */ -public: - CAPI_CTX myCtx; -#endif - -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - GetTransactionObject(); - -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - GetTransactionObject(NSCalendar & cal, JulianPtrArray & components, - User & user, JulianPtrArray & recipients, - UnicodeString & subject, JulianPtrArray & modifiers, - JulianForm * jf, MWContext * context, - UnicodeString & attendeeName, EFetchType type); - - virtual ~GetTransactionObject() {}; - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - virtual ETxnType GetType() const { return TransactionObject::ETxnType_GET; } - - /*----------------------------- - ** UTILITIES - **---------------------------*/ -#if CAPI_READY - /* - int writeToCAPIReaderHelper(void * pData, char * pBuf, - int iSize, int * piTransferred); - */ - /* - int writeToCAPIReader(void * pData, char * pBuf, - int iSize, int * piTransferred); - */ - PRMonitor * m_Monitor; -#endif - /* virtual JulianPtrArray * executeCAPI(); */ -#if CAPI_READY - PRMonitor * getMonitor() { return m_Monitor; } - virtual CAPIStatus handleCAPI(CAPISession & pS, CAPIHandle * pH, - t_int32 iHandleCount, t_int32 lFlags, - JulianPtrArray * inComponents, NSCalendar * inCal, - JulianPtrArray * modifiers, - JulianPtrArray * outCalendars, TransactionObject::EFetchType & out); - - /* - virtual CAPIStatus handleCAPI(CAPISession & pS, CAPIHandle * pH, - JulianPtrArray * modifiers, char *** strings, char ** outevent, - t_int32 & numstrings, EFetchType & out); - */ - - /* TODO: more recent CAPI version*/ - /*virtual CAPIStatus executeCAPI(CAPISession * s, CAPIHandle ** ppH, - t_int32 iHandleCount, long lFlags, JulianPtrArray * modifiers, - JulianPtrArray * propList, CAPIStream * stream);*/ - -#endif /* #if CAPI_READY */ - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - /*----------------------------- - ** OVERLOADED OPERATORS - **---------------------------*/ -}; - -#ifdef XP_CPLUSPLUS -extern "C"{ -#endif - - int getransactionobj_writeToCAPIReader(void *, char *, size_t, size_t *); - -#ifdef XP_CPLUSPLUS -} -#endif - -#endif /* __GETTRANSACTIONNOBJECT_H_ */ - - - - diff --git a/mozilla/calendar/modules/network/itip/inc/manifest.mn b/mozilla/calendar/modules/network/itip/inc/manifest.mn deleted file mode 100644 index d0f60d56396..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/manifest.mn +++ /dev/null @@ -1,28 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - detxnobj.h \ - getxnobj.h \ - stdafx.h \ - sttxnobj.h \ - txnengn.h \ - txnobj.h \ - txnobjfy.h \ - user.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/network/itip/inc/stdafx.h b/mozilla/calendar/modules/network/itip/inc/stdafx.h deleted file mode 100644 index 802df4d700a..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/stdafx.h +++ /dev/null @@ -1,5 +0,0 @@ -/* This is a dummy file so that we can compile our windows -** projects with precompiled headers... -** -** It must be here, but you can just ignore it. -*/ diff --git a/mozilla/calendar/modules/network/itip/inc/sttxnobj.h b/mozilla/calendar/modules/network/itip/inc/sttxnobj.h deleted file mode 100644 index 4568c60b076..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/sttxnobj.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * sttxnobj.h - * John Sun - * 4/13/98 10:37:07 AM - */ -#ifndef __STORETRANSACTIONNOBJECT_H_ -#define __STORETRANSACTIONNOBJECT_H_ - -#include "jdefines.h" -#include "txnobj.h" - -class StoreTransactionObject : public TransactionObject -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ -#if CAPI_READY - CAPI_CTX m_Ctx; -#endif - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - StoreTransactionObject(); -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - StoreTransactionObject(NSCalendar & cal, JulianPtrArray & components, - User & user, JulianPtrArray & recipients, - UnicodeString & subject, JulianPtrArray & modifiers, - JulianForm * jf, MWContext * context, - UnicodeString & attendeeName); - - virtual ~StoreTransactionObject() {} - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - virtual ETxnType GetType() const { return TransactionObject::ETxnType_STORE; } - /*----------------------------- - ** UTILITIES - **---------------------------*/ -#if CAPI_READY - virtual CAPIStatus handleCAPI(CAPISession & pS, CAPIHandle * pH, - t_int32 iHandleCount, t_int32 lFlags, - JulianPtrArray * inComponents, NSCalendar * inCal, - JulianPtrArray * modifiers, - JulianPtrArray * outCalendars, TransactionObject::EFetchType & out); - /* - virtual CAPIStatus handleCAPI(CAPISession & pS, CAPIHandle * pH, - JulianPtrArray * modifiers, char *** strings, char ** outevent, - t_int32 & numstrings, TransactionObject::EFetchType & out); - */ - /* TODO: more recent CAPI version*/ - /*virtual CAPIStatus executeCAPI(CAPISession * s, CAPIHandle ** ppH, - t_int32 iHandleCount, long lFlags, JulianPtrArray * modifiers, - JulianPtrArray * propList, CAPIStream * stream);*/ - - -#endif /* #if CAPI_READY */ - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - /*----------------------------- - ** OVERLOADED OPERATORS - **---------------------------*/ -}; - -#endif /* __STORETRANSACTIONNOBJECT_H_ */ - diff --git a/mozilla/calendar/modules/network/itip/inc/txnengn.h b/mozilla/calendar/modules/network/itip/inc/txnengn.h deleted file mode 100644 index cd9c6dfc9c5..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/txnengn.h +++ /dev/null @@ -1,25 +0,0 @@ -// txnengn.h -// John Sun -// 4:24 PM March 9, 1998 - -#ifndef __TRANSACTIONENGINE_H_ -#define __TRANSCATIONENGINE_H_ - -#include "txnobj.h" - -class TransactionEngine -{ -private: - CommunicationObject * m_CommObj; - -public: - TransactionEngine(); - - TransactionEngine(CommunicationObject * initCommObj); - - ~TransactionEngine(); - - XPPtrArray * execute(); - -}; -#endif \ No newline at end of file diff --git a/mozilla/calendar/modules/network/itip/inc/txnobj.h b/mozilla/calendar/modules/network/itip/inc/txnobj.h deleted file mode 100644 index 2c2e4e85930..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/txnobj.h +++ /dev/null @@ -1,334 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * txnobj.h - * John Sun - * 3/10/98 11:35:47 AM - */ - -#ifndef __TRANSOBJ_H_ -#define __TRANSOBJ_H_ - -#include "nscal.h" -#include "user.h" -#include "form.h" -/*#include "xp.h" -#include "form.h"*/ - -/*#ifdef XP_WIN -#ifndef CAPI_READY -#define CAPI_READY 1 -#endif -#endif*/ - -#if CAPI_READY -#include -#endif /* #if CAPI_READY */ - -#if CAPI_READY -typedef struct -{ - char * p; - int iSize; -} CAPI_CTX; -#endif - -class TransactionObject -{ -public: - enum EFetchType - { - EFetchType_UID = 0, - EFetchType_DateRange = 1, - EFetchType_AlarmRange = 2 - ,EFetchType_NONE = 3 - }; - - /** - * The allowable transport types. - * CAPI, IRIP, IMIP, and FCAPI (local file CAPI). - */ - enum ETransportType - { - ETransportType_CAPI = 0, - ETransportType_IRIP = 1, - ETransportType_IMIP = 2, - ETransportType_FCAPI = 3 - }; - -/* - enum ETXN_TYPE - { - TR_TYPE_CANCEL = 0, - TR_TYPE_COUNTER = 1, - TR_TYPE_DECLINECOUNTER = 2, - TR_TYPE_DELEGATE = 3, - TR_TYPE_FORWARD = 4, - TR_TYPE_GET = 5, - TR_TYPE_REFRESH = 6, - TR_TYPE_REPLY = 7, - TR_TYPE_REQUEST = 8, - TR_TYPE_PUBLISH = 9, - TR_TYPE_INVALID = -1 - }; -*/ - enum ETxnErrorCode - { - TR_OK = 0, - TR_CAPI_LOGIN_FAILED = 100, - TR_CAPI_HANDLE_CAPI_FAILED = 101, - TR_CAPI_LOGOFF_FAILED = 102, - TR_CAPI_FETCH_BAD_ARGS = 103, - TR_IRIP_FAILED = 200, - TR_IMIP_FAILED = 300 - }; - - enum ETxnType - { - ETxnType_STORE = 0, - ETxnType_DELETE = 1, - ETxnType_GET = 2 - }; - -protected: - - /* calendar containing METHOD, other header info */ - NSCalendar * m_Calendar; - - /* vector of components in transaction */ - JulianPtrArray * m_ICalComponentVctr; - - /* capi arguments - (i.e. UIDs, date range values */ - JulianPtrArray * m_Modifiers; - - /* FROM: User - usually the logged in User */ - User * m_User; - - /* TO: Recipients */ - JulianPtrArray * m_Recipients; - - /* Attendee to filter on a reply */ - UnicodeString m_AttendeeName; - - /* subject of mail message */ - UnicodeString m_Subject; - - /* context windows to send to */ - MWContext * m_Context; - - /* julain form which contains function ptrs */ - JulianForm * m_JulianForm; - - /* TODO: move the CAPI stuff somewhere*/ - /* char * m_userxstring; - char * m_password; - char * m_hostname; - char * m_node; - char * m_recipientxstring;*/ - - /* Fetch Type */ - EFetchType m_FetchType; - - /** - * Prints each ICalComponent in the components vector in iCal - * format. The output string will depend on the method name, - * the name of the attendee to filter on, the delegate to - * filter on, and whether to print as recurring or not. - * - * @param components vector of ICalComponent's to print - * @param method ITIP method name of message - * @param name attendee to filter on - * @param isRecurring TRUE = no recid, FALSE = print recid - * @param out output string - * - * @return output string (out) - */ - static UnicodeString & printComponents(JulianPtrArray * components, - UnicodeString & method, UnicodeString & name, - t_bool isRecurring, UnicodeString & out); - - /** hide from clients */ - TransactionObject(); - - UnicodeString & MakeITIPMessage(UnicodeString & out); - -private: - /** - * Run the executeCAPI, executeIMIP, executeIRIP, executeFCAPI - * depending on order of transports. - */ - ETxnErrorCode executeHelper(ETransportType * transports, - t_int32 transportsSize, JulianPtrArray * out); - - - /** - * For each recipient, if status[i] is TRUE, then remove - * recipient[i] from recipients vector. Assumes that - * recipients has same size as statusSize. - * @param JulianPtrArray * recipients - * @param t_bool * status - * @param t_int32 statusSize - * - * @return static void - */ - static void removeSuccessfulUsers(JulianPtrArray * recipients, - t_bool * status, - t_int32 statusSize); - - - /** - * For each boolean in status, set status[i] to FALSE. - */ - static void setStatusToFalse(t_bool * status, t_int32 statusSize); - - - /** - * Creates the content type header for the IMIP message in the form - * Content-Type: text/calendar method=PUBLISH; charset=UTF-8; component=VEVENT - * @param UnicodeString & sMethod - * @param UnicodeString & sCharset - * @param UnicodeString & sComponentType - * @param UnicodeString & sContentTypeHeader - * - * @return static UnicodeString - */ - static UnicodeString & createContentTypeHeader(UnicodeString & sMethod, - UnicodeString & sCharset, UnicodeString & sComponentType, - UnicodeString & sContentTypeHeader); - - -public: - - /* used for debugging only : TODO: remove later*/ - UnicodeString m_DebugITIPMessage; - - /** - * Clients should not delete cal, components, user, recipients, jf, context - * I assume components are processed and ready to go (i.e. DTStamp already set). - * the cal arg should have the calendar that contains calendar information for the - * components. This includes the METHOD, PRODID, and VERSION. - * The components contains the ICalComponents that should be sent. - * The user is the name of the user who sends the transaction. For CAPI, this - * would be who logs in. For IMIP, this would be the FROM: person. - * The recipients vector contains the User object to store the components to. - * For CAPI, this would be the handles to get. For IMIP, this would be the TO: persons. - * The subject contains the subject on an IMIP message. - * The modifiers should contain various information depending on the CAPI call. - * For a DELETE the modifiers should be in the following order - * UID, [Recurrence-ID], [("THISANDPRIOR" or "THISANDFUTURE")] - * For a FETCH by UID, the modifiers should be in the following order - * UID, [Recurrence-ID], [("THISANDPRIOR", or "THISANDFUTURE")] - * For a FETCH by DateRange and a FETCH by AlarmRange, the modifiers should be - * DTSTART, DTEND - * @param NSCalendar & cal - * @param JulianPtrArray & components - * @param User & user - * @param JulianPtrArray & recipients - * @param UnicodeString & subject - * @param JulianPtrArray & modifiers - * @param UnicodeString & attendeeName - */ - TransactionObject(NSCalendar & cal, JulianPtrArray & components, - User & user, JulianPtrArray & recipients, UnicodeString & subject, - JulianPtrArray & modifiers, - JulianForm * jf, MWContext * context, - UnicodeString & attendeeName, EFetchType fetchType = EFetchType_NONE); - - virtual ~TransactionObject(); - - /* execute the transaction. calls the - * executeCAPI, executeIRIP, executeIMIP */ - void execute(JulianPtrArray * out, ETxnErrorCode & status); - - ETxnErrorCode executeIRIP(JulianPtrArray * out, t_bool * outStatus, - t_int32 outStatusSize); - ETxnErrorCode executeIMIP(JulianPtrArray * out, t_bool * outStatus, - t_int32 outStatusSize); - ETxnErrorCode executeFCAPI(JulianPtrArray * out, t_bool * outStatus, - t_int32 outStatusSize); - - virtual ETxnType GetType() const - { - /* Should always assert out, pure virtual method. */ - PR_ASSERT(FALSE); return ETxnType_STORE; - } -#if CAPI_READY - - - static ETxnErrorCode FetchEventsByRange( - User * loggedInUser, /* i: logged in user (use this session) */ - JulianPtrArray * usersToFetchOn, /* i: users to fetch on (use these handles) */ - DateTime dtStart, /* i: start of fetch range */ - DateTime dtEnd, /* i: end of fetch range */ - JulianPtrArray * eventsToFillIn); /* o: fill in vector with events to fetch */ - - ETxnErrorCode executeCAPI(JulianPtrArray * outCalendars, t_bool * outStatus, - t_int32 outStatusSize); - - /* TODO: pure virtual handleCAPI interface needs to be changed to reflect newest CAPI spec */ - virtual CAPIStatus handleCAPI( - CAPISession & pS, - CAPIHandle * pH, - t_int32 iHandleCount, - t_int32 lFlags, - JulianPtrArray * inComponents, - NSCalendar * inCal, - JulianPtrArray * modifiers, - JulianPtrArray * outCalendars, - TransactionObject::EFetchType & out) - { - PR_ASSERT(FALSE); - CAPIStatus foo; - return foo; - } - - /* s = CAPISession - ppH = list of CAPIHandles - iHandleCount = number of valid handles in ppH. - lFlags = bit flags - modifiers should hold following: - for StoreEvent: nothing - for FetchByID: uid, recurrence-ID, range modifier (THISANDPRIOR,THISANDFUTURE,NONE) - for FetchByRange: start, end - for DeleteEvent: uid, recurrence-ID - for FetchByAlarmRange: start,end - -------------------------------- - propList is list of properties to return in events - stream is CAPIStream to read/write data*/ - - /*TODO: newer CAPI interface*/ - /* - virtual CAPIStatus handleCAPI(CAPISession * s, CAPIHandle ** ppH, - t_int32 iHandleCount, long lFlags, JulianPtrArray * modifiers, - JulianPtrArray * propList, CAPIStream * stream); - */ -#if 0 - void setCAPIInfo(char * userxstring, char * password, - char * hostname, char * node, char * recipientxstring); -#endif -#endif /* #if CAPI_READY */ - -}; - -#endif /* __TRANSOBJ_H_ */ - diff --git a/mozilla/calendar/modules/network/itip/inc/txnobjfy.h b/mozilla/calendar/modules/network/itip/inc/txnobjfy.h deleted file mode 100644 index 2e3ec0b6958..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/txnobjfy.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * txnobjfy.h - * John Sun - * 4/13/98 10:34:44 AM - */ -#ifndef __TRANSACTIONOBJECTFACTORY_H_ -#define __TRANSACTIONOBJECTFACTORY_H_ - -#include "jdefines.h" -#include "txnobj.h" - -class TransactionObjectFactory -{ -private: - /*----------------------------- - ** MEMBERS - **---------------------------*/ - /*----------------------------- - ** PRIVATE METHODS - **---------------------------*/ - TransactionObjectFactory(); -public: - /*----------------------------- - ** CONSTRUCTORS and DESTRUCTORS - **---------------------------*/ - static TransactionObject * Make(NSCalendar & cal, - JulianPtrArray & components, User & user, JulianPtrArray & recipients, - UnicodeString & subject, JulianPtrArray & modifiers, - JulianForm * jf, MWContext * context, - UnicodeString & attendeeName, - TransactionObject::EFetchType fetchType = TransactionObject::EFetchType_NONE); - /*----------------------------- - ** ACCESSORS (GET AND SET) - **---------------------------*/ - /*----------------------------- - ** UTILITIES - **---------------------------*/ - /*----------------------------- - ** STATIC METHODS - **---------------------------*/ - /*----------------------------- - ** OVERLOADED OPERATORS - **---------------------------*/ -}; - -#endif /*__TRANSACTIONOBJECTFACTORY_H_ */ - diff --git a/mozilla/calendar/modules/network/itip/inc/user.h b/mozilla/calendar/modules/network/itip/inc/user.h deleted file mode 100644 index bc27b872e79..00000000000 --- a/mozilla/calendar/modules/network/itip/inc/user.h +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * user.h - * John Sun - * 3/10/98 2:28:01 PM - */ - -#include -#include "ptrarray.h" -#if CAPI_READY -#include -#endif - -#ifndef __USER_H_ -#define __USER_H_ - -class User -{ -private: - /* For now store CAPI, IMIP, IRIP addresses as char **/ - UnicodeString m_CAPIAddress; - t_int32 m_XItemID; - - UnicodeString m_IMIPAddress; /* usually e-mail address*/ - UnicodeString m_IRIPAddress; - - UnicodeString m_RealName; - - /* temporary holding CS&T info, remove when CAP is ready */ - UnicodeString m_LoginName; /* this maybe unrelated to m_RealName */ - UnicodeString m_Password; - UnicodeString m_Hostname; - UnicodeString m_Node; -#if CAPI_READY - CAPISession * m_Session; -#endif - -public: - User(); - User(User & that); - User(UnicodeString realName, UnicodeString imip); - User(UnicodeString realName, UnicodeString imip, - UnicodeString capi, UnicodeString irip, - t_int32 xItemID = -1); - - virtual ~User(); - - User * clone(); - - t_bool IsValidCAPI() const { return (m_CAPIAddress.size() > 0) && (m_XItemID != -1); } - t_bool IsValidIRIP() const { return (m_IRIPAddress.size() > 0); } - t_bool IsValidIMIP() const { return (m_IMIPAddress.size() > 0); } - - UnicodeString getIMIPAddress() const { return m_IMIPAddress; } - UnicodeString getIRIPAddress() const { return m_IRIPAddress; } - UnicodeString getCAPIAddress() const { return m_CAPIAddress; } - t_int32 getXItemID() const { return m_XItemID; } - -#if CAPI_READY - void setCAPISession(CAPISession * s) { m_Session = s; } - CAPISession * getCAPISession() const { return m_Session; } -#endif - - void setRealName(UnicodeString realName) - { - m_RealName = realName; - } - - - /* TODO: temporarily hold CS&T info, remove when CAP is ready */ - void setCAPIInfo(UnicodeString loginName, UnicodeString password, - UnicodeString hostname, UnicodeString node) - { - m_LoginName = loginName; - m_Password = password; - m_Hostname = hostname; - m_Node = node; - } - - UnicodeString getPassword() const { return m_Password; } - UnicodeString getHostname() const { return m_Hostname; } - UnicodeString getNode() const { return m_Node; } - - /* end CS&T info */ - - UnicodeString getRealName() const { return m_RealName; } - - /** - * Prints summary of this User's private data info. - * - * @return UnicodeString - */ - UnicodeString toString(); - - - /** - * Return the CAPI x-string of this User. Uses the MakeXString method. - * - * @return UnicodeString - */ - UnicodeString getXString(); - - UnicodeString getLogonString(); - /** - * Creates the CAPI X-string from the real-name argument in - * the form "S=lastName*'/G=firstName*". The lastName is the defined - * to be all words after the first space. - * Thus if given the name John Van Der Wal, John would be the first - * name and Van Der Wal would be the last name. The generated - * x-string would be "S=Van Der Wal/G=John". It is recommended that - * realname argument not have more than two words in a name. - * An empty real name string returns "S=*'/G=*". - * @param out generated x-string output - * - * @return generated x-string output (out) - */ - static UnicodeString & MakeXString(UnicodeString & realName, UnicodeString & out); - - - /** - * Creates the CAPI logon string from the real-name and node argument into the - * form "S=lastname/G=firstname/ND=node/" - * @param UnicodeString & realName - * @param UnicodeString & node - * @param UnicodeString & out - * - * @return static UnicodeString - */ - static UnicodeString & MakeCAPILogonString(UnicodeString & realName, UnicodeString & node, - UnicodeString & out); - - /* static methods */ - - /** - * Cleanup method. Delete each User element in the vector users. - * @param users vector of users to delete from - */ - static void deleteUserVector(JulianPtrArray * users); - - static void cloneUserVector(JulianPtrArray * toClone, JulianPtrArray * out); -}; -#endif /* __USER_H_ */ - - - diff --git a/mozilla/calendar/modules/network/itip/manifest.mn b/mozilla/calendar/modules/network/itip/manifest.mn deleted file mode 100644 index 364aaa1bd7f..00000000000 --- a/mozilla/calendar/modules/network/itip/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/network/itip/src/Makefile b/mozilla/calendar/modules/network/itip/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/network/itip/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/network/itip/src/config.mk b/mozilla/calendar/modules/network/itip/src/config.mk deleted file mode 100644 index a9188a77866..00000000000 --- a/mozilla/calendar/modules/network/itip/src/config.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include -I$(GDEPTH)/htmlparser/src - -LIBRARY_NAME = cal_network_itip -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) diff --git a/mozilla/calendar/modules/network/itip/src/detxnobj.cpp b/mozilla/calendar/modules/network/itip/src/detxnobj.cpp deleted file mode 100644 index 9146188932e..00000000000 --- a/mozilla/calendar/modules/network/itip/src/detxnobj.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * detxnobj.cpp - * John Sun - * 4/13/98 11:07:45 AM - */ -#include "jdefines.h" -#include "julnstr.h" -#include "detxnobj.h" -#include "txnobj.h" - -#if CAPI_READY -#include -#endif /* CAPI_READY */ - -//--------------------------------------------------------------------- - -DeleteTransactionObject::DeleteTransactionObject() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -DeleteTransactionObject::DeleteTransactionObject(NSCalendar & cal, - JulianPtrArray & components, - User & user, - JulianPtrArray & recipients, - UnicodeString & subject, - JulianPtrArray & modifiers, - JulianForm * jf, - MWContext * context, - UnicodeString & attendeeName) -: TransactionObject(cal, components, user, recipients, subject, - modifiers, - jf, context, - attendeeName) -{ -} - -//--------------------------------------------------------------------- -#if CAPI_READY - -CAPIStatus -DeleteTransactionObject::handleCAPI(CAPISession & pS, CAPIHandle * pH, - t_int32 iHandleCount, t_int32 lFlags, - JulianPtrArray * inComponents, NSCalendar * inCal, - JulianPtrArray * modifiers, - JulianPtrArray * outCalendars, TransactionObject::EFetchType & out) -{ - CAPIStatus status; - t_int32 modifierSize; - - // TODO: finish, don't use for now - //PR_ASSERT(FALSE); - - // - PR_ASSERT(modifiers != 0 && modifiers->GetSize() > 0 && - modifiers->GetSize() <= 3); - PR_ASSERT(iHandleCount >= 1); - if (modifiers != 0 && modifiers->GetSize() > 0 && - modifiers->GetSize() <= 3 && iHandleCount >= 1) - { - char * modifier = 0; - char * uid = 0; - char * rid = 0; - t_int8 modifierInt = CAPI_THISINSTANCE; - modifierSize = modifiers->GetSize(); - // Get the args (uid, rid, rangeModifier) - - uid = ((UnicodeString *) modifiers->GetAt(0))->toCString(""); - PR_ASSERT(uid != 0); - if (modifierSize > 1) - { - rid = ((UnicodeString *) modifiers->GetAt(1))->toCString(""); - PR_ASSERT(rid != 0); - if (modifierSize > 2) - { - modifier = ((UnicodeString *) modifiers->GetAt(2))->toCString(""); - PR_ASSERT(modifier != 0); - if (strcmp(modifier, "THISANDPRIOR") == 0) - modifierInt = CAPI_THISANDPRIOR; - else if (strcmp(modifier, "THISANDFUTURE") == 0) - modifierInt = CAPI_THISANDFUTURE; - else - modifierInt = CAPI_THISINSTANCE; - } - } - status = CAPI_DeleteEvent(pS, pH, iHandleCount, 0, uid, rid, modifierInt); - if (modifier != 0) - { - delete [] modifier; modifier = 0; - } - if (rid != 0) - { - delete [] rid; rid = 0; - } - if (uid != 0) - { - delete [] uid; uid = 0; - } - } - // - return status; -} - -//--------------------------------------------------------------------- - -#endif /* #if CAPI_READY */ diff --git a/mozilla/calendar/modules/network/itip/src/getxnobj.cpp b/mozilla/calendar/modules/network/itip/src/getxnobj.cpp deleted file mode 100644 index f1d5249aab8..00000000000 --- a/mozilla/calendar/modules/network/itip/src/getxnobj.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * getxnobj.cpp - * John Sun - * 4/1/98 5:16:29 PM - */ - -#include "jdefines.h" -#include "julnstr.h" -#include "getxnobj.h" -#include "nspr.h" - -#if CAPI_READY -#include -#include "jparser.h" -#include "icalsrdr.h" -#include "nscal.h" -#include "capiredr.h" -//#define TEST_STRINGREADER_PARSE 1 -#endif /* #if CAPI_READY */ - -//PRMonitor * GetTransactionObject::m_Monitor = 0; -//--------------------------------------------------------------------- - -GetTransactionObject::GetTransactionObject() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -GetTransactionObject::GetTransactionObject(NSCalendar & cal, - JulianPtrArray & components, - User & user, - JulianPtrArray & recipients, - UnicodeString & subject, - JulianPtrArray & modifiers, - JulianForm * jf, - MWContext * context, - UnicodeString & attendeeName, - EFetchType type) -: TransactionObject(cal, components, user, recipients, subject, - modifiers, - jf, context, - attendeeName, type) -{ -#if CAPI_READY - m_Monitor = 0; -#endif -} - -//--------------------------------------------------------------------- -#if CAPI_READY - -/* -int writeToCAPIReader(void * pData, char * pBuf, - int iSize, int * piTransferred) -{ - int i; - for(i = 0; i < iSize; i++) - { - // TODO: put each char into new char * in capireader - //putc( *(pBuf++), (void *) pData); - } - *piTransferred = i; - - return CAPI_CALLBACK_CONTINUE; -} -*/ - -//--------------------------------------------------------------------- - -int writeToBufferDebug(void * pData, char * pBuf, - int iSize, int * piTransferred) -{ - CAPI_CTX * pCtx = (CAPI_CTX*)pData; - *piTransferred = (pCtx->iSize > iSize) ? iSize: pCtx->iSize; - memcpy(pCtx->p, pBuf, *piTransferred); - pCtx->iSize -= *piTransferred; - pCtx->p += *piTransferred; - return pCtx->iSize > 0 ? 0 : -1; -} - -//--------------------------------------------------------------------- - -int getransactionobj_writeToCAPIReader(void * pData, char * pBuf, size_t iSize, size_t * piTransferred) -{ - //PR_EnterMonitor(GetTransactionObject::getMonitor()); -#if TESTING_ITIPRIG - TRACE("\t\t--writeToCAPIReader: entered method (transferring %d chars) \r\n", iSize); -#endif - //ICalCAPIReader * pReader = (ICalCAPIReader *) pData; - JulianParser * pJP = (JulianParser *) pData; - ICalCAPIReader * pReader = pJP->getReader(); - //PR_EnterMonitor((PRMonitor *)(pReader->getMonitor())); - if (!pJP->isParseStarted()) - { - PRThread * pThread = pJP->getThread(); - -#if TESTING_ITIPRIG - TRACE("\t\t--writeToCAPIReader: starting parseThread\r\n"); -#endif - pJP->setParseStarted(); - PR_Start(pThread, jparser_ParseCalendarsZero, pJP, NULL); - //PR_Start(parseThread, jparser_ParseCalendars, (void *) (capiReader), (void *) (outCalendars)); - } - - // enter monitor - PR_EnterMonitor((PRMonitor *)pReader->getMonitor()); -#if TESTING_ITIPRIG - TRACE("\t\t--writeToCAPIReader: in monitor\r\n"); -#endif - - *piTransferred = iSize; - // todo: this assumes pBuf is null-terminated - pReader->AddChunk(new UnicodeString(pBuf)); - if (iSize < 500) - { -#if TESTING_ITIPRIG - TRACE("\t\t--writeToCAPIReader: added chunk -%s- \r\n", pBuf); -#endif - - } - else - { -#if TESTING_ITIPRIG - TRACE("\t\t--writeToCAPIReader: added chunk bigger that 500 chars\r\n"); -#endif - } - //PR_Wait((PRMonitor *)(pReader->getMonitor()), LL_MAXINT); - - //if finished, set it to TRUE - if (iSize <= 0) - { - pReader->setFinished(); -#if TESTING_ITIPRIG - TRACE("\t\t--writeToCAPIReader: has no more chunks to add.\r\n"); -#endif - } - - //PR_ExitMonitor((PRMonitor *)(pReader->getMonitor())); - - // notify??? -#if TESTING_ITIPRIG - TRACE("\t\t--writeToCAPIReader: notifying parseThread that more chunks added\r\n"); -#endif - PR_Notify((PRMonitor *)pReader->getMonitor()); - -#if TESTING_ITIPRIG - TRACE("\t\t--writeToCAPIReader: leaving monitor\r\n"); -#endif - PR_ExitMonitor((PRMonitor *)pReader->getMonitor()); -#if TESTING_ITIPRIG - TRACE("\t\t--writeToCAPIReader: yielding\r\n"); -#endif - PR_Yield(); - // exit monitor - return iSize > 0 ? 0 : -1; -} - -//--------------------------------------------------------------------- -/* -int GetTransactionObject::writeToCAPIReader(void * pData, char * pBuf, - int iSize, int * piTransferred) -{ - int retVal; - retVal = writeToCAPIReaderHelper(pData, pBuf, iSize, piTransferred); - /* - PR_ASSERT(m_CAPIReader != 0); - if (m_CAPIReader != 0) - { - m_CAPIReader->addNewChunk(pData, *piTransferred); - } - - return retVal; -} -*/ -//--------------------------------------------------------------------- - -CAPIStatus -GetTransactionObject::handleCAPI(CAPISession & pS, CAPIHandle * pH, - t_int32 iHandleCount, t_int32 lFlags, - JulianPtrArray * inComponents, NSCalendar * inCal, - JulianPtrArray * modifiers, - JulianPtrArray * outCalendars, TransactionObject::EFetchType & out) -{ - CAPIStatus capiStatus; - CAPIStream outStream = NULL; - void * writeData = 0; - -#if TEST_STRINGREADER_PARSE - char debugBuf[20000]; - myCtx.p = debugBuf; - myCtx.iSize = sizeof(debugBuf); - - capiStatus = CAPI_SetStreamCallbacks(&outStream, NULL, NULL, writeToBufferDebug, &myCtx, 0); -#else - PRThread * parseThread; - - PR_ASSERT(outCalendars != 0); - // - - PRThread * mainThread = PR_CurrentThread(); - -#if TESTING_ITIPRIG - TRACE("--main thread running\n"); -#endif - - m_Monitor = PR_NewMonitor(); - PR_ASSERT(m_Monitor != 0); - ICalCAPIReader * capiReader = new ICalCAPIReader(m_Monitor); - PR_ASSERT(capiReader != 0); - // - t_int32 STACK_SIZE = 4096; - t_int32 threadPriority = 5; - t_int32 stackSize = 0; - parseThread = PR_CreateThread("parseThread", threadPriority, stackSize); - JulianParser * jp = new JulianParser(capiReader, outCalendars, parseThread); - - //PR_Start(parseThread, jparser_ParseCalendars, (void *) (capiReader), (void *) (outCalendars)); - - //JulianParser::ParseCalendars(capiReader, outCalendars); - - //capiStatus = CAPI_SetStreamCallbacks(&outStream, NULL, NULL, getransactionobj_writeToCAPIReader, capiReader, 0); - capiStatus = CAPI_SetStreamCallbacks(pS, &outStream, NULL, NULL, getransactionobj_writeToCAPIReader, jp, 0); - - -#endif - - if (capiStatus == CAPI_ERR_OK) - { - t_int32 modifierSize; - switch (m_FetchType) - { - case EFetchType_UID: - PR_ASSERT(modifiers != 0 && modifiers->GetSize() > 0 && - modifiers->GetSize() <= 3); - PR_ASSERT(iHandleCount == 1); - - if (modifiers != 0 && modifiers->GetSize() > 0 && - modifiers->GetSize() <= 3 && iHandleCount == 1) - { - - char * modifier = 0; - char * uid = 0; - char * rid = 0; - t_int8 modifierInt = CAPI_THISINSTANCE; - modifierSize = modifiers->GetSize(); - - // Get the args (uid, rid, rangeModifier) - uid = ((UnicodeString *) modifiers->GetAt(0))->toCString(""); - PR_ASSERT(uid != 0); - if (modifierSize > 1) - { - rid = ((UnicodeString *) modifiers->GetAt(1))->toCString(""); - PR_ASSERT(rid != 0); - if (modifierSize > 2) - { - modifier = ((UnicodeString *) modifiers->GetAt(2))->toCString(""); - PR_ASSERT(modifier != 0); - if (strcmp(modifier, "THISANDPRIOR") == 0) - modifierInt = CAPI_THISANDPRIOR; - else if (strcmp(modifier, "THISANDFUTURE") == 0) - modifierInt = CAPI_THISANDFUTURE; - else - modifierInt = CAPI_THISINSTANCE; - } - } - - // TODO: set the property list to NULL for now, pass in -#ifdef TESTING_ITIPRIG - TRACE("--main thread: fetching by UID:, %s, RID %s, MODIFIER %d\r\n", uid, rid, modifierInt); -#endif -#if 0 - capiStatus = CAPI_FetchEventsByID(pS, *pH, 0, uid, rid, modifierInt, - NULL, 0, outStream); -#endif - if (modifier != 0) - { - delete [] modifier; modifier = 0; - } - if (rid != 0) - { - delete [] rid; rid = 0; - } - if (uid != 0) - { - delete [] uid; uid = 0; - } - } - break; - case EFetchType_DateRange: - PR_ASSERT(modifiers != 0 && modifiers->GetSize() == 2); - PR_ASSERT(iHandleCount >= 1); - if (modifiers != 0 && modifiers->GetSize() == 2 && - iHandleCount >= 1) - { - char * start = 0; - char * end = 0; - start = ((UnicodeString *) modifiers->GetAt(0))->toCString(""); - end = ((UnicodeString *) modifiers->GetAt(1))->toCString(""); - PR_ASSERT(start != 0 && end != 0); - // TODO: set the property list to NULL for now, pass in later -#ifdef TESTING_ITIPRIG - TRACE("--main thread: fetching by DateRange:, START %s, END %s\r\n", start, end); -#endif - capiStatus = CAPI_FetchEventsByRange(pS, &pH[0], iHandleCount, 0, - start, end, NULL, 0, outStream); - if (start != 0) - { - delete [] start; start = 0; - } - if (end != 0) - { - delete [] end; end = 0; - } - } - break; - case EFetchType_AlarmRange: - PR_ASSERT(modifiers != 0 && modifiers->GetSize() == 2); - PR_ASSERT(iHandleCount >= 1); - if (modifiers != 0 && modifiers->GetSize() == 2 && - iHandleCount >= 1) - { - char * start = 0; - char * end = 0; - PR_ASSERT(start != 0 && end != 0); - start = ((UnicodeString *) modifiers->GetAt(0))->toCString(""); - end = ((UnicodeString *) modifiers->GetAt(1))->toCString(""); - - - // TODO: set the property list to NULL for now, pass in later -#ifdef TESTING_ITIPRIG - TRACE("--main thread: fetching by AlarmRange:, START %s, END %s\r\n", start, end); -#endif - capiStatus = CAPI_FetchEventsByAlarmRange(pS, &pH[0], iHandleCount, 0, - start, end, NULL, 0, outStream); - if (start != 0) - { - delete [] start; start = 0; - } - if (end != 0) - { - delete [] end; end = 0; - } - } - break; - } - out = m_FetchType; - } - - //---- - char * c = myCtx.p; - -#if TEST_STRINGREADER_PARSE - ICalReader * ir = (ICalReader *) new ICalStringReader(debugBuf); - if (ir != 0) - { - JulianParser::ParseCalendars(ir, outCalendars); - delete ir; ir = 0; - } -#endif // TEST_STRINGREADER_PARSE - - return capiStatus; - -} - -#endif /* #if CAPI_READY */ diff --git a/mozilla/calendar/modules/network/itip/src/manifest.mn b/mozilla/calendar/modules/network/itip/src/manifest.mn deleted file mode 100644 index 958be9359b9..00000000000 --- a/mozilla/calendar/modules/network/itip/src/manifest.mn +++ /dev/null @@ -1,31 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - detxnobj.cpp \ - getxnobj.cpp \ - sttxnobj.cpp \ - txnengn.cpp \ - txnobj.cpp \ - txnobjfy.cpp \ - user.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls netlib shell xpfc - diff --git a/mozilla/calendar/modules/network/itip/src/sttxnobj.cpp b/mozilla/calendar/modules/network/itip/src/sttxnobj.cpp deleted file mode 100644 index 9bfc29e2b6e..00000000000 --- a/mozilla/calendar/modules/network/itip/src/sttxnobj.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * sttxnobj.cpp - * John Sun - * 4/13/98 10:38:50 AM - */ - -#include "jdefines.h" -#include "julnstr.h" -#include "sttxnobj.h" -#include "txnobj.h" -#if CAPI_READY -#include -#endif /* CAPI_READY */ - -//--------------------------------------------------------------------- - -StoreTransactionObject::StoreTransactionObject() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -StoreTransactionObject::StoreTransactionObject(NSCalendar & cal, - JulianPtrArray & components, - User & user, - JulianPtrArray & recipients, - UnicodeString & subject, - JulianPtrArray & modifiers, - JulianForm * jf, - MWContext * context, - UnicodeString & attendeeName) -: TransactionObject(cal, components, user, recipients, subject, - modifiers, - jf, context, - attendeeName) -{ -} - -//--------------------------------------------------------------------- -#if CAPI_READY - -int stringRead(void * pData, char * pBuf, size_t iSize, size_t* piTransferred) -{ - CAPI_CTX* pCtx = (CAPI_CTX*)pData; - *piTransferred = (pCtx->iSize > iSize) ? iSize : pCtx->iSize; - memcpy(pBuf,pCtx->p,*piTransferred); - pCtx->iSize -= *piTransferred; - pCtx->p += *piTransferred; - return pCtx->iSize > 0 ? 0 : -1; -} - -//--------------------------------------------------------------------- - -CAPIStatus -StoreTransactionObject::handleCAPI(CAPISession & pS, CAPIHandle * pH, - t_int32 iHandleCount, t_int32 lFlags, - JulianPtrArray * inComponents, NSCalendar * inCal, - JulianPtrArray * modifiers, - JulianPtrArray * outCalendars, TransactionObject::EFetchType & out) -{ - CAPIStatus status; - CAPIStream outStream = NULL; - char ** uids = NULL; - long outSize; - t_int32 i; - char * pBuf = 0; - - PR_ASSERT(inComponents != 0 && inCal != 0); - -#if 0 - - // For now - // first make the MIME-message - //char pBuf[3000]; - - // works - //strcpy(pBuf, "Mime-Version: 1.0\nContent-Type:text/calendar; method=PUBLISH; charset=US-ASCII\nContent-Transfer-Encoding: 7bit\n\nBEGIN:VCALENDAR\r\nMETHOD:PUBLISH\r\nPRODID:-//ACME/DesktopCalendar//EN\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nORGANIZER:mailto:a@example.com\r\nDTSTART:19980508T200000Z\r\nDTEND:19980508T210000Z\r\nDTSTAMP:19970611T190000Z\r\nSUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES\r\nUID:atestUID19970505T112233Z-303434@jsun.netscape.com\r\nCOMMENT:A comment with no params\r\nEND:VEVENT\r\nEND:VCALENDAR\n"); - - // doesn't work - //strcpy(pBuf, "Mime-Version: 1.0\nContent-Type:text/calendar; method=PUBLISH; charset=US-ASCII\nContent-Transfer-Encoding: 7bit\n\nBEGIN:VCALENDAR\r\nMETHOD:PUBLISH\r\nPRODID:-//ACME/DesktopCalendar//EN\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nORGANIZER:mailto:a@example.com\r\nDTSTART:19980508T200000Z\r\nDTEND:19980508T210000Z\r\nDTSTAMP:19980611T190000Z\r\nATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=FALSE;EXPECT=FYI;CUTYPE=INDIVIDUAL:MAILTO\r\n :a@acme.com\r\nATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=FALSE;EXPECT=FYI;CUTYPE=INDIVIDUAL:MAILTO\r\n :hello\r\nCLASS:PUBLIC\r\nCOMMENT:A comment with no params\r\nCOMMENT;LANGUAGE=us_en:comment with language only\r\nCOMMENT;VALUE=BINARY:a comment with a bad param\r\nDESCRIPTION:A VEvent with a DTStart having a TZID of America-New_York\r\nDURATION:P0Y0M0DT0H0M0S\r\nRELATED-TO:relatedto1@jdoe.com\r\nRELATED-TO:relatedto2@jdoe.com\r\nREQUEST-STATUS:2.02;Success, invalid property ignored.. ATTENDEE\r\nSEQUENCE:0\r\nSUMMARY:A VEvent with TZID DTStart\r\nUID:001jsun@netscape.com\r\nURL:http://www.ur12.com\r\nEND:VEVENT\r\nEND:VCALENDAR\n"); - - // works - //strcpy(pBuf, "Mime-Version: 1.0\nContent-Type:text/calendar; method=PUBLISH; charset=US-ASCII\nContent-Transfer-Encoding: 7bit\n\nBEGIN:VCALENDAR\r\nMETHOD:PUBLISH\r\nPRODID:-//ACME/DesktopCalendar//EN\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nATTENDEE:mailto:jsun@netscape.com\r\nORGANIZER:mailto:a@example.com\r\nDTSTART:19980508T200000Z\r\nDTEND:19980508T210000Z\r\nDTSTAMP:19980611T190000Z\r\nSUMMARY:A VEvent with TZID DTStart\r\nUID:001jsun@netscape.com\r\nCLASS:PUBLIC\r\nCOMMENT:A comment with no params\r\nSEQUENCE:0\r\nURL:http://www.ur12.com\r\nEND:VEVENT\r\nEND:VCALENDAR\n"); - - // works - //UnicodeString u = "Mime-Version: 1.0\nContent-Type:text/calendar; method=PUBLISH; charset=US-ASCII\nContent-Transfer-Encoding: 7bit\n\nBEGIN:VCALENDAR\r\nMETHOD:PUBLISH\r\nPRODID:-//ACME/DesktopCalendar//EN\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nATTENDEE:mailto:jsun@netscape.com\r\nORGANIZER:mailto:a@example.com\r\nDTSTART:19980508T200000Z\r\nDTEND:19980508T210000Z\r\nDTSTAMP:19980611T190000Z\r\nSUMMARY:A VEvent with TZID DTStart\r\nUID:001jsun@netscape.com\r\nCLASS:PUBLIC\r\nCOMMENT:A comment with no params\r\nSEQUENCE:0\r\nURL:http://www.ur12.com\r\nEND:VEVENT\r\nEND:VCALENDAR\n"; - - UnicodeString u = "Mime-Version: 1.0\nContent-Type:text/calendar; method=PUBLISH; charset=US-ASCII\nContent-Transfer-Encoding: 7bit\n\nBEGIN:VCALENDAR\r\nMETHOD:PUBLISH\r\nPRODID:-//ACME/DesktopCalendar//EN\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nORGANIZER:MAILTO:organizer\r\nCLASS:PRIVATE\r\nCOMMENT:A VEvent\r\nDESCRIPTION:A VEvent with a DTStart having a TZID of America-New_York\r\nDURATION:P0Y0M0DT0H22M33S\r\nDTSTART:19980508T210000Z\r\nDTEND:19980508T212233Z\r\nDTSTAMP:19980303T200000Z\r\nLOCATION:A location\r\nSEQUENCE:0\r\nSUMMARY:A VEvent\r\nUID:002jsun@netscape.com\r\nEND:VEVENT\r\nEND:VCALENDAR\n"; - pBuf = u.toCString(""); - TRACE("u = %s", pBuf); -#else - UnicodeString method, version; - method = "PUBLISH"; - version = "2.0"; - if (inCal != 0) - { - method = NSCalendar::methodToString(inCal->getMethod(), method); - if (inCal->getVersion().size() > 0) - version = inCal->getVersion(); - } - - UnicodeString u2 = "Mime-Version: 1.0\nContent-Type:text/calendar; method="; - u2 += method; - u2 += "; charset=US-ASCII\nContent-Transfer-Encoding: 7bit\n\n"; - u2 += "BEGIN:VCALENDAR\r\nMETHOD:"; - u2 += method; - u2 += "\r\n"; - u2 += "VERSION:"; - u2 += version; - u2 += "\r\n"; - u2 += "PRODID:-//ACME/DesktopCalendar//EN\r\n"; - - // TODO: NOTE: doens't seem to handle DTSTART;TZID=A:19971122T112233 - PR_ASSERT(inComponents != 0); - if (inComponents != 0) - { - for (i = 0; i < inComponents->GetSize(); i++) - { - ICalComponent * ic = (ICalComponent *) inComponents->GetAt(i); - u2 += ic->toICALString(); - } - } - - u2 += "END:VCALENDAR\n"; - pBuf = u2.toCString(""); - //if (FALSE) TRACE("u2 = %s", pBuf); -#endif - - m_Ctx.p = pBuf; - m_Ctx.iSize = strlen(pBuf); - - status = CAPI_SetStreamCallbacks(pS, &outStream, stringRead, &m_Ctx, NULL, NULL, 0); - - // TODO: if server is down, this may take forever!!! - status = CAPI_StoreEvent(pS, pH, iHandleCount, 0, outStream); -#ifdef TESTING_ITIPRIG - if (TRUE) TRACE("CAPI_StoreEvent:%lx\r\n", status); -#endif - //TODO: the store event now has a CS&T UID. What to do with it? - status = CAPI_GetLastStoredUIDs(pS, &uids, &outSize, 0); -#ifdef TESTING_ITIPRIG - if (TRUE) TRACE("Saved %d UIDs.\r\n", outSize); - for (i = 0; i < outSize; i++) - { - if (TRUE) TRACE("%s\r\n", *(uids + i)); - } -#endif - - if (pBuf != 0) - { - delete [] pBuf; pBuf = 0; - } - return status; -} - -//--------------------------------------------------------------------- - -#endif /* #if CAPI_READY */ diff --git a/mozilla/calendar/modules/network/itip/src/txnengn.cpp b/mozilla/calendar/modules/network/itip/src/txnengn.cpp deleted file mode 100644 index 6876bf6cc8b..00000000000 --- a/mozilla/calendar/modules/network/itip/src/txnengn.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// txnengn.cpp -// John Sun -// 5:11 PM March 9, 1998 - -#include "txnengn.h" - -#include "stdafx.h" - - diff --git a/mozilla/calendar/modules/network/itip/src/txnobj.cpp b/mozilla/calendar/modules/network/itip/src/txnobj.cpp deleted file mode 100644 index 2370e03575c..00000000000 --- a/mozilla/calendar/modules/network/itip/src/txnobj.cpp +++ /dev/null @@ -1,688 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// txnobj.cpp -// John Sun -// 11:36 AM March 10, 1998 - -#include "jdefines.h" -#include "julnstr.h" -#include "txnobj.h" -#include "datetime.h" - -#if CAPI_READY -#include -#endif /* #if CAPI_READY */ - -#include "vevent.h" -#include "jlog.h" -#include "icalsrdr.h" -#include "keyword.h" - -//--------------------------------------------------------------------- - -TransactionObject::TransactionObject() -: m_Calendar(0), m_ICalComponentVctr(0), m_Modifiers(0), m_Recipients(0) -{ -} - -//--------------------------------------------------------------------- - -TransactionObject::TransactionObject(NSCalendar & cal, - JulianPtrArray & components, - User & user, - JulianPtrArray & recipients, - UnicodeString & subject, - JulianPtrArray & modifiers, - /*JulianForm * jf, MWContext * context, */ - UnicodeString & attendeeName, - EFetchType fetchType) -: m_Modifiers(0), m_Recipients(0) -{ - m_Calendar = &cal; - - // assumption is that components are processed. - m_ICalComponentVctr = &components; - m_User = &user; - m_Recipients = &recipients; - m_Subject = subject; - - m_Modifiers = &modifiers; - - m_AttendeeName = attendeeName; - m_FetchType = fetchType; - - // for sending IMIP messages - /* - m_JulianForm = jf; - m_Context = context; - */ -} -//--------------------------------------------------------------------- -TransactionObject::~TransactionObject() -{ - -} -//--------------------------------------------------------------------- - -TransactionObject::ETxnErrorCode -TransactionObject::executeHelper(ETransportType * transports, - t_int32 transportsSize, - JulianPtrArray * out) -{ - t_int32 i = 0; - t_bool * status = 0; - t_int32 statusSize = 0; - PR_ASSERT(transports != 0); - if (transports == 0) - { - - return TR_OK; - } - //PR_ASSERT(m_Recipients != 0 && m_Recipients->GetSize() > 0); - if (m_Recipients == 0 || m_Recipients->GetSize() == 0) - { - // TODO: return the correct error - return TR_OK; - } - // clone recipients - // - JulianPtrArray * tempRecipients = 0; - tempRecipients = new JulianPtrArray(); - if (tempRecipients == 0) - { - // TODO: return the correct error - return TR_OK; - } - User::cloneUserVector(m_Recipients, tempRecipients); - for (i = 0; i < transportsSize; i++) - { - statusSize = tempRecipients->GetSize(); - status = new t_bool[statusSize]; - setStatusToFalse(status, statusSize); - if (status != 0) - { - switch (transports[i]) - { - case ETransportType_CAPI: -#if CAPI_READY - executeCAPI(out, status, statusSize); -#else - executeFCAPI(out, status, statusSize); -#endif - break; - case ETransportType_IRIP: - executeIRIP(out, status, statusSize); - break; - case ETransportType_IMIP: - executeIMIP(out, status, statusSize); - break; - case ETransportType_FCAPI: - executeFCAPI(out, status, statusSize); - break; - } - removeSuccessfulUsers(tempRecipients, status, statusSize); - delete [] status; status = 0; - } - else - { - // TODO: return an error - return TR_IMIP_FAILED; - } - } - - User::deleteUserVector(tempRecipients); - delete tempRecipients; tempRecipients = 0; - return TR_OK; -} -//--------------------------------------------------------------------- - -void -TransactionObject::execute(JulianPtrArray * out, - ETxnErrorCode & status) -{ -#if 0 - PR_ASSERT(m_User != 0 && m_Recipients != 0); - outStatus = TR_OK; - - t_int32 size = 0; - - if (m_Recipients != 0) - { - size = m_Recipients->GetSize(); - } - t_bool * recipientStatus = new t_bool[size]; - -#if CAPI_READY - executeCAPI(out, ouStatus); -#endif - executeIMIP(out, ouStatus); - delete [] recipientStatus; recipientStatus = 0; - -#else /* #if 0 */ - - ETxnErrorCode outStatus = TR_OK; - ETransportType * transports = 0; - t_int32 transportSize = 0; - PR_ASSERT(m_User != 0 && m_Recipients != 0); - -#if CAPI_READY - transportSize = 3; -#else - transportSize = 1; -#endif /* #if CAPI_READY */ - - transports = new ETransportType[transportSize]; - if (transports != 0) - { -#if CAPI_READY - // for now make the order of precedence capi, irip, imip - transports[0] = ETransportType_CAPI; - transports[1] = ETransportType_IRIP; - transports[2] = ETransportType_IMIP; -#else - transports[0] = ETransportType_IMIP; -#endif /* #if CAPI_READY */ - status = executeHelper(transports, transportSize, out); - delete [] transports; transports = 0; - } -#endif /* #if 0 #else */ -} - -//--------------------------------------------------------------------- - -void -TransactionObject::removeSuccessfulUsers(JulianPtrArray * recipients, - t_bool * status, - t_int32 statusSize) -{ - t_int32 i; - User * aUser = 0; - if (recipients == 0) - return; - PR_ASSERT(statusSize == recipients->GetSize()); - for (i = statusSize - 1; i >= 0; i--) - { - if (status[i]) - { - aUser = (User *) recipients->GetAt(i); - delete aUser; - recipients->RemoveAt(i); - } - } -} -//--------------------------------------------------------------------- -void -TransactionObject::setStatusToFalse(t_bool * status, - t_int32 statusSize) -{ - t_int32 i; - for (i = 0; i < statusSize; i++) - status[i] = FALSE; -} -//--------------------------------------------------------------------- -UnicodeString & -TransactionObject::createContentTypeHeader(UnicodeString & sMethod, - UnicodeString & sCharset, - UnicodeString & sComponentType, - UnicodeString & sContentTypeHeader) -{ - sContentTypeHeader = "Content-Type: text/calendar; method="; - sContentTypeHeader += sMethod; - sContentTypeHeader += "; charset="; - sContentTypeHeader += sCharset; - sContentTypeHeader += "; component="; - sContentTypeHeader += sComponentType; - - return sContentTypeHeader; -} - -//--------------------------------------------------------------------- - - -TransactionObject::ETxnErrorCode -TransactionObject::executeIRIP(JulianPtrArray * out, - t_bool * outStatus, - t_int32 outStatusSize) - -{ - //PR_ASSERT(FALSE); - ETxnErrorCode status; - // NOTE: remove later to avoid compiler warnings - if (out != 0 && outStatus != 0); - /* NOT YET DEFINED */ - return status; -} - -//--------------------------------------------------------------------- - -TransactionObject::ETxnErrorCode -TransactionObject::executeFCAPI(JulianPtrArray * out, - t_bool * outStatus, - t_int32 outStatusSize) -{ - //PR_ASSERT(FALSE); - ETxnErrorCode status; - // NOTE: remove later to avoid compiler warnings - if (out != 0 && outStatus != 0); - /* NOT YET DEFINED */ - return status; -} - -//--------------------------------------------------------------------- - -TransactionObject::ETxnErrorCode -TransactionObject::executeIMIP(JulianPtrArray * out, - t_bool * outStatus, - t_int32 outStatusSize) -{ - ETxnErrorCode status = TR_OK; - UnicodeString itipMessage; - UnicodeString sContentTypeHeader; - // prints FROM: User and TO: users - UnicodeString sCharSet = "UTF-8"; - UnicodeString sMethod; - UnicodeString sComponentType; - - t_int32 i; - //User * u; - PR_ASSERT(m_User != 0 && m_Recipients != 0); - if (m_User == 0 || m_Recipients == 0) - { - return TR_IMIP_FAILED; - } - - // Create the body of the message - itipMessage = MakeITIPMessage(itipMessage); - - // Create the content header - PR_ASSERT(m_Calendar != 0); - if (m_Calendar != 0) - { - sMethod = NSCalendar::methodToString(m_Calendar->getMethod(), sMethod); - } - PR_ASSERT(m_ICalComponentVctr != 0 && m_ICalComponentVctr->GetSize() > 0); - if (m_ICalComponentVctr != 0 && m_ICalComponentVctr->GetSize() > 0) - { - // Use first component in m_ICalComponentVctr to get type - sComponentType = - ICalComponent::componentToString(((ICalComponent *)m_ICalComponentVctr->GetAt(0))->GetType()); - } - createContentTypeHeader(sMethod, sCharSet, sComponentType, sContentTypeHeader); - - // Use preference "calendar.imip.add_content_disp" to decide whether to add - // "Content-Disposition: ... " - // Default doesn't write it. - XP_Bool do_add_content_disp = FALSE; - - if ((m_JulianForm) && (m_JulianForm->getCallbacks()) && (m_JulianForm->getCallbacks()->BoolPref)) - (*m_JulianForm->getCallbacks()->BoolPref)("calendar.imip.add_content_disp", &do_add_content_disp); - - if (do_add_content_disp) - { - if (((ICalComponent *)m_ICalComponentVctr->GetAt(0))->GetType() == ICalComponent::ICAL_COMPONENT_VEVENT) - { - sContentTypeHeader += "\r\nContent-Dispostion: inline; filename=\"event.ics\""; - } - else if (((ICalComponent *)m_ICalComponentVctr->GetAt(0))->GetType() == ICalComponent::ICAL_COMPONENT_VFREEBUSY) - { - sContentTypeHeader += "\r\nContent-Dispostion: inline; filename=\"freebusy.ifb\""; - } - } - -//#ifdef DEBUG_ITIP - m_DebugITIPMessage = itipMessage; -//#endif /* DEBUG_ITIP */ - - // TODO: send it via mail API here - if (/*m_JulianForm != 0 && m_Context != 0 &&*/ m_Recipients != 0) - { - int iOut; - User * userTo; - UnicodeString uTo; - UnicodeString u; - char * to = 0; - char * from = m_User->getIMIPAddress().toCString(""); - char * subject = m_Subject.toCString(""); - char * body = itipMessage.toCString(""); - char * otherheaders = sContentTypeHeader.toCString(""); - PR_ASSERT(from != 0 && subject != 0 && body != 0 && otherheaders != 0); - - // append the recipients IMIP address to the to string. - // also, if the imip address is null (in this case empty string) - // set outStatus[i] to FALSE. - for (i = 0; i < m_Recipients->GetSize(); i++) - { - userTo = (User *) m_Recipients->GetAt(i); - - if (userTo->getIMIPAddress().size() > 0) - { - outStatus[i] = TRUE; - uTo += userTo->getIMIPAddress(); - if (i < m_Recipients->GetSize() - 1) - uTo += ","; - } - else - outStatus[i] = FALSE; - - } - if (uTo.size() > 0) - to = uTo.toCString(""); - if (to != 0) - { - /* - if (m_JulianForm->getCallbacks()->SendMessageUnattended) - iOut = (*m_JulianForm->getCallbacks()->SendMessageUnattended)(m_Context, to, subject, otherheaders, body); - else - iOut = 0; - */ - delete [] to; - } - if (from != 0) - { - delete [] from; from = 0; - } - if (subject != 0) - { - delete [] subject; subject = 0; - } - if (body != 0) - { - delete [] body; body = 0; - } - if (otherheaders != 0) - { - delete [] otherheaders; otherheaders = 0; - } - - } - return status; -} - -//--------------------------------------------------------------------- - -UnicodeString & -TransactionObject::MakeITIPMessage(UnicodeString & out) -{ - // first print header, then print components - UnicodeString s, sName, sMethod; - t_bool isRecurring = FALSE; - - PR_ASSERT(m_Calendar != 0); - if (m_Calendar != 0) - { - out = "BEGIN:VCALENDAR\r\n"; - out += m_Calendar->createCalendarHeader(s); - sMethod = NSCalendar::methodToString(m_Calendar->getMethod(), sMethod); - - sName = m_AttendeeName; - - out += printComponents(m_ICalComponentVctr, sMethod, - sName, isRecurring, s); - out += "END:VCALENDAR\r\n"; - } - return out; -} -//--------------------------------------------------------------------- - -UnicodeString & -TransactionObject::printComponents(JulianPtrArray * components, - UnicodeString & sMethod, - UnicodeString & sName, - t_bool isRecurring, - UnicodeString & out) -{ - out = ""; - PR_ASSERT(components != 0 && components->GetSize() > 0); - if (components != 0 && components->GetSize() > 0) - { - t_int32 i; - ICalComponent * ic; - DateTime dtStamp; - - for (i = 0; i < components->GetSize(); i++) - { - ic = (ICalComponent *) components->GetAt(i); - out += ic->toICALString(sMethod, sName, isRecurring); - } - } - return out; -} - -//--------------------------------------------------------------------- -#if CAPI_READY -//--------------------------------------------------------------------- -TransactionObject::ETxnErrorCode -TransactionObject::FetchEventsByRange(User * loggedInUser, - JulianPtrArray * usersToFetchOn, - DateTime dtStart, - DateTime dtEnd, - JulianPtrArray * eventsToFillIn) -{ - TransactionObject::ETxnErrorCode status = TR_OK; - if (loggedInUser == 0 || usersToFetchOn == 0) - return TR_CAPI_FETCH_BAD_ARGS; - if (!dtStart.isValid() || !dtEnd.isValid() || dtEnd.beforeDateTime(dtStart)) - return TR_CAPI_FETCH_BAD_ARGS; - if (eventsToFillIn == 0) - return TR_CAPI_FETCH_BAD_ARGS; - - if (loggedInUser->getCAPISession() == 0) - return TR_CAPI_FETCH_BAD_ARGS; - - return status; -} - -//--------------------------------------------------------------------- - -#if 0 -void -TransactionObject::setCAPIInfo(char * userxstring, - char * password, - char * hostname, - char * node, - char * recipientxstring) -{ - m_userxstring = userxstring; - m_password = password; - m_hostname = hostname; - m_node = node; - m_recipientxstring = recipientxstring; -} -#endif -//--------------------------------------------------------------------- - -//void -//TransactionObject::executeCAPI(JulianPtrArray * outCalendars, -// ETxnErrorCode & status) -TransactionObject::ETxnErrorCode -TransactionObject::executeCAPI(JulianPtrArray * outCalendars, - t_bool * outStatus, t_int32 outStatusSize) -{ - CAPISession pS = NULL; - CAPIHandle pH; - char ** strings; - char * eventFetchedByUID; - t_int32 numstrings; - t_int32 i; - - ETxnErrorCode status = TR_OK; - - // Do the following: - // If GetType() is a store or a delete, always try to add m_User to handles. - // Try logging in with m_User information - - // Don't need recipients. - if (m_User != 0) - //if (m_User != 0 && m_Recipients != 0 && m_Recipients->GetSize() > 0) - { - - User * aUser; - char * xstring = 0; - // Execute specific CAPI call (fetch, store, delete) - EFetchType outType; - char sDebugOut[100]; - t_int32 handleCount = 0; - t_int32 recipientCount = 0; - t_int32 extraUserHandle = 0; - CAPIStatus cStat = CAPI_ERR_OK; - - - // On a store or delete set handleCount to 1 (always try to use m_User) - if (GetType() == ETxnType_STORE || - GetType() == ETxnType_DELETE) - { - handleCount = 1; - extraUserHandle = 1; - } - - // If recipients, add size of recipients to handleCount - if (m_Recipients != 0) - { - handleCount += m_Recipients->GetSize(); - recipientCount = m_Recipients->GetSize(); - } - - //PR_ASSERT(outCalendars != 0); - - // TODO: horrible hack, restricting number of handles to 20 - CAPIHandle handles[20]; // wish I could do handles[handleCount] - if (handleCount > 20) - handleCount = 20; - - for (i = 0; i < handleCount; i++) - { - handles[i] = 0; - } - - // Capabilities - //if (FALSE) TRACE("CAPICapabilities:%s\r\n", CAPI_Capabilities((long) 0)); - //sprintf(sDebugOut, "CAPICapabilities:%s\r\n", CAPI_Capabilities((long) 0)); - - // Logon - - // TODO: eventually use the CAPAddress - //char * userxstring = m_User->getXString().toCString(""); - char * userlogonstring = m_User->getLogonString().toCString(""); - char * password = m_User->getPassword().toCString(""); - char * hostname = m_User->getHostname().toCString(""); - char * node = m_User->getNode().toCString(""); - PR_ASSERT(userlogonstring != 0 && password != 0 && hostname != 0 && node != 0); - -#ifdef TESTING_ITIPRIG - if (TRUE) TRACE("logon user: %s,\r\n password: %s,\r\n hostname: %s,\r\n node: %s,\r\n", - userlogonstring, password, hostname, node); -#endif - - cStat = CAPI_Logon(userlogonstring, password, hostname, 0, &pS); - //PR_ASSERT(FALSE); - - //if (FALSE) TRACE("CAPI_Logon:%lx\r\n", foo); - //sprintf(sDebugOut, "CAPI_Logon:%lx\r\n", foo); - - if (cStat != CAPI_ERR_OK && cStat != CAPI_ERR_EXPIRED) - { - status = TR_CAPI_LOGIN_FAILED; - } - else - { - - // On Store or Delete, Handle 0 will always be current user. - // Get Handle for each recipient and user, first m_User in handle[0] - - if (GetType() == ETxnType_STORE || - GetType() == ETxnType_DELETE) - { - xstring = m_User->getXString().toCString(""); - PR_ASSERT(xstring != 0); - CAPI_GetHandle(pS, xstring, 0, &handles[0]); - delete [] xstring; xstring = 0; - } - - if (m_Recipients != 0 && m_Recipients->GetSize() > 0) - { - for (i = 0; i < recipientCount; i++) - { - aUser = (User *) m_Recipients->GetAt(i); - xstring = aUser->getXString().toCString(""); - PR_ASSERT(xstring != 0); - CAPI_GetHandle(pS, xstring, 0, &handles[i + extraUserHandle]); - delete [] xstring; xstring = 0; - } - } - //if (FALSE) TRACE("CAPI_GetHandle:%lx\r\n", foo); - //sprintf(sDebugOut, "CAPI_GetHandle:%lx\r\n", foo); - - // HandleCAPI call - // OLD WAY - //foo = handleCAPI(pS, pH, m_Modifiers, &strings, - // &eventFetchedByUID, numstrings, outType); - // - cStat = handleCAPI(pS, &handles[0], handleCount, 0, m_ICalComponentVctr, m_Calendar, - m_Modifiers, outCalendars, outType); - - if (cStat != CAPI_ERR_OK) - { - if (status == TR_OK) - { - status = TR_CAPI_HANDLE_CAPI_FAILED; - } - } - - // Logoff - cStat = CAPI_Logoff(&pS, (long) 0); - if (cStat != CAPI_ERR_OK) - { - if (status == TR_OK) - { - status = TR_CAPI_LOGOFF_FAILED; - } - } - //if (FALSE) TRACE("CAPI_GetLogoff:%lx\r\n", foo); - //sprintf(sDebugOut, "CAPI_GetLogoff:%lx\r\n", status); - - // Destroy Handle - //foo = CAPI_DestroyHandle(&pH); - CAPI_DestroyHandles(pS, &handles[0], handleCount, 0); - - if (userlogonstring != 0) - { - delete [] userlogonstring; userlogonstring = 0; - } - if (password != 0) - { - delete [] password; password = 0; - } - if (hostname != 0) - { - delete [] hostname; hostname = 0; - } - if (node != 0) - { - delete [] node; node = 0; - } - } - } - return status; -} -#endif /* #if CAPI_READY */ -//--------------------------------------------------------------------- diff --git a/mozilla/calendar/modules/network/itip/src/txnobjfy.cpp b/mozilla/calendar/modules/network/itip/src/txnobjfy.cpp deleted file mode 100644 index e3fa2e9d957..00000000000 --- a/mozilla/calendar/modules/network/itip/src/txnobjfy.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * txnobjfy.cpp - * John Sun - * 4/13/98 11:23:24 AM - */ - -#include "jdefines.h" -#include "julnstr.h" -#include "txnobjfy.h" -#include "sttxnobj.h" -#include "getxnobj.h" -#include "detxnobj.h" -#include "nscal.h" - -//--------------------------------------------------------------------- - -TransactionObjectFactory::TransactionObjectFactory() -{ - PR_ASSERT(FALSE); -} - -//--------------------------------------------------------------------- - -TransactionObject * -TransactionObjectFactory::Make(NSCalendar & cal, - JulianPtrArray & components, - User & user, - JulianPtrArray & recipients, - UnicodeString & subject, - JulianPtrArray & modifiers, - JulianForm * jf, - MWContext * context, - UnicodeString & attendeeName, - TransactionObject::EFetchType fetchType) -{ - TransactionObject * outTxnObj = 0; - - NSCalendar::METHOD method = cal.getMethod(); - - // For fetch type not set to NONE, make GetTransactionType - // ignore method arg - if (fetchType != TransactionObject::EFetchType_NONE) - { - outTxnObj = new GetTransactionObject(cal, components, user, - recipients, subject, modifiers, jf, context, attendeeName, fetchType); - } - else - { - switch (method) - { - case NSCalendar::METHOD_PUBLISH: - // store - outTxnObj = new StoreTransactionObject(cal, components, user, - recipients, subject, modifiers, jf, context, attendeeName); - break; - case NSCalendar::METHOD_REQUEST: - // store - outTxnObj = new StoreTransactionObject(cal, components, user, - recipients, subject, modifiers, jf, context, attendeeName); - break; - case NSCalendar::METHOD_REPLY: - // store - outTxnObj = new StoreTransactionObject(cal, components, user, - recipients, subject, modifiers, jf, context, attendeeName); - break; - case NSCalendar::METHOD_CANCEL: - // delete - outTxnObj = new DeleteTransactionObject(cal, components, user, - recipients, subject, modifiers, jf, context, attendeeName); - break; - case NSCalendar::METHOD_REFRESH: - // ??? store ??? - outTxnObj = new StoreTransactionObject(cal, components, user, - recipients, subject, modifiers, jf, context, attendeeName); - break; - case NSCalendar::METHOD_COUNTER: - // no CAPI, use IRIP, IMIP - outTxnObj = new StoreTransactionObject(cal, components, user, - recipients, subject, modifiers, jf, context, attendeeName); - break; - case NSCalendar::METHOD_DECLINECOUNTER: - // no CAPI, use IRIP, IMIP - outTxnObj = new StoreTransactionObject(cal, components, user, - recipients, subject, modifiers, jf, context, attendeeName); - break; - case NSCalendar::METHOD_ADD: - // store - outTxnObj = new StoreTransactionObject(cal, components, user, - recipients, subject, modifiers, jf, context, attendeeName); - break; - default: - break; - } - } - - return outTxnObj; -} diff --git a/mozilla/calendar/modules/network/itip/src/user.cpp b/mozilla/calendar/modules/network/itip/src/user.cpp deleted file mode 100644 index 6ba0dcb9399..00000000000 --- a/mozilla/calendar/modules/network/itip/src/user.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -// user.cpp -// John Sun -// 3/10/98 2:58:33 PM - -#include "stdafx.h" -#include "jdefines.h" -#include "unistrto.h" -#include "user.h" - -//--------------------------------------------------------------------- - -User::User() -{ -#if CAPI_READY - m_Session = 0; -#endif -} - -//--------------------------------------------------------------------- - -User::~User() -{ -} - -//--------------------------------------------------------------------- - -User::User(UnicodeString realName, UnicodeString imip) -{ - m_RealName = realName; - m_IMIPAddress = imip; - m_CAPIAddress = ""; - m_IRIPAddress = ""; - m_XItemID = -1; -#if CAPI_READY - m_Session = 0; -#endif -} - -//--------------------------------------------------------------------- - -User::User(UnicodeString realName, UnicodeString imip, - UnicodeString capi, UnicodeString irip, - t_int32 xItemID) -{ - m_RealName = realName; - m_CAPIAddress = capi; - m_IRIPAddress = irip; - m_IMIPAddress = imip; - m_XItemID = xItemID; -#if CAPI_READY - m_Session = 0; -#endif -} - -//--------------------------------------------------------------------- - -User::User(User & that) -{ - m_CAPIAddress = that.m_CAPIAddress; - m_IMIPAddress = that.m_IMIPAddress; - m_IRIPAddress = that.m_IRIPAddress; - m_RealName = that.m_RealName; - m_LoginName = that.m_LoginName ; - m_Password = that.m_Password; - m_Hostname = that.m_Hostname; - m_Node = that.m_Node; -#if CAPI_READY - m_Session = 0; // can't copy session's -#endif -} -//--------------------------------------------------------------------- - -User * -User::clone() -{ - return new User(*this); -} - -//--------------------------------------------------------------------- - -UnicodeString -User::toString() -{ - char sNum[20]; - sprintf(sNum, "%d", m_XItemID); - UnicodeString out; - out += "realname: "; - out += m_RealName; - out += "\r\nCAPI Addr.: "; - out += m_CAPIAddress; - out += " XItemID: "; - out += sNum; - out += "\r\nIRIP Addr.: "; - out += m_IRIPAddress; - out += "\r\nIMIP Addr.: "; - out += m_IMIPAddress; - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString -User::getXString() -{ - UnicodeString out; - if (m_LoginName.size() > 0) - { - return MakeXString(m_LoginName, out); - } - else - return MakeXString(m_RealName, out); -} - -//--------------------------------------------------------------------- - -UnicodeString -User::getLogonString() -{ - UnicodeString out; - if (m_LoginName.size() > 0) - { - return MakeCAPILogonString(m_LoginName, m_Node, out); - } - else - return MakeCAPILogonString(m_RealName, m_Node, out); -} - -//--------------------------------------------------------------------- - -UnicodeString & -User::MakeXString(UnicodeString & realName, UnicodeString & out) -{ - out = ""; - UnicodeStringTokenizer * st; - UnicodeString u = " "; - st = new UnicodeStringTokenizer(realName, u); - if (st != 0) - { - UnicodeString sirName, givenName; - if (st->hasMoreTokens()) - { - ErrorCode status = ZERO_ERROR; - givenName = st->nextToken(u, status); - while (st->hasMoreTokens()) - { - // last name may have spaces - sirName += st->nextToken(u, status); - } - - } - out += "S="; - out += sirName; - out += "/G="; - out += givenName; - delete st; st = 0; - } - return out; -} - -//--------------------------------------------------------------------- - -UnicodeString & -User::MakeCAPILogonString(UnicodeString & realName, - UnicodeString & node, - UnicodeString & out) -{ - MakeXString(realName, out); - out.insert(0, ":/"); - out += "/ND="; - out += node; - out += "/"; - return out; -} - -//--------------------------------------------------------------------- - -void -User::deleteUserVector(JulianPtrArray * users) -{ - t_int32 i; - if (users != 0) - { - for (i = users->GetSize() - 1; i >= 0; i--) - { - delete ((User *) users->GetAt(i)); - } - } -} - -//--------------------------------------------------------------------- - -void -User::cloneUserVector(JulianPtrArray * toClone, - JulianPtrArray * out) -{ - if (out != 0) - { - if (toClone != 0) - { - t_int32 i; - User * comp; - User * clone; - for (i = 0; i < toClone->GetSize(); i++) - { - comp = (User *) toClone->GetAt(i); - clone = comp->clone(); - out->Add(clone); - } - } - } -} -//--------------------------------------------------------------------- - diff --git a/mozilla/calendar/modules/network/manifest.mn b/mozilla/calendar/modules/network/manifest.mn deleted file mode 100644 index ce3438947f4..00000000000 --- a/mozilla/calendar/modules/network/manifest.mn +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../.. -DEPTH = ../../.. - -DIRS = capi - -#LIBRARY_NAME = calnetwork - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = xpcom raptor shell trex diff --git a/mozilla/calendar/modules/nls/Makefile b/mozilla/calendar/modules/nls/Makefile deleted file mode 100644 index 0c9b99c2e43..00000000000 --- a/mozilla/calendar/modules/nls/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - - diff --git a/mozilla/calendar/modules/nls/manifest.mn b/mozilla/calendar/modules/nls/manifest.mn deleted file mode 100644 index 907e69e7c79..00000000000 --- a/mozilla/calendar/modules/nls/manifest.mn +++ /dev/null @@ -1,13 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../.. -DEPTH = ../../.. - -DIRS = nlsstub diff --git a/mozilla/calendar/modules/nls/nlsstub/Makefile b/mozilla/calendar/modules/nls/nlsstub/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/Makefile b/mozilla/calendar/modules/nls/nlsstub/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/calendar.h b/mozilla/calendar/modules/nls/nlsstub/inc/calendar.h deleted file mode 100644 index b2ca3a900a1..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/calendar.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef calendar_h__ -#define calendar_h__ - -#include "ptypes.h" -#include "parsepos.h" -#include "nspr.h" -#include "prtime.h" -#include "prprf.h" - -class TimeZone; -class ParsePosition; - -class NS_NLS Calendar -{ - -public: - - enum EMonths { - JANUARY, - FEBRUARY, - MARCH, - APRIL, - MAY, - JUNE, - JULY, - AUGUST, - SEPTEMBER, - OCTOBER, - NOVEMBER, - DECEMBER, - UNDECIMBER - }; - - enum EDateFields - { - SECOND, - DAY_OF_WEEK_IN_MONTH, - MINUTE, - HOUR, - DAY_OF_YEAR, - WEEK_OF_YEAR, - MONTH, - DATE, - DAY_OF_WEEK, - DAY_OF_MONTH, - HOUR_OF_DAY, - YEAR - }; - - enum EDaysOfWeek - { - SUNDAY = 1, - MONDAY, - TUESDAY, - WEDNESDAY, - THURSDAY, - FRIDAY, - SATURDAY - }; - -public: - Calendar(); - ~Calendar(); - - static Date getNow(); - void setTimeZone(const TimeZone& aZone); - Date getTime(ErrorCode& aStatus) const; - PRInt32 get(EDateFields aField, ErrorCode& aStatus) const; - void setTime(Date aDate, ErrorCode& aStatus); - void set(EDateFields aField, PRInt32 aValue); - void set(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate); - void set(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute); - void set(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute, PRInt32 aSecond); - virtual void add(EDateFields aField, PRInt32 aAmount, ErrorCode& aStatus) = 0; - - void clear(); - void clear(EDateFields aField); - -public: - PRTime mTime; - PRExplodedTime mExplodedTime; - -private: - TimeZone * mTimeZone ; - - -}; - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/datefmt.h b/mozilla/calendar/modules/nls/nlsstub/inc/datefmt.h deleted file mode 100644 index af3938f2355..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/datefmt.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef datefmt_h__ -#define datefmt_h__ - -#include "prtypes.h" -#include "unistring.h" - -class ParsePosition; -class Format; -class TimeZone; - -class NS_NLS DateFormat -{ - -public: - DateFormat(); - ~DateFormat(); - - virtual void setLenient(PRBool aLenient); - virtual void setTimeZone(const TimeZone& aZone); - virtual Date parse(const UnicodeString& aUnicodeString, ErrorCode& aStatus) const; - virtual Date parse(const UnicodeString& aUnicodeString, ParsePosition& aPosition) const = 0; - - virtual PRBool operator==(const Format& aFormat) const; - -}; - - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/gregocal.h b/mozilla/calendar/modules/nls/nlsstub/inc/gregocal.h deleted file mode 100644 index e0389698aef..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/gregocal.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef gregocal_h__ -#define gregocal_h__ - -#include "ptypes.h" -#include "calendar.h" - -class TimeZone; -class Locale; - -class NS_NLS GregorianCalendar : public Calendar -{ - -public: - GregorianCalendar(); - ~GregorianCalendar(); - - GregorianCalendar(ErrorCode& aSuccess); - GregorianCalendar(TimeZone* aZoneToAdopt, ErrorCode& aSuccess); - GregorianCalendar(const TimeZone& aZone, ErrorCode& aSuccess); - GregorianCalendar(const Locale& aLocale, ErrorCode& aSuccess); - GregorianCalendar(TimeZone* aZoneToAdopt, const Locale& aLocale, ErrorCode& aSuccess); - GregorianCalendar(const TimeZone& aZone, const Locale& aLocale, ErrorCode& aSuccess); - GregorianCalendar(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, ErrorCode& aSuccess); - GregorianCalendar(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute, ErrorCode& aSuccess); - GregorianCalendar(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute, PRInt32 aSecond, ErrorCode& aSuccess); - - virtual void add(EDateFields aField, PRInt32 aAmount, ErrorCode& aStatus); - -}; - - - - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/hashtab.h b/mozilla/calendar/modules/nls/nlsstub/inc/hashtab.h deleted file mode 100644 index 81ad048dc1e..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/hashtab.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef hashtab_h__ -#define hashtab_h__ - - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/locid.h b/mozilla/calendar/modules/nls/nlsstub/inc/locid.h deleted file mode 100644 index 960576d8b67..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/locid.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef locid_h__ -#define locid_h__ - -#include "ptypes.h" - -class UnicodeString; - -class NS_NLS Locale -{ - -public: - Locale(); - ~Locale(); - - static const Locale& getDefault(); - UnicodeString& getName(UnicodeString& aName) const; - -}; - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/manifest.mn b/mozilla/calendar/modules/nls/nlsstub/inc/manifest.mn deleted file mode 100644 index 6d2f858ca52..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/manifest.mn +++ /dev/null @@ -1,31 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - - -EXPORTS = \ - calendar.h \ - datefmt.h \ - gregocal.h \ - hashtab.h \ - locid.h \ - nlsloc.h \ - parsepos.h \ - ptypes.h \ - simpletz.h \ - smpdtfmt.h \ - timezone.h \ - unicode.h \ - unistring.h \ - $(NULL) - -MODULE = nls - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/nlsloc.h b/mozilla/calendar/modules/nls/nlsstub/inc/nlsloc.h deleted file mode 100644 index 339a0e90dc6..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/nlsloc.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nlsloc_h__ -#define nlsloc_h__ - -#include "ptypes.h" - -typedef PRUint32 NLS_ThreadInfo; -typedef PRUint32 NLS_ErrorCode; - -NLS_ErrorCode NS_NLS NLS_Initialize(const NLS_ThreadInfo * aThreadInfo, const char * aDataDirectory); -NLS_ErrorCode NS_NLS NLS_Terminate(void); - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/parsepos.h b/mozilla/calendar/modules/nls/nlsstub/inc/parsepos.h deleted file mode 100644 index ea5ed9e83c0..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/parsepos.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef parsepos_h__ -#define parsepos_h__ - -#include "ptypes.h" - -class NS_NLS ParsePosition -{ - -public: - ParsePosition(); - ~ParsePosition(); - - ParsePosition(TextOffset aIndex); - ParsePosition(const ParsePosition& aParsePosition); - - PRBool operator==(const ParsePosition& aParsePosition) const; - -}; - - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/ptypes.h b/mozilla/calendar/modules/nls/nlsstub/inc/ptypes.h deleted file mode 100644 index 7c88fe79e37..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/ptypes.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef ptypes_h__ -#define ptypes_h__ - -#include "nscore.h" -#include "nspr.h" - -typedef double Date; - -#define ZERO_ERROR 0 - -typedef PRInt32 ErrorCode; -typedef PRInt8 t_int8; -typedef PRInt32 t_int32; -typedef PRBool t_bool; -typedef PRInt32 TextOffset; - -#ifdef _IMPL_NS_NLS -#define NS_NLS NS_EXPORT -#else -#define NS_NLS NS_IMPORT -#endif - - -#define SUCCESS(x) ((x)<=ZERO_ERROR) -#define FAILURE(x) ((x)>ZERO_ERROR) - -#define kMillisPerSecond (PR_INT32(PR_MSEC_PER_SEC)) -#define kMillisPerMinute (PR_INT32(60) * kMillisPerSecond) -#define kMillisPerHour (PR_INT32(60) * kMillisPerMinute) -#define kMillisPerDay (PR_INT32(24) * kMillisPerHour) - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/simpletz.h b/mozilla/calendar/modules/nls/nlsstub/inc/simpletz.h deleted file mode 100644 index c7ca55312a8..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/simpletz.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef simpletz_h__ -#define simpletz_h__ - -#include "timezone.h" - -class NS_NLS SimpleTimeZone : public TimeZone -{ - -public: - SimpleTimeZone(); - ~SimpleTimeZone(); - SimpleTimeZone(PRInt32 aRawOffset, const UnicodeString& aID); - - SimpleTimeZone(PRInt32 aRawOffset, const UnicodeString& aID, - PRInt8 aStartMonth, PRInt8 aStartDayOfWeekInMonth, - PRInt8 aStartDayOfWeek, PRInt32 aStartTime, - PRInt8 aEndMonth, PRInt8 aEndDayOfWeekInMonth, - PRInt8 aEndDayOfWeek, PRInt32 aEndTime, - PRInt32 aDstSavings = kMillisPerHour); - - virtual TimeZone* clone() const; - virtual void setRawOffset(PRInt32 aOffsetMillis); - void setStartRule(PRInt32 aMonth, PRInt32 aDayOfWeekInMonth, PRInt32 aDayOfWeek, PRInt32 aTime); - void setEndRule(PRInt32 aMonth, PRInt32 aDayOfWeekInMonth, PRInt32 aDayOfWeek, PRInt32 aTime); - -}; - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/smpdtfmt.h b/mozilla/calendar/modules/nls/nlsstub/inc/smpdtfmt.h deleted file mode 100644 index df0ddf28919..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/smpdtfmt.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef smpdtfmt_h__ -#define smpdtfmt_h__ - -#include "prtypes.h" -#include "datefmt.h" - -class UnicodeString; -class Formattable; -class ParsePosition; -class Format; - -class NS_NLS FieldPosition -{ -public: - FieldPosition(); - ~FieldPosition(); - FieldPosition(PRInt32 aField); -}; - -class NS_NLS SimpleDateFormat : public DateFormat -{ -public: - SimpleDateFormat(); - ~SimpleDateFormat(); - SimpleDateFormat(ErrorCode& aStatus); - - SimpleDateFormat(const UnicodeString& aPattern, const Locale& aLocale, ErrorCode& aStatus); - - virtual UnicodeString& format(Date aDate, UnicodeString& aAppendTo, FieldPosition& aPosition) const; - virtual UnicodeString& format(const Formattable& aObject, UnicodeString& aAppendTo, FieldPosition& aPosition, ErrorCode& aStatus) const; - virtual void applyLocalizedPattern(const UnicodeString& aPattern, ErrorCode& aStatus); - virtual Date parse(const UnicodeString& aUnicodeString, ParsePosition& aPosition) const; - - virtual PRBool operator==(const Format& other) const; - -}; -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/timezone.h b/mozilla/calendar/modules/nls/nlsstub/inc/timezone.h deleted file mode 100644 index 75db200e176..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/timezone.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef timezone_h__ -#define timezone_h__ - -#include "ptypes.h" - -class UnicodeString; - -class NS_NLS TimeZone -{ - -public: - TimeZone(); - ~TimeZone(); - - static TimeZone* createDefault(); - static TimeZone* createTimeZone(const UnicodeString& aID); - void setID(const UnicodeString& aID); - -}; - - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/unicode.h b/mozilla/calendar/modules/nls/nlsstub/inc/unicode.h deleted file mode 100644 index fc847e25d9b..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/unicode.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef unicode_h__ -#define unicode_h__ - - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/inc/unistring.h b/mozilla/calendar/modules/nls/nlsstub/inc/unistring.h deleted file mode 100644 index 94efd805397..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/inc/unistring.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef unistring_h__ -#define unistring_h__ - -#include "nscore.h" -#include "nsString.h" -#include "nspr.h" -#include "limits.h" - -#include "ptypes.h" - -class Locale; - -class NS_NLS UnicodeString -{ - -public: - UnicodeString(); - ~UnicodeString(); - - UnicodeString(const UnicodeString& aUnicodeString); - UnicodeString(const char * aString); - - PRUint32 size() { return mLength; } - PRInt32 hashCode() const; - - TextOffset indexOf(const UnicodeString& aUnicodeString, TextOffset aFromOffset = 0, PRUint32 aForLength = -1) const; - TextOffset indexOf(PRUnichar aUnichar, TextOffset aFromOffset = 0, PRUint32 aForLength = -1) const; - - UnicodeString& extractBetween(TextOffset aStart, TextOffset aLimit, UnicodeString& aExtractInto) const; - - PRInt32 compareIgnoreCase(const UnicodeString& aUnicodeString) const; - PRInt32 compareIgnoreCase(const PRUnichar* aUnichar, PRInt32 aLength) const; - PRInt32 compareIgnoreCase(const PRUnichar* aUnichar) const; - PRInt32 compareIgnoreCase(const char* aChar, const char* aEncoding) const; - PRInt32 compareIgnoreCase(const char* aChar) const; - UnicodeString& toUpper(); - UnicodeString& toUpper(const Locale& aLocale); - - char* toCString(const char* aEncoding) const; - - UnicodeString& trim(UnicodeString& aUnicodeString) const; - void trim(); - UnicodeString& remove(); - UnicodeString& remove(TextOffset aOffset,PRInt32 aLength = LONG_MAX); - UnicodeString& insert(TextOffset aThisOffset, const UnicodeString& aUnicodeString); - PRBool startsWith(const UnicodeString& aUnicodeString) const; - PRBool endsWith(const UnicodeString& aUnicodeString) const; - UnicodeString& removeBetween(TextOffset aStart = 0, TextOffset aLimit = LONG_MAX); - - - PRInt8 compare(const UnicodeString& aUnicodeString) const; - PRInt8 compare(TextOffset aOffset, PRInt32 aThisLength, const UnicodeString& aUnicodeString, TextOffset aStringOffset, PRInt32 aLength) const; - PRInt8 compare(const PRUnichar* aUnichar) const; - PRInt8 compare(const PRUnichar* aUnichar, PRInt32 aLength) const; - PRInt8 compare(const char* aChar) const; - - UnicodeString& extract(TextOffset aOffset,PRInt32 aLength, UnicodeString& aExtractInto) const; - void extract(TextOffset aOffset, PRInt32 aLength, PRUnichar*aExtractInto) const; - void extract(TextOffset aOffset, PRInt32 aLength, char* aExtractInto) const; - - UnicodeString& replaceBetween(TextOffset aStart, TextOffset aLimit, const UnicodeString& aString); - - UnicodeString& replace(TextOffset aOffset, t_int32 aLength, const UnicodeString& aString); - UnicodeString& replace(TextOffset aOffset, t_int32 aLength, const PRUnichar* aString); - UnicodeString& replace(TextOffset aOffset, t_int32 aLength, const char* aString); - - -public: - PRUnichar operator[](TextOffset aOffset) const; - PRUnichar& operator[](TextOffset aOffset); - UnicodeString& operator+=(const UnicodeString& aUnicodeString); - UnicodeString& operator+=(PRUnichar aUnichar); - PRBool operator==(const UnicodeString& aUnicodeString) const; - PRBool operator!=(const UnicodeString& aUnicodeString) const; - UnicodeString& operator=(const UnicodeString& aUnicodeString); - -public: - PRUint32 mLength; - nsString mString; -}; - -#endif diff --git a/mozilla/calendar/modules/nls/nlsstub/manifest.mn b/mozilla/calendar/modules/nls/nlsstub/manifest.mn deleted file mode 100644 index 364aaa1bd7f..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/Makefile b/mozilla/calendar/modules/nls/nlsstub/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/calendar.cpp b/mozilla/calendar/modules/nls/nlsstub/src/calendar.cpp deleted file mode 100644 index 3e487b3f21c..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/calendar.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - - -#include "nscore.h" -#include "calendar.h" -#include "prtime.h" - -Calendar::Calendar() -{ - mTimeZone = nsnull; - LL_I2L(mTime, 0); - PR_ExplodeTime(mTime, PR_GMTParameters, &mExplodedTime); -} - -Calendar::~Calendar() -{ -} - -Date Calendar::getNow() -{ - Date d; - - PRTime t; - - t = (PRTime) PR_Now(); - - LL_L2D(d,t); - - return ((Date)d); -} - -void Calendar::setTimeZone(const TimeZone& aZone) -{ - mTimeZone = (TimeZone *)(&aZone); - return ; -} - -Date Calendar::getTime(ErrorCode& aStatus) const -{ - Date d; - - LL_L2D(d,mTime); - - return ((Date)d); -} - - -PRInt32 Calendar::get(EDateFields aField, ErrorCode& aStatus) const -{ - PRInt32 field = 0; - - PR_ExplodeTime(mTime, PR_GMTParameters, (PRExplodedTime*)(&mExplodedTime)); - - switch(aField) - { - case SECOND: - field = mExplodedTime.tm_sec; - break; - - case DAY_OF_WEEK_IN_MONTH: - field = 0; - break; - - case MINUTE: - field = mExplodedTime.tm_min; - break; - - case HOUR: - field = mExplodedTime.tm_hour; - break; - - case DAY_OF_YEAR: - field = mExplodedTime.tm_yday; - break; - - case WEEK_OF_YEAR: - field = 0; - break; - - case MONTH: - field = mExplodedTime.tm_month; - break; - - case DATE: - field = mExplodedTime.tm_mday; - break; - - case DAY_OF_WEEK: - field = mExplodedTime.tm_wday; - break; - - case DAY_OF_MONTH: - field = 0; - break; - - case HOUR_OF_DAY: - field = mExplodedTime.tm_hour; - break; - - case YEAR: - field = mExplodedTime.tm_year; - break; - - default: - field = 0; - break; - - } - - return (field); -} - -void Calendar::setTime(Date aDate, ErrorCode& aStatus) -{ - LL_D2L(mTime,aDate); - PR_ExplodeTime(mTime, PR_GMTParameters, &mExplodedTime); - return; -} - -void Calendar::set(EDateFields aField, PRInt32 aValue) -{ - switch(aField) - { - case SECOND: - mExplodedTime.tm_sec = aValue; - break; - - case DAY_OF_WEEK_IN_MONTH: - break; - - case MINUTE: - mExplodedTime.tm_min = aValue; - break; - - case HOUR: - mExplodedTime.tm_hour = aValue; - break; - - case DAY_OF_YEAR: - break; - - case WEEK_OF_YEAR: - break; - - case MONTH: - mExplodedTime.tm_month = aValue; - break; - - case DATE: - mExplodedTime.tm_mday = aValue; - break; - - case DAY_OF_WEEK: - break; - - case DAY_OF_MONTH: - break; - - case HOUR_OF_DAY: - mExplodedTime.tm_hour = aValue; - break; - - case YEAR: - mExplodedTime.tm_year = aValue; - break; - - default: - break; - - } - - mTime = PR_ImplodeTime(&mExplodedTime); - PR_ExplodeTime(mTime, PR_GMTParameters, &mExplodedTime); - - return ; -} - -void Calendar::set(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate) -{ - mExplodedTime.tm_year = aYear; - mExplodedTime.tm_month = aMonth; - mExplodedTime.tm_mday = aDate; - - mTime = PR_ImplodeTime(&mExplodedTime); - - PR_ExplodeTime(mTime, PR_GMTParameters, &mExplodedTime); - - return ; -} - -void Calendar::set(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute) -{ - mExplodedTime.tm_year = aYear; - mExplodedTime.tm_month = aMonth; - mExplodedTime.tm_mday = aDate; - mExplodedTime.tm_hour = aHour; - mExplodedTime.tm_min = aMinute; - - mTime = PR_ImplodeTime(&mExplodedTime); - - PR_ExplodeTime(mTime, PR_GMTParameters, &mExplodedTime); - - return ; -} - -void Calendar::set(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute, PRInt32 aSecond) -{ - mExplodedTime.tm_year = aYear; - mExplodedTime.tm_month = aMonth; - mExplodedTime.tm_mday = aDate; - mExplodedTime.tm_hour = aHour; - mExplodedTime.tm_min = aMinute; - mExplodedTime.tm_sec = aSecond; - - mTime = PR_ImplodeTime(&mExplodedTime); - - PR_ExplodeTime(mTime, PR_GMTParameters, &mExplodedTime); - return ; -} - -void Calendar::clear() -{ - LL_I2L(mTime, 0); - PR_ExplodeTime(mTime, PR_GMTParameters, &mExplodedTime); - return ; -} - -void Calendar::clear(EDateFields aField) -{ - set(aField,0); - return ; -} - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/config.mk b/mozilla/calendar/modules/nls/nlsstub/src/config.mk deleted file mode 100644 index 96c7d58c4f4..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/config.mk +++ /dev/null @@ -1,26 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_NLS -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include -I$(GDEPTH)/htmlparser/src - -LIBRARY_NAME = nlsstub -LIBRARY_VERSION = 10 - -LD_LIBS += \ - raptorbase \ - xpcom$(MOZ_BITS) - -EXTRA_LIBS += $(NSPR_LIBS) diff --git a/mozilla/calendar/modules/nls/nlsstub/src/datefmt.cpp b/mozilla/calendar/modules/nls/nlsstub/src/datefmt.cpp deleted file mode 100644 index a44cc056674..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/datefmt.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "datefmt.h" -#include "unistring.h" -#include "time.h" - -DateFormat::DateFormat() -{ -} - -DateFormat::~DateFormat() -{ -} - -void DateFormat::setLenient(PRBool aLenient) -{ - return; -} - -void DateFormat::setTimeZone(const TimeZone& aZone) -{ - return; -} - -Date DateFormat::parse(const UnicodeString& aUnicodeString, ErrorCode& aStatus) const -{ - // XXX - time_t t; - time(&t); - return ((Date)t*kMillisPerSecond); -} - -PRBool DateFormat::operator==(const Format& aFormat) const -{ - return (PR_TRUE); -} diff --git a/mozilla/calendar/modules/nls/nlsstub/src/gregocal.cpp b/mozilla/calendar/modules/nls/nlsstub/src/gregocal.cpp deleted file mode 100644 index 8884347f774..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/gregocal.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "gregocal.h" - -GregorianCalendar::GregorianCalendar() : Calendar() -{ -} - -GregorianCalendar::~GregorianCalendar() -{ -} - -GregorianCalendar::GregorianCalendar(ErrorCode& aSuccess) : Calendar() -{ -} - -GregorianCalendar::GregorianCalendar(TimeZone* aZoneToAdopt, ErrorCode& aSuccess) : Calendar() -{ - setTimeZone(*aZoneToAdopt); -} - -GregorianCalendar::GregorianCalendar(const TimeZone& aZone, ErrorCode& aSuccess) : Calendar() -{ - setTimeZone(aZone); -} - -GregorianCalendar::GregorianCalendar(const Locale& aLocale, ErrorCode& aSuccess) : Calendar() -{ -} - -GregorianCalendar::GregorianCalendar(TimeZone* aZoneToAdopt, const Locale& aLocale, ErrorCode& aSuccess) : Calendar() -{ - setTimeZone(*aZoneToAdopt); -} - -GregorianCalendar::GregorianCalendar(const TimeZone& aZone, const Locale& aLocale, ErrorCode& aSuccess) - : Calendar() -{ - setTimeZone(aZone); -} - -GregorianCalendar::GregorianCalendar(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, ErrorCode& aSuccess) - : Calendar() -{ - set(aYear, aMonth, aDate); -} - -GregorianCalendar::GregorianCalendar(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute, ErrorCode& aSuccess) - : Calendar() -{ - set(aYear, aMonth, aDate, aHour, aMinute); -} - -GregorianCalendar::GregorianCalendar(PRInt32 aYear, PRInt32 aMonth, PRInt32 aDate, PRInt32 aHour, PRInt32 aMinute, PRInt32 aSecond, ErrorCode& aSuccess) - : Calendar() -{ - set(aYear, aMonth, aDate, aHour, aMinute, aSecond); -} - -void GregorianCalendar::add(EDateFields aField, PRInt32 aAmount, ErrorCode& aStatus) -{ - switch(aField) - { - case SECOND: - mExplodedTime.tm_sec += aAmount; - break; - - case DAY_OF_WEEK_IN_MONTH: - break; - - case MINUTE: - mExplodedTime.tm_min += aAmount; - break; - - case HOUR: - mExplodedTime.tm_hour += aAmount; - break; - - case DAY_OF_YEAR: - mExplodedTime.tm_mday += aAmount; - break; - - case WEEK_OF_YEAR: - break; - - case MONTH: - mExplodedTime.tm_month += aAmount; - break; - - case DATE: - mExplodedTime.tm_mday += aAmount; - break; - - case DAY_OF_WEEK: - break; - - case DAY_OF_MONTH: - break; - - case HOUR_OF_DAY: - mExplodedTime.tm_hour += aAmount; - break; - - case YEAR: - mExplodedTime.tm_year += aAmount; - break; - - default: - break; - - } - - PR_NormalizeTime(&mExplodedTime,PR_GMTParameters); - - mTime = PR_ImplodeTime(&mExplodedTime); - - PR_ExplodeTime(mTime, PR_GMTParameters, &mExplodedTime); - - return; -} - - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/locid.cpp b/mozilla/calendar/modules/nls/nlsstub/src/locid.cpp deleted file mode 100644 index bbb95ca8936..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/locid.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "locid.h" -#include "unistring.h" - -static UnicodeString u("Locale Name Goes Here"); -static Locale l; - -Locale::Locale() -{ -} - -Locale::~Locale() -{ -} - -const Locale& Locale::getDefault() -{ - return (l); -} - -UnicodeString& Locale::getName(UnicodeString& aName) const -{ - return (u); -} diff --git a/mozilla/calendar/modules/nls/nlsstub/src/manifest.mn b/mozilla/calendar/modules/nls/nlsstub/src/manifest.mn deleted file mode 100644 index a1fb763af98..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/manifest.mn +++ /dev/null @@ -1,34 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = nls - -CPPSRCS = \ - calendar.cpp \ - datefmt.cpp \ - gregocal.cpp \ - locid.cpp \ - nlsloc.cpp \ - parsepos.cpp \ - simpletz.cpp \ - smpdtfmt.cpp \ - timezone.cpp \ - unistring.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls netlib shell xpfc - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/nlsloc.cpp b/mozilla/calendar/modules/nls/nlsstub/src/nlsloc.cpp deleted file mode 100644 index 676b74a31d8..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/nlsloc.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nlsloc.h" - -NLS_ErrorCode NLS_Initialize(const NLS_ThreadInfo * aThreadInfo, const char * aDataDirectory) -{ - return 0; -} - -NLS_ErrorCode NLS_Terminate(void) -{ - return 0; -} - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/parsepos.cpp b/mozilla/calendar/modules/nls/nlsstub/src/parsepos.cpp deleted file mode 100644 index 02c5d0997e1..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/parsepos.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "parsepos.h" - -ParsePosition::ParsePosition() -{ -} - -ParsePosition::~ParsePosition() -{ -} - - -ParsePosition::ParsePosition(TextOffset aIndex) -{ -} - -ParsePosition::ParsePosition(const ParsePosition& aParsePosition) -{ -} - -PRBool ParsePosition::operator==(const ParsePosition& aParsePosition) const -{ - return (PR_TRUE); -} - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/simpletz.cpp b/mozilla/calendar/modules/nls/nlsstub/src/simpletz.cpp deleted file mode 100644 index ed65d2efff7..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/simpletz.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "simpletz.h" - -SimpleTimeZone::SimpleTimeZone() : TimeZone() -{ -} - -SimpleTimeZone::~SimpleTimeZone() -{ -} - -SimpleTimeZone::SimpleTimeZone(PRInt32 aRawOffset, const UnicodeString& aID) : TimeZone() -{ -} - -SimpleTimeZone::SimpleTimeZone(PRInt32 aRawOffset, const UnicodeString& aID, - PRInt8 aStartMonth, PRInt8 aStartDayOfWeekInMonth, - PRInt8 aStartDayOfWeek, PRInt32 aStartTime, - PRInt8 aEndMonth, PRInt8 aEndDayOfWeekInMonth, - PRInt8 aEndDayOfWeek, PRInt32 aEndTime, - PRInt32 aDstSavings) : TimeZone() -{ -} - -TimeZone* SimpleTimeZone::clone() const -{ - TimeZone * t = (TimeZone*) new TimeZone(); - return t; -} - -void SimpleTimeZone::setRawOffset(PRInt32 aOffsetMillis) -{ - return ; -} - -void SimpleTimeZone::setStartRule(PRInt32 aMonth, PRInt32 aDayOfWeekInMonth, PRInt32 aDayOfWeek, PRInt32 aTime) -{ - return ; -} - -void SimpleTimeZone::setEndRule(PRInt32 aMonth, PRInt32 aDayOfWeekInMonth, PRInt32 aDayOfWeek, PRInt32 aTime) -{ - return ; -} - - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/smpdtfmt.cpp b/mozilla/calendar/modules/nls/nlsstub/src/smpdtfmt.cpp deleted file mode 100644 index 3e22f865e51..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/smpdtfmt.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "smpdtfmt.h" -#include "time.h" - -static UnicodeString u("06/06/66"); - -FieldPosition::FieldPosition() -{ -} - -FieldPosition::~FieldPosition() -{ -} - -FieldPosition::FieldPosition(PRInt32 aField) -{ -} - - -SimpleDateFormat::SimpleDateFormat() : DateFormat() -{ -} - -SimpleDateFormat::~SimpleDateFormat() -{ -} - -SimpleDateFormat::SimpleDateFormat(ErrorCode& aStatus) : DateFormat() -{ -} - -SimpleDateFormat::SimpleDateFormat(const UnicodeString& aPattern, const Locale& aLocale, ErrorCode& aStatus) : DateFormat() -{ -} - - -UnicodeString& SimpleDateFormat::format(Date aDate, UnicodeString& aAppendTo, FieldPosition& aPosition) const -{ - return (u); -} - -UnicodeString& SimpleDateFormat::format(const Formattable& aObject, UnicodeString& aAppendTo, FieldPosition& aPosition, ErrorCode& aStatus) const -{ - return (u); -} - -void SimpleDateFormat::applyLocalizedPattern(const UnicodeString& aPattern, ErrorCode& aStatus) -{ - return ; -} - -Date SimpleDateFormat::parse(const UnicodeString& aUnicodeString, ParsePosition& aPosition) const -{ - time_t t; - time(&t); - return ((Date)t*kMillisPerSecond); -} - -PRBool SimpleDateFormat::operator==(const Format& other) const -{ - return PR_TRUE; -} - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/timezone.cpp b/mozilla/calendar/modules/nls/nlsstub/src/timezone.cpp deleted file mode 100644 index 9d7dfab95f7..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/timezone.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "timezone.h" -#include "unistring.h" - -TimeZone::TimeZone() -{ -} - -TimeZone::~TimeZone() -{ -} - -TimeZone* TimeZone::createDefault() -{ - TimeZone * t = (TimeZone*) new TimeZone(); - return ((TimeZone *)t); -} - -TimeZone* TimeZone::createTimeZone(const UnicodeString& aID) -{ - TimeZone * t = (TimeZone*) new TimeZone(); - return ((TimeZone *)t); -} - -void TimeZone::setID(const UnicodeString& aID) -{ - return; -} - diff --git a/mozilla/calendar/modules/nls/nlsstub/src/unistring.cpp b/mozilla/calendar/modules/nls/nlsstub/src/unistring.cpp deleted file mode 100644 index f11214f0c4a..00000000000 --- a/mozilla/calendar/modules/nls/nlsstub/src/unistring.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "unistring.h" -#include "nsCRT.h" - - -UnicodeString::UnicodeString() -{ - mLength = mString.Length(); -} - -UnicodeString::~UnicodeString() -{ -} - -UnicodeString::UnicodeString(const UnicodeString& aUnicodeString) -{ - mString = aUnicodeString.mString; - mLength = mString.Length(); -} - -UnicodeString::UnicodeString(const char * aString) -{ - mString = aString; - mLength = mString.Length(); -} - -PRInt32 UnicodeString::hashCode() const -{ - nsCRT::HashValue(mString.GetUnicode()); - return 0; -} - -TextOffset UnicodeString::indexOf(const UnicodeString& aUnicodeString, TextOffset aFromOffset, PRUint32 aForLength) const -{ - return (mString.FindCharInSet((nsString&)(aUnicodeString.mString), aFromOffset)); -} - -TextOffset UnicodeString::indexOf(PRUnichar aUnichar, TextOffset aFromOffset, PRUint32 aForLength) const -{ - return (mString.Find(aUnichar, aFromOffset)); -} - - -UnicodeString& UnicodeString::extractBetween(TextOffset aStart, TextOffset aLimit, UnicodeString& aExtractInto) const -{ - nsString a = mString; - nsString b; - a.Mid(b,aStart,aLimit); - aExtractInto.mString = b; - return (aExtractInto); -} - - -PRInt32 UnicodeString::compareIgnoreCase(const UnicodeString& aUnicodeString) const -{ - return (mString.Compare(aUnicodeString.mString,PR_TRUE)); -} - -PRInt32 UnicodeString::compareIgnoreCase(const PRUnichar* aUnichar, PRInt32 aLength) const -{ - return (mString.Compare(aUnichar,PR_TRUE),aLength); -} - -PRInt32 UnicodeString::compareIgnoreCase(const PRUnichar* aUnichar) const -{ - return (mString.Compare(aUnichar,PR_TRUE)); -} - -PRInt32 UnicodeString::compareIgnoreCase(const char* aChar, const char* aEncoding) const -{ - return (mString.Compare(aChar,PR_TRUE)); -} - -PRInt32 UnicodeString::compareIgnoreCase(const char* aChar) const -{ - return (mString.Compare(aChar,PR_TRUE)); -} - -UnicodeString& UnicodeString::toUpper() -{ - - mString.ToUpperCase(); - return (*this); -} - -UnicodeString& UnicodeString::toUpper(const Locale& aLocale) -{ - mString.ToUpperCase(); - return (*this); -} - -char* UnicodeString::toCString(const char* aEncoding) const -{ - return (mString.ToNewCString()); -} - -UnicodeString& UnicodeString::trim(UnicodeString& aUnicodeString) const -{ - aUnicodeString.mString.CompressWhitespace(); - return (aUnicodeString); -} - -void UnicodeString::trim() -{ - mString.CompressWhitespace(); - mLength = mString.Length(); - return; -} - -UnicodeString& UnicodeString::remove() -{ - mString.Truncate(); - mLength = mString.Length(); - return (*this); -} - -UnicodeString& UnicodeString::remove(TextOffset aOffset,PRInt32 aLength) -{ - mString.Cut(aOffset,aLength); - mLength = mString.Length(); - return (*this); -} - -UnicodeString& UnicodeString::insert(TextOffset aThisOffset, const UnicodeString& aUnicodeString) -{ - mString.Insert(*(aUnicodeString.mString),aThisOffset); - mLength = mString.Length(); - return (*this); -} - -PRBool UnicodeString::startsWith(const UnicodeString& aUnicodeString) const -{ - if (nsCRT::strncmp(aUnicodeString.mString.GetUnicode(),mString.GetUnicode(),aUnicodeString.mString.Length()) == 0) - return PR_TRUE; - - return PR_FALSE; -} - -PRBool UnicodeString::endsWith(const UnicodeString& aUnicodeString) const -{ - PRUint32 offset = mString.Length() - aUnicodeString.mString.Length(); - PRBool b = PR_FALSE; - - if (offset < 0) - return PR_FALSE; - - char * str1 = mString.ToNewCString(); - char * str2 = aUnicodeString.mString.ToNewCString(); - - if (nsCRT::strncasecmp((char *)(str1+offset),str2,aUnicodeString.mString.Length()) == 0) - b = PR_TRUE; - - delete str1; - delete str2; - - return (b); -} - -UnicodeString& UnicodeString::removeBetween(TextOffset aStart, TextOffset aLimit) -{ - mString.Cut(aStart, aLimit); - mLength = mString.Length(); - return (*this); -} - - -PRInt8 UnicodeString::compare(const UnicodeString& aUnicodeString) const -{ - return (mString.Equals(aUnicodeString.mString)); -} - -PRInt8 UnicodeString::compare(TextOffset aOffset, - PRInt32 aThisLength, - const UnicodeString& aUnicodeString, - TextOffset aStringOffset, - PRInt32 aLength) const -{ - - nsString s1 = mString,s2 = aUnicodeString.mString; - - s1.Mid(s1,aOffset,aThisLength); - s2.Mid(s2,aStringOffset,aLength); - - return (s1.Equals(s2)); -} - -PRInt8 UnicodeString::compare(const PRUnichar* aUnichar) const -{ - return (mString.Compare(aUnichar)); -} - -PRInt8 UnicodeString::compare(const PRUnichar* aUnichar, PRInt32 aLength) const -{ - return (mString.Compare(aUnichar,PR_FALSE,aLength)); -} - -PRInt8 UnicodeString::compare(const char* aChar) const -{ - return (mString.Compare(aChar)); -} - -UnicodeString& UnicodeString::extract(TextOffset aOffset,PRInt32 aLength, UnicodeString& aExtractInto) const -{ - nsString str = mString; - str.Mid(aExtractInto.mString,aOffset,aLength); - aExtractInto.mLength = aExtractInto.mString.Length(); - return (aExtractInto); -} - -void UnicodeString::extract(TextOffset aOffset, PRInt32 aLength, PRUnichar*aExtractInto) const -{ - PRUint32 aExtractLength = 0; - nsString str = mString; - - if(((PRInt32)aOffset)<((PRInt32)mLength)) - { - aLength=(PRInt32)(((PRInt32)(aOffset+aLength)<=((PRInt32)mLength)) ? aLength : mLength-aOffset); - - PRUnichar* from = (PRUnichar*)(str.GetUnicode() + aOffset); - PRUnichar* end = (PRUnichar*)(str.GetUnicode() + aOffset + aLength); - - while (from < end) - { - PRUnichar ch = *from; - - aExtractInto[aExtractLength++]=ch; - aExtractInto[aExtractLength]=0; - - from++; - } - } - else - aLength=0; - - return ; -} - -void UnicodeString::extract(TextOffset aOffset, PRInt32 aLength, char* aExtractInto) const -{ - nsString str = mString; - char * p = str.ToNewCString(); - - nsCRT::memcpy(aExtractInto,p+aOffset,aLength); - delete p; - - return; -} - -PRUnichar UnicodeString::operator[](TextOffset aOffset) const -{ - return(mString[aOffset]); -} - -PRUnichar& UnicodeString::operator[](TextOffset aOffset) -{ - return(mString[aOffset]); -} - -UnicodeString& UnicodeString::operator+=(const UnicodeString& aUnicodeString) -{ - mString.Append(aUnicodeString.mString); - return (*this); -} - -UnicodeString& UnicodeString::operator+=(PRUnichar aUnichar) -{ - mString.Append(aUnichar); - return (*this); -} - -PRBool UnicodeString::operator==(const UnicodeString& aUnicodeString) const -{ - return (mString == (aUnicodeString.mString)); -} - -PRBool UnicodeString::operator!=(const UnicodeString& aUnicodeString) const -{ - return (mString != (aUnicodeString.mString)); -} - -UnicodeString& UnicodeString::operator=(const UnicodeString& aUnicodeString) -{ - mString = aUnicodeString.mString; - mLength = mString.Length(); - return (*this); -} - - -UnicodeString& UnicodeString::replaceBetween(TextOffset aStart, TextOffset aLimit, const UnicodeString& aString) -{ - return (*this); -} -UnicodeString& UnicodeString::replace(TextOffset aOffset, t_int32 aLength, const UnicodeString& aString) -{ - return (*this); -} -UnicodeString& UnicodeString::replace(TextOffset aOffset, t_int32 aLength, const PRUnichar* aString) -{ - return (*this); -} -UnicodeString& UnicodeString::replace(TextOffset aOffset, t_int32 aLength, const char* aString) -{ - return (*this); -} - - diff --git a/mozilla/calendar/modules/parser/Makefile b/mozilla/calendar/modules/parser/Makefile deleted file mode 100644 index 07dd5cf71c5..00000000000 --- a/mozilla/calendar/modules/parser/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - - diff --git a/mozilla/calendar/modules/parser/calxml/Makefile b/mozilla/calendar/modules/parser/calxml/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/parser/calxml/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/parser/calxml/inc/Makefile b/mozilla/calendar/modules/parser/calxml/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/parser/calxml/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/parser/calxml/inc/manifest.mn b/mozilla/calendar/modules/parser/calxml/inc/manifest.mn deleted file mode 100644 index ee040d1ca3d..00000000000 --- a/mozilla/calendar/modules/parser/calxml/inc/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsCalXMLDTD.h \ - nsCalXMLContentSink.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLContentSink.h b/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLContentSink.h deleted file mode 100644 index a19725111b4..00000000000 --- a/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLContentSink.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef NS_CALXMLCONTENTSINK -#define NS_CALXMLCONTENTSINK - -#include "nscalexport.h" -#include "nsIParserNode.h" -#include "nsIContentSink.h" -#include "nsString.h" -#include "nsIHTMLContentSink.h" -#include "nsCalendarContainer.h" -#include "nsCalUtilCIID.h" -#include "nsIArray.h" -#include "nsIIterator.h" -#include "nsIStack.h" -#include "nsIXMLParserObject.h" -#include "nsHTMLTokens.h" -#include "nsCalXMLDTD.h" -#include "nsIXMLParserObject.h" -#include "nsICalTimeContext.h" -#include "nsIXPFCXMLContentSink.h" -#include "nsIXPFCContentSink.h" - -class nsCalXMLContentSink : public nsIHTMLContentSink, - public nsIXPFCXMLContentSink, - public nsIXPFCContentSink -{ - -public: - - NS_DECL_ISUPPORTS - - nsCalXMLContentSink(); - virtual ~nsCalXMLContentSink(); - - NS_IMETHOD Init(); - NS_IMETHOD SetViewerContainer(nsIWebViewerContainer * aViewerContainer); - NS_IMETHOD SetRootCanvas(nsIXPFCCanvas * aCanvas); - NS_IMETHOD SetContentSinkContainer(nsISupports * aContentSinkContainer); - - // nsIContentSink - NS_IMETHOD OpenContainer(const nsIParserNode& aNode); - NS_IMETHOD CloseContainer(const nsIParserNode& aNode); - NS_IMETHOD AddLeaf(const nsIParserNode& aNode); - NS_IMETHOD WillBuildModel(void); - NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel); - NS_IMETHOD WillInterrupt(void); - NS_IMETHOD WillResume(void); - - // nsIHTMLContentSink - NS_IMETHOD PushMark(); - NS_IMETHOD SetTitle(const nsString& aValue); - NS_IMETHOD OpenHTML(const nsIParserNode& aNode); - NS_IMETHOD CloseHTML(const nsIParserNode& aNode); - NS_IMETHOD OpenHead(const nsIParserNode& aNode); - NS_IMETHOD CloseHead(const nsIParserNode& aNode); - NS_IMETHOD OpenBody(const nsIParserNode& aNode); - NS_IMETHOD CloseBody(const nsIParserNode& aNode); - NS_IMETHOD OpenForm(const nsIParserNode& aNode); - NS_IMETHOD CloseForm(const nsIParserNode& aNode); - NS_IMETHOD OpenMap(const nsIParserNode& aNode); - NS_IMETHOD CloseMap(const nsIParserNode& aNode); - NS_IMETHOD OpenFrameset(const nsIParserNode& aNode); - NS_IMETHOD CloseFrameset(const nsIParserNode& aNode); - -private: - NS_IMETHOD ConsumeAttributes(const nsIParserNode& aNode, nsIXMLParserObject& aObject); - NS_IMETHOD CIDFromTag(eCalXMLTags tag, nsCID &aClass); - NS_IMETHOD AddToHierarchy(nsIXMLParserObject& aObject, PRBool aPush); - NS_IMETHOD AddControl(const nsIParserNode& aNode); - NS_IMETHOD AddCtx(const nsIParserNode& aNode); - NS_IMETHOD_(nsIXPFCCanvas *) CanvasFromName(nsString& aName); - NS_IMETHOD ApplyContext(nsIXPFCCanvas * aCanvas, nsICalTimeContext * aContext); - -private: - nsCalendarContainer * mCalendarContainer; - nsIArray * mTimeContextList; - nsIStack * mCanvasStack; - nsIArray * mOrphanCanvasList; - nsIArray * mControlList ; - - -}; - - -#endif - - diff --git a/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLDTD.h b/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLDTD.h deleted file mode 100644 index 49d60bddbc8..00000000000 --- a/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLDTD.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef NS_CALXMLDTD__ -#define NS_CALXMLDTD__ - -#include "nscalexport.h" -#include "CNavDTD.h" -#include "nscalstrings.h" - -//*** This enum is used to define the known universe of XIF tags. -//*** The use of this table doesn't preclude of from using non-standard -//*** tags. It simply makes normal tag handling more efficient. -enum eCalXMLTags -{ - eCalXMLTag_unknown=0, - - eCalXMLTag_attr, - eCalXMLTag_calendar, - eCalXMLTag_commandcanvas, - eCalXMLTag_comment, - eCalXMLTag_control, - eCalXMLTag_ctx, - eCalXMLTag_doctype, - eCalXMLTag_foldercanvas, - eCalXMLTag_htmlcanvas, - eCalXMLTag_leaf, - eCalXMLTag_mcc, - eCalXMLTag_monthviewcanvas, - eCalXMLTag_multidayviewcanvas, - eCalXMLTag_multiuserviewcanvas, - eCalXMLTag_object, - eCalXMLTag_panel, - eCalXMLTag_rootpanel, - eCalXMLTag_set, - eCalXMLTag_tcc, - eCalXMLTag_timebarscale, - eCalXMLTag_timebaruserheading, - eCalXMLTag_todocanvas, - eCalXMLTag_xml, - eCalXMLTag_xpitem, - - eCalXMLTag_userdefined -}; - -enum eCalXMLAttributes { - eCalXMLAttr_unknown=0, - - eCalXMLAttr_key, - eCalXMLAttr_tag, - eCalXMLAttr_value, - - eCalXMLAttr_userdefined -}; - - -class nsCalXMLDTD : public CNavDTD { - - public: - - NS_DECL_ISUPPORTS - - nsCalXMLDTD(); - virtual ~nsCalXMLDTD(); - - virtual PRBool CanParse(nsString& aContentType, PRInt32 aVersion); - - virtual eAutoDetectResult AutoDetectContentType(nsString& aBuffer,nsString& aType); - - NS_IMETHOD HandleToken(CToken* aToken); - - virtual nsresult CreateNewInstance(nsIDTD** aInstancePtrResult); - - nsresult HandleStartToken(CToken* aToken); - nsresult HandleEndToken(CToken* aToken); - -private: - NS_IMETHOD_(eCalXMLTags) TagTypeFromObject(const nsIParserNode& aNode) ; - -}; - -#endif diff --git a/mozilla/calendar/modules/parser/calxml/manifest.mn b/mozilla/calendar/modules/parser/calxml/manifest.mn deleted file mode 100644 index 364aaa1bd7f..00000000000 --- a/mozilla/calendar/modules/parser/calxml/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/parser/calxml/public/Makefile b/mozilla/calendar/modules/parser/calxml/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/parser/calxml/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/parser/calxml/public/manifest.mn b/mozilla/calendar/modules/parser/calxml/public/manifest.mn deleted file mode 100644 index cb04cf616a6..00000000000 --- a/mozilla/calendar/modules/parser/calxml/public/manifest.mn +++ /dev/null @@ -1,20 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/parser/calxml/src/Makefile b/mozilla/calendar/modules/parser/calxml/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/parser/calxml/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/parser/calxml/src/config.mk b/mozilla/calendar/modules/parser/calxml/src/config.mk deleted file mode 100644 index f2a1c3ee455..00000000000 --- a/mozilla/calendar/modules/parser/calxml/src/config.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include -I$(GDEPTH)/htmlparser/src - -LIBRARY_NAME = calxml -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) diff --git a/mozilla/calendar/modules/parser/calxml/src/manifest.mn b/mozilla/calendar/modules/parser/calxml/src/manifest.mn deleted file mode 100644 index 0fac889c6ac..00000000000 --- a/mozilla/calendar/modules/parser/calxml/src/manifest.mn +++ /dev/null @@ -1,26 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalXMLDTD.cpp \ - nsCalXMLContentSink.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls netlib shell xpfc - diff --git a/mozilla/calendar/modules/parser/calxml/src/nsCalXMLContentSink.cpp b/mozilla/calendar/modules/parser/calxml/src/nsCalXMLContentSink.cpp deleted file mode 100644 index 5b840a1748c..00000000000 --- a/mozilla/calendar/modules/parser/calxml/src/nsCalXMLContentSink.cpp +++ /dev/null @@ -1,1118 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalXMLContentSink.h" -#include "nsHTMLTokens.h" -#include "nsCalXMLDTD.h" -#include "nsIXMLParserObject.h" -#include "nsCalUICIID.h" -#include "nsXPFCCanvas.h" -#include "nsCalTimebarUserHeading.h" -#include "nsCalTimebarContextController.h" -#include "nsCalTodoComponentCanvas.h" -#include "nsCalMonthContextController.h" -#include "nsCalMultiDayViewCanvas.h" -#include "nsCalMultiUserViewCanvas.h" -#include "nsCalCommandCanvas.h" -#include "nsXPFCHTMLCanvas.h" -#include "nsICalendarShell.h" -#include "nsCalParserCIID.h" -#include "nsxpfcCIID.h" -#include "nsCalendarContainer.h" -#include "nsXPFCToolkit.h" -#include "nsIServiceManager.h" -#include "nsxpfcCIID.h" -#include "nsIXPFCObserverManager.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENT_SINK_IID); -static NS_DEFINE_IID(kClassIID, NS_CALXMLCONTENTSINK_IID); -static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); -static NS_DEFINE_IID(kCXPFCCanvasCID, NS_XPFC_CANVAS_CID); -static NS_DEFINE_IID(kCXPFCHTMLCanvasCID, NS_XPFC_HTML_CANVAS_CID); -static NS_DEFINE_IID(kIXMLParserObjectIID, NS_IXML_PARSER_OBJECT_IID); -static NS_DEFINE_IID(kCCalTimebarContextControllerCID, NS_CAL_TIMEBAR_CONTEXT_CONTROLLER_CID); -static NS_DEFINE_IID(kCCalMonthContextControllerCID, NS_CAL_MONTH_CONTEXT_CONTROLLER_CID); -static NS_DEFINE_IID(kCCalTodoComponentCanvasCID, NS_CAL_TODOCOMPONENTCANVAS_CID); -static NS_DEFINE_IID(kCCalMultiDayViewCanvasCID, NS_CAL_MULTIDAYVIEWCANVAS_CID); -static NS_DEFINE_IID(kCCalMultiUserViewCanvasCID, NS_CAL_MULTIUSERVIEWCANVAS_CID); -static NS_DEFINE_IID(kCalMonthViewCanvasCID, NS_CAL_MONTHVIEWCANVAS_CID); -static NS_DEFINE_IID(kCCalCommandCanvasCID, NS_CAL_COMMANDCANVAS_CID); -static NS_DEFINE_IID(kCalTimebarUserHeadingCID, NS_CAL_TIMEBARUSERHEADING_CID); -static NS_DEFINE_IID(kCalTimebarScaleCID, NS_CAL_TIMEBARSCALE_CID); -static NS_DEFINE_IID(kCalTodoComponentCanvasCID, NS_CAL_TODOCOMPONENTCANVAS_CID); -static NS_DEFINE_IID(kCalCommandCanvasCID, NS_CAL_COMMANDCANVAS_CID); -static NS_DEFINE_IID(kCalMultiDayViewCanvasCID, NS_CAL_MULTIDAYVIEWCANVAS_CID); -static NS_DEFINE_IID(kCalMultiUserViewCanvasCID, NS_CAL_MULTIUSERVIEWCANVAS_CID); -static NS_DEFINE_IID(kCalTimebarCanvasCID, NS_CAL_TIMEBARCANVAS_CID); - -static NS_DEFINE_IID(kCalContextcontrollerIID, NS_ICAL_CONTEXT_CONTROLLER_IID); -static NS_DEFINE_IID(kIXPFCXMLContentSinkIID, NS_IXPFC_XML_CONTENT_SINK_IID); -static NS_DEFINE_IID(kIXPFCContentSinkIID, NS_IXPFC_CONTENT_SINK_IID); -static NS_DEFINE_IID(kCXPFolderCanvas, NS_XP_FOLDER_CANVAS_CID); -static NS_DEFINE_IID(kCXPItem, NS_XP_ITEM_CID); - -static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); -static NS_DEFINE_IID(kIXPFCObserverManagerIID, NS_IXPFC_OBSERVERMANAGER_IID); - - -class ControlListEntry { -public: - nsIXMLParserObject * object; - nsString control; - - ControlListEntry(nsIXMLParserObject * aObject, - nsString aControl) { - object = aObject; - control = aControl; - } - ~ControlListEntry() { - } -}; - - -nsCalXMLContentSink::nsCalXMLContentSink() : nsIHTMLContentSink() -{ - mCalendarContainer = nsnull; - mControlList = nsnull; - - NS_INIT_REFCNT(); - - static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID); - - nsresult res = nsRepository::CreateInstance(kCVectorCID, - nsnull, - kCVectorCID, - (void **)&mTimeContextList); - - if (NS_OK != res) - return ; - - mTimeContextList->Init(); - - - res = nsRepository::CreateInstance(kCVectorCID, - nsnull, - kCVectorCID, - (void **)&mOrphanCanvasList); - - if (NS_OK != res) - return ; - - mOrphanCanvasList->Init(); - - static NS_DEFINE_IID(kCStackCID, NS_STACK_CID); - - res = nsRepository::CreateInstance(kCStackCID, - nsnull, - kCStackCID, - (void **)&mCanvasStack); - - if (NS_OK != res) - return ; - - mCanvasStack->Init(); - - if (mControlList == nsnull) { - - static NS_DEFINE_IID(kCVectorIteratorCID, NS_ARRAY_ITERATOR_CID); - static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID); - - nsresult res = nsRepository::CreateInstance(kCVectorCID, - nsnull, - kCVectorCID, - (void **)&mControlList); - - if (NS_OK != res) - return ; - - mControlList->Init(); - } - - -} - -nsCalXMLContentSink::~nsCalXMLContentSink() -{ - - if (mOrphanCanvasList != nsnull) - { - - nsIIterator * iterator; - - mOrphanCanvasList->CreateIterator(&iterator); - iterator->Init(); - - nsIXPFCCanvas * item; - - while(!(iterator->IsDone())) - { - item = (nsIXPFCCanvas *) iterator->CurrentItem(); - NS_RELEASE(item); - iterator->Next(); - } - NS_RELEASE(iterator); - - mOrphanCanvasList->RemoveAll(); - NS_RELEASE(mOrphanCanvasList); - } - - - NS_RELEASE(mTimeContextList); - NS_RELEASE(mCanvasStack); - - if (mControlList != nsnull) - { - - nsIIterator * iterator; - - mControlList->CreateIterator(&iterator); - iterator->Init(); - - ControlListEntry * item; - - while(!(iterator->IsDone())) - { - item = (ControlListEntry *) iterator->CurrentItem(); - delete item; - iterator->Next(); - } - NS_RELEASE(iterator); - - mControlList->RemoveAll(); - NS_RELEASE(mControlList); - } - -} - -NS_IMPL_ADDREF(nsCalXMLContentSink) -NS_IMPL_RELEASE(nsCalXMLContentSink) - - -nsresult nsCalXMLContentSink::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - - if(aIID.Equals(kISupportsIID)) { //do IUnknown... - *aInstancePtr = (nsIContentSink*)(this); - } - else if(aIID.Equals(kIContentSinkIID)) { //do nsIContentSink base class... - *aInstancePtr = (nsIContentSink*)(this); - } - else if(aIID.Equals(kIHTMLContentSinkIID)) { - *aInstancePtr = (nsIHTMLContentSink*)(this); - } - else if(aIID.Equals(kClassIID)) { //do this class... - *aInstancePtr = (nsCalXMLContentSink*)(this); - } - else if(aIID.Equals(kIXPFCXMLContentSinkIID)) { //do this class... - *aInstancePtr = (nsIXPFCXMLContentSink*)(this); - } - else if(aIID.Equals(kIXPFCContentSinkIID)) { //do this class... - *aInstancePtr = (nsIXPFCContentSink*)(this); - } - else { - *aInstancePtr=0; - return NS_NOINTERFACE; - } - ((nsISupports*) *aInstancePtr)->AddRef(); - return NS_OK; -} - - -NS_IMETHODIMP nsCalXMLContentSink::Init() -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::SetViewerContainer(nsIWebViewerContainer * aViewerContainer) -{ - mCalendarContainer = (nsCalendarContainer*)aViewerContainer; - - return NS_OK; -} - - -/* - * this method gets invoked whenever a container type tag - * is encountered. - */ - -NS_IMETHODIMP nsCalXMLContentSink::OpenContainer(const nsIParserNode& aNode) -{ - nsIXMLParserObject * object = nsnull; - eCalXMLTags tag = (eCalXMLTags) aNode.GetNodeType(); - nsresult res; - nsCID aclass; - - nsString text = aNode.GetText(); - - res = CIDFromTag(tag, aclass); - - if (NS_OK != res) - return res ; - - res = nsRepository::CreateInstance(aclass, - nsnull, - kIXMLParserObjectIID, - (void **)&object); - - if (NS_OK != res) - return res ; - - AddToHierarchy(*object, PR_TRUE); - - object->Init(); - - /* - * ConsumeAttributes - */ - - ConsumeAttributes(aNode,*object); - - /* - * If this was a root panel, add it to the widget - */ - - if (tag == eCalXMLTag_rootpanel) - { - nsIXPFCCanvas * child = (nsIXPFCCanvas *) mCanvasStack->Top(); - - /* - * this should never occur... - */ - - if (child == nsnull) - return NS_ERROR_UNEXPECTED; - - nsIXPFCCanvas * root ; - - gXPFCToolkit->GetRootCanvas(&root); - - root->AddChildCanvas(child); - - NS_RELEASE(root); - } - - NS_RELEASE(object); - - return NS_OK; -} - - -/* - * Consume the Attributes for this object - */ - -NS_IMETHODIMP nsCalXMLContentSink::ConsumeAttributes(const nsIParserNode& aNode, nsIXMLParserObject& aObject) -{ - PRInt32 i = 0; - nsString key,value; - nsString scontrol; - PRBool control = PR_FALSE; - - for (i = 0; i < aNode.GetAttributeCount(); i++) { - - key = aNode.GetKeyAt(i); - value = aNode.GetValueAt(i); - - key.StripChars("\""); - value.StripChars("\""); - - aObject.SetParameter(key,value); - - if (key.EqualsIgnoreCase(CAL_STRING_CONTROL)) - { - control = PR_TRUE; - scontrol = value; - } - - } - - /* - * If this object has something it wants to control, store away the string and source - * object. Later on, we'll walk the content tree Registering appropriate subjects - * and observers. - */ - - if (control == PR_TRUE) - mControlList->Append(new ControlListEntry(&aObject, scontrol)); - - return NS_OK; -} - - -NS_IMETHODIMP nsCalXMLContentSink::CloseContainer(const nsIParserNode& aNode) -{ - nsIXPFCCanvas * canvas = (nsIXPFCCanvas *)mCanvasStack->Pop(); - NS_IF_RELEASE(canvas); - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::AddToHierarchy(nsIXMLParserObject& aObject, PRBool aPush) -{ - /* - * Add as a child of current top node - */ - - nsIXPFCCanvas * canvas = nsnull; - - nsresult res = aObject.QueryInterface(kIXPFCCanvasIID,(void**)&canvas); - - if (NS_OK != res) - return res; - - nsIXPFCCanvas * parent = (nsIXPFCCanvas *) mCanvasStack->Top(); - - /* - * If we have no canvas on the stack, that means - * we do not yet know where this panel belongs, so - * add it to the free list. - */ - - if (parent == nsnull) { - - mOrphanCanvasList->Append(canvas); - NS_ADDREF(canvas); - - } else { - - parent->AddChildCanvas(canvas); - - } - - if (aPush == PR_TRUE) - { - mCanvasStack->Push(canvas); - NS_ADDREF(canvas); - } - - NS_RELEASE(canvas); - - return res; -} - -/* - * Find the CID from the XML Tag Object - */ - -NS_IMETHODIMP nsCalXMLContentSink::CIDFromTag(eCalXMLTags tag, nsCID &aClass) -{ - switch(tag) - { - case eCalXMLTag_tcc: - aClass = kCCalTimebarContextControllerCID; - break; - - case eCalXMLTag_mcc: - aClass = kCCalMonthContextControllerCID; - break; - - case eCalXMLTag_timebaruserheading: - aClass = kCalTimebarUserHeadingCID; - break; - - case eCalXMLTag_timebarscale: - aClass = kCalTimebarScaleCID; - break; - - case eCalXMLTag_todocanvas: - aClass = kCalTodoComponentCanvasCID; - break; - - case eCalXMLTag_commandcanvas: - aClass = kCalCommandCanvasCID; - break; - - case eCalXMLTag_multidayviewcanvas: - aClass = kCalMultiDayViewCanvasCID; - break; - - case eCalXMLTag_multiuserviewcanvas: - aClass = kCalMultiUserViewCanvasCID; - break; - - case eCalXMLTag_monthviewcanvas: - aClass = kCalMonthViewCanvasCID; - break; - - case eCalXMLTag_panel: - case eCalXMLTag_rootpanel: - aClass = kCXPFCCanvasCID; - break; - - case eCalXMLTag_htmlcanvas: - aClass = kCXPFCHTMLCanvasCID; - break; - - case eCalXMLTag_foldercanvas: - aClass = kCXPFolderCanvas; - break; - - case eCalXMLTag_xpitem: - aClass = kCXPItem; - break; - - default: - return (NS_ERROR_UNEXPECTED); - break; - } - - - return NS_OK; -} - -/* - * Add a Leaf XML Object - */ - - -NS_IMETHODIMP nsCalXMLContentSink::AddLeaf(const nsIParserNode& aNode) -{ - - static NS_DEFINE_IID(kCCalTimeContextCID, NS_CAL_TIME_CONTEXT_CID); - static NS_DEFINE_IID(kCCalTimeContextIID, NS_ICAL_TIME_CONTEXT_IID); - - nsIXMLParserObject * object = nsnull; - eCalXMLTags tag = (eCalXMLTags) aNode.GetNodeType(); - nsresult res; - nsCID aclass; - - nsString text = aNode.GetText(); - - res = CIDFromTag(tag, aclass); - - if (NS_OK != res) - { - /* - * Check to see if this is a control node - */ - - if (tag == eCalXMLTag_control) - AddControl(aNode); - else if (tag == eCalXMLTag_ctx) - AddCtx(aNode); - - return res ; - } - - res = nsRepository::CreateInstance(aclass, - nsnull, - kIXMLParserObjectIID, - (void **)&object); - - if (NS_OK != res) - return res ; - - AddToHierarchy(*object, PR_FALSE); - - object->Init(); - - ConsumeAttributes(aNode,*object); - - NS_RELEASE(object); - - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::AddCtx(const nsIParserNode& aNode) -{ - - static NS_DEFINE_IID(kCCalTimeContextCID, NS_CAL_TIME_CONTEXT_CID); - static NS_DEFINE_IID(kCCalTimeContextIID, NS_ICAL_TIME_CONTEXT_IID); - - nsICalTimeContext * context; - - nsresult res = nsRepository::CreateInstance(kCCalTimeContextCID, - nsnull, - kCCalTimeContextIID, - (void **)&context); - - if (NS_OK != res) - return res ; - - context->Init(); - - /* - * Apply this context all the way down. We should probably wait until - * parsing is completed before doing this OR slip the context into the - * base canvas class, which may be easier. - */ - nsIXPFCCanvas * root ; - - gXPFCToolkit->GetRootCanvas(&root); - - ApplyContext(root, context); - - NS_RELEASE(root); - NS_RELEASE(context); - - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::ApplyContext(nsIXPFCCanvas * aCanvas, nsICalTimeContext * aContext) -{ - - nsCalTimebarCanvas * time_canvas = nsnull; - nsIIterator * iterator = nsnull; - nsIXPFCCanvas * canvas = nsnull; - - nsresult res = aCanvas->QueryInterface(kCalTimebarCanvasCID,(void**)&time_canvas); - - if (res == NS_OK) - { - time_canvas->SetTimeContext(aContext); - - /* - * XXX: Should this be for all Multi Views? - * - * If this is a MultiView Canvas, stop here - */ - - static NS_DEFINE_IID(kCalMultiDayViewCanvasCID, NS_CAL_MULTIDAYVIEWCANVAS_CID); - nsCalMultiDayViewCanvas * multi; - nsresult res = time_canvas->QueryInterface(kCalMultiDayViewCanvasCID,(void**)&multi); - - if (res == NS_OK) - { - NS_RELEASE(multi); - NS_RELEASE(time_canvas); - return NS_OK; - } - - NS_RELEASE(time_canvas); - - } - - res = aCanvas->CreateIterator(&iterator); - - if (NS_OK != res) - return NS_OK; - - iterator->Init(); - - while(!(iterator->IsDone())) - { - canvas = (nsIXPFCCanvas *) iterator->CurrentItem(); - - ApplyContext(canvas, aContext); - - iterator->Next(); - } - - NS_RELEASE(iterator); - - return NS_OK; -} - -/* - * When we get a control, it usually means we point to a canvas in - * the free list and need to make that canvas a child of the canvas - * currently on top of the stack - */ - -NS_IMETHODIMP nsCalXMLContentSink::AddControl(const nsIParserNode& aNode) -{ - nsIXPFCCanvas * child = nsnull; - nsIXMLParserObject * object = nsnull; - nsIXPFCCanvas * parent = (nsIXPFCCanvas *) mCanvasStack->Top(); - - /* - * this should never occur... - */ - - if (parent == nsnull) - return NS_ERROR_UNEXPECTED; - - /* - * Find the rule for this control. It contains the name of the canvas to reparent - */ - - PRInt32 i = 0; - nsString key,value; - - for (i = 0; i < aNode.GetAttributeCount(); i++) - { - - key = aNode.GetKeyAt(i); - value = aNode.GetValueAt(i); - - key.StripChars("\""); - value.StripChars("\""); - - /* - * Search the free list for a canvas of this name. If it is there, just parent it. - * If it is not there, it means we are re-parenting and we should search the hierarchy - * to do that - */ - - if (key.EqualsIgnoreCase(CAL_STRING_RULE)) - { - - child = CanvasFromName(value); - - if (child == nsnull) - { - nsIXPFCCanvas * root ; - - gXPFCToolkit->GetRootCanvas(&root); - - child = root->CanvasFromName(value); - - NS_RELEASE(root); - } - - break; - } - - } - - if (child == nsnull) - return NS_ERROR_UNEXPECTED; - - /* - * We now have a parent and child. Let's Reparent and remove from free list - * if it is there - */ - - child->Reparent(parent); - - /* - * Pass certain attributes to the parent canvas (layout, weightminor, weighmajor, etc...) - */ - nsresult res = child->QueryInterface(kIXMLParserObjectIID,(void**)&object); - - if (NS_OK == res) - { - for (i = 0; i < aNode.GetAttributeCount(); i++) - { - - key = aNode.GetKeyAt(i); - value = aNode.GetValueAt(i); - - key.StripChars("\""); - value.StripChars("\""); - - if (key.EqualsIgnoreCase(CAL_STRING_LAYOUT) || key.EqualsIgnoreCase(CAL_STRING_WEIGHTMAJOR) || key.EqualsIgnoreCase(CAL_STRING_WEIGHTMINOR)) - object->SetParameter(key,value); - } - - NS_RELEASE(object); - } - - if (NS_OK == (mOrphanCanvasList->Remove(child))) - NS_RELEASE(child); - - return res; -} - -NS_IMETHODIMP nsCalXMLContentSink::PushMark() -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::OpenHTML(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::CloseHTML(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::OpenHead(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::CloseHead(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::SetTitle(const nsString& aValue) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::OpenBody(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::CloseBody(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::OpenForm(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::CloseForm(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::OpenMap(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::CloseMap(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::OpenFrameset(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::CloseFrameset(const nsIParserNode& aNode) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::WillBuildModel(void) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::DidBuildModel(PRInt32 aQualityLevel) -{ - static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); - static NS_DEFINE_IID(kXPFCObserverIID, NS_IXPFC_OBSERVER_IID); - - nsIXPFCCanvas * root ; - nsIXPFCCanvas * canvas ; - nsIXPFCCanvas * canvas2 ; - nsresult res; - - gXPFCToolkit->GetRootCanvas(&root); - - - /* - * first, register all appropriate controls that have been stored up - */ - - nsIIterator * iterator; - - mControlList->CreateIterator(&iterator); - - iterator->Init(); - - ControlListEntry * item ; - - nsICalContextController * context_controller; - nsIXPFCSubject * subject; - nsIXPFCSubject * subject2; - nsCalTimebarCanvas * timebar; - nsIXPFCObserver * observer; - nsIXPFCObserver * observer2; - nsICalTimeContext * context; - - - nsIXPFCObserverManager* om; - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - - while(!(iterator->IsDone())) - { - item = (ControlListEntry *) iterator->CurrentItem(); - - /* - * Ok, Here is how it works: - * - * 1) If this is a type of controller, we will register the object part as a subject - * and the string will reference a canvas which has a timecontext which will be our - * observer. Then, we register the timecontext as a observer and the controller as an - * subject. - * - * 2) If this is not a controller but is a canvas, we register them directly (context to controller) - */ - - res = item->object->QueryInterface(kCalContextcontrollerIID, (void**)&context_controller); - - /* - * Is this a controller - */ - - if (NS_OK == res) - { - res = context_controller->QueryInterface(kXPFCSubjectIID, (void **)&subject); - - if (res == NS_OK) - { - canvas = root->CanvasFromName(item->control); - - if (canvas != nsnull) - { - - res = canvas->QueryInterface(kCalTimebarCanvasCID, (void **)&timebar); - - if (res == NS_OK) - { - - context = timebar->GetTimeContext(); - - if (context != nsnull) - { - - /* - * first register controller with context - */ - - res = context->QueryInterface(kXPFCObserverIID, (void **)&observer); - - if (res == NS_OK) - { - om->Register(subject, observer); - - NS_RELEASE(observer); - } - - /* - * Now register context and target canvas - * - * What we want to do is register the canvas with the - * Model, not the TimeContext. Then, register the - * Model with the TimeContext. - * - * Need to figure how this will get affected on Change - * commands - */ - - nsIModel * model = timebar->GetModel(); - res = context->QueryInterface(kXPFCSubjectIID, (void **)&subject2); - - // Register the Model as Observer of Context - if ((nsnull != model) && (res == NS_OK)) - { - res = model->QueryInterface(kXPFCObserverIID, (void **)&observer2); - if (res == NS_OK) - { - om->Register(subject2, observer2); - NS_RELEASE(observer2); - } - NS_RELEASE(subject2); - - // Register the Canvas as Observer of Model - res = model->QueryInterface(kXPFCSubjectIID, (void **)&subject2); - if (res == NS_OK) - { - res = timebar->QueryInterface(kXPFCObserverIID, (void **)&observer2); - if (res == NS_OK) - { - om->Register(subject2, observer2); - NS_RELEASE(observer2); - } - NS_RELEASE(subject2); - } - - } - } - - NS_RELEASE(timebar); - } - - } - - NS_RELEASE(subject); - } - - NS_RELEASE(context_controller); - - } else { - - /* - * Is this a canvas instead. - * - * What we really want to do here is register the - * context with the Model and the Canvas with - * the model. - */ - - - res = item->object->QueryInterface(kIXPFCCanvasIID, (void**)&canvas); - - if (res == NS_OK) - { - - res = canvas->QueryInterface(kCalTimebarCanvasCID, (void **)&timebar); - - if (res == NS_OK) - { - - context = timebar->GetTimeContext(); - - if (context != nsnull) - { - - res = context->QueryInterface(kXPFCSubjectIID, (void **)&subject); - - if (res == NS_OK) - { - canvas2 = root->CanvasFromName(item->control); - - if (canvas2 != nsnull) - { - - res = canvas2->QueryInterface(kXPFCObserverIID, (void **)&observer); - - if (res == NS_OK) - { - nsIModel * model = canvas2->GetModel(); - - if (nsnull != model) - { - nsIXPFCSubject * msubject; - nsIXPFCObserver * mobserver; - res = model->QueryInterface(kXPFCObserverIID, (void **)&mobserver); - if (NS_OK == res) - { - om->Register(subject, mobserver); - NS_RELEASE(mobserver); - } - res = model->QueryInterface(kXPFCSubjectIID, (void **)&msubject); - if (NS_OK == res) - { - om->Register(msubject, observer); - NS_RELEASE(msubject); - } - } - NS_RELEASE(observer); - } - - } - - NS_RELEASE(subject); - } - - } - - NS_RELEASE(timebar); - - } - - - NS_RELEASE(canvas); - - } - - } - - iterator->Next(); - } - - NS_IF_RELEASE(iterator); - /* - * Layout the objects - */ - - root->Layout(); - - if (root->GetView()) - { - nsRect bounds; - root->GetView()->GetBounds(bounds); - gXPFCToolkit->GetViewManager()->UpdateView(root->GetView(), bounds, NS_VMREFRESH_AUTO_DOUBLE_BUFFER | NS_VMREFRESH_NO_SYNC); - } - - - NS_RELEASE(root); - - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - // XXX: Should we clean up everything here? - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::WillInterrupt(void) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalXMLContentSink::WillResume(void) -{ - return NS_OK; -} - - -nsIXPFCCanvas * nsCalXMLContentSink::CanvasFromName(nsString& aName) -{ - nsresult res ; - nsIIterator * iterator ; - nsIXPFCCanvas * canvas; - nsString child; - - // Iterate through the children - res = mOrphanCanvasList->CreateIterator(&iterator); - - if (NS_OK != res) - return nsnull; - - iterator->Init(); - - while(!(iterator->IsDone())) - { - canvas = (nsIXPFCCanvas *) iterator->CurrentItem(); - - child = canvas->GetNameID(); - - if (child == aName) { - NS_RELEASE(iterator); - return canvas; - } - - iterator->Next(); - } - - NS_RELEASE(iterator); - - return nsnull; -} -nsresult nsCalXMLContentSink::SetRootCanvas(nsIXPFCCanvas * aCanvas) -{ - mCanvasStack->Push(aCanvas); - NS_ADDREF(aCanvas); - return NS_OK; -} - -nsresult nsCalXMLContentSink::SetContentSinkContainer(nsISupports * - aContentSinkContainer) -{ - nsresult res; - nsIXPFCCanvas * canvas; - static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); - res = aContentSinkContainer->QueryInterface(kIXPFCCanvasIID, (void **)&canvas); - if (NS_OK == res) - { - res = SetRootCanvas(canvas); - NS_RELEASE(canvas); - } - return res; -} diff --git a/mozilla/calendar/modules/parser/calxml/src/nsCalXMLDTD.cpp b/mozilla/calendar/modules/parser/calxml/src/nsCalXMLDTD.cpp deleted file mode 100644 index a9364a5529b..00000000000 --- a/mozilla/calendar/modules/parser/calxml/src/nsCalXMLDTD.cpp +++ /dev/null @@ -1,406 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscalexport.h" -#include "nsCalXMLDTD.h" -#include "nsParser.h" -#include "nsParserNode.h" -#include "nsCalXMLContentSink.h" -#include "nsHTMLTokens.h" -#include "nsParserCIID.h" -#include "nsCRT.h" -#include "nsCalParserCIID.h" -#include "nsxpfcstrings.h" - - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID); -static NS_DEFINE_IID(kClassIID, NS_ICALXML_DTD_IID); -static NS_DEFINE_IID(kBaseClassIID, NS_INAVHTML_DTD_IID); - -static NS_DEFINE_IID(kCParserNodeCID, NS_PARSER_NODE_IID); -static NS_DEFINE_IID(kCParserNodeIID, NS_IPARSER_NODE_IID); - -static const char* kCalXMLTextContentType = "text/julian"; -static const char* kCalXMLDocHeader= "GetTokenType(); - nsCalXMLDTD* theDTD=(nsCalXMLDTD*)aDTD; - - nsString& name = aToken->GetStringValueXXX(); - eCalXMLTags type = DetermineCalXMLTagType(name); - - if (type != eCalXMLTag_userdefined) - aToken->SetTypeID(type); - - if(aDTD) { - switch(theType) { - case eToken_start: - result=theDTD->HandleStartToken(aToken); break; - case eToken_end: - result=theDTD->HandleEndToken(aToken); break; - case eToken_comment: - result=theDTD->HandleCommentToken(aToken); break; - case eToken_entity: - result=theDTD->HandleEntityToken(aToken); break; - case eToken_attribute: - result=theDTD->HandleAttributeToken(aToken); break; - default: - result=0; - }//switch - }//if - return result; -} - - -nsresult nsCalXMLDTD::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - - if(aIID.Equals(kISupportsIID)) { //do IUnknown... - *aInstancePtr = (nsIDTD*)(this); - } - else if(aIID.Equals(kBaseClassIID)) { //do nav dtd base class... - *aInstancePtr = (CNavDTD*)(this); - } - else if(aIID.Equals(kIDTDIID)) { //do IParser base class... - *aInstancePtr = (nsIDTD*)(this); - } - else if(aIID.Equals(kClassIID)) { //do this class... - *aInstancePtr = (nsCalXMLDTD*)(this); - } - else { - *aInstancePtr=0; - return NS_NOINTERFACE; - } - ((nsISupports*) *aInstancePtr)->AddRef(); - return NS_OK; -} - - -NS_IMPL_ADDREF(nsCalXMLDTD) -NS_IMPL_RELEASE(nsCalXMLDTD) - -nsCalXMLDTD::nsCalXMLDTD() : CNavDTD() -{ - NS_INIT_REFCNT(); -} - -nsCalXMLDTD::~nsCalXMLDTD() -{ -} - -PRBool nsCalXMLDTD::CanParse(nsString& aContentType, PRInt32 aVersion) -{ - if (aContentType == kCalXMLTextContentType) - return PR_TRUE; - - return PR_FALSE; -} - -eAutoDetectResult nsCalXMLDTD::AutoDetectContentType(nsString& aBuffer,nsString& aType) -{ - if ((aType == kCalXMLTextContentType) || (aBuffer.Find(kCalXMLDocHeader) != -1)) - { - aType = kCalXMLTextContentType; - return eValidDetect; - } - - return eUnknownDetect; -} - - -nsresult nsCalXMLDTD::HandleToken(CToken* aToken) -{ - nsresult result=NS_OK; - - if(aToken) { - - CHTMLToken* theToken= (CHTMLToken*)(aToken); - eHTMLTokenTypes theType=eHTMLTokenTypes(theToken->GetTokenType()); - - result=CalXMLDispatchTokenHandler(theToken,this); - - } - return result; - - //return CNavDTD::HandleToken(aToken); -} - - - -nsresult nsCalXMLDTD::CreateNewInstance(nsIDTD** aInstancePtrResult) -{ - static NS_DEFINE_IID(kCCalXMLDTD, NS_ICALXML_DTD_IID); - - nsresult result = nsRepository::CreateInstance(kCCalXMLDTD, - nsnull, - kIDTDIID, - (void**) aInstancePtrResult); - - return (result); -} - - -nsresult nsCalXMLDTD::HandleStartToken(CToken* aToken) -{ - CStartToken * st = (CStartToken*)aToken; - eCalXMLTags tokenTagType = (eCalXMLTags) st->GetTypeID(); - nsCParserNode * attrNode = nsnull; - - //Begin by gathering up attributes... - static NS_DEFINE_IID(kCParserNodeCID, NS_PARSER_NODE_IID); - static NS_DEFINE_IID(kCParserNodeIID, NS_IPARSER_NODE_IID); - - nsresult result = nsRepository::CreateInstance(kCParserNodeCID, nsnull, kCParserNodeIID,(void**) &attrNode); - - if (NS_OK != result) - return result; - - attrNode->Init((CHTMLToken*)aToken,mLineNumber); - - PRInt16 attrCount=aToken->GetAttributeCount(); - result=(0==attrCount) ? NS_OK : CollectAttributes(*attrNode,attrCount); - - if (tokenTagType == eCalXMLTag_object) { - tokenTagType = TagTypeFromObject(*attrNode); - st->SetTypeID(tokenTagType); - } - - if(NS_OK==result) { - - switch(tokenTagType) { - - case eCalXMLTag_calendar: - break; - - /* - * the Panel Tag represents the core container object for layout - */ - - case eCalXMLTag_object: - case eCalXMLTag_rootpanel: - case eCalXMLTag_panel: - case eCalXMLTag_foldercanvas: - { - mSink->OpenContainer(*attrNode); - } - break; - - case eCalXMLTag_mcc: - case eCalXMLTag_tcc: - case eCalXMLTag_ctx: - case eCalXMLTag_commandcanvas: - case eCalXMLTag_monthviewcanvas: - case eCalXMLTag_multidayviewcanvas: - case eCalXMLTag_timebarscale: - case eCalXMLTag_multiuserviewcanvas: - case eCalXMLTag_timebaruserheading: - case eCalXMLTag_todocanvas: - case eCalXMLTag_xpitem: - case eCalXMLTag_htmlcanvas: - { - mSink->AddLeaf(*attrNode); - } - break; - - case eCalXMLTag_control: - { - mSink->AddLeaf(*attrNode); - } - break; - - case eCalXMLTag_set: - break; - - default: - break; - } - } - - NS_RELEASE(attrNode); - - if(eHTMLTag_newline==tokenTagType) - mLineNumber++; - - return result; -} - -nsresult nsCalXMLDTD::HandleEndToken(CToken* aToken) -{ - - nsresult result=NS_OK; - CEndToken* et = (CEndToken*)(aToken); - eCalXMLTags tokenTagType=(eCalXMLTags)et->GetTypeID(); - nsCParserNode * attrNode = nsnull; - - static NS_DEFINE_IID(kCParserNodeCID, NS_PARSER_NODE_IID); - static NS_DEFINE_IID(kCParserNodeIID, NS_IPARSER_NODE_IID); - - result = nsRepository::CreateInstance(kCParserNodeCID, nsnull, kCParserNodeIID, (void**)&attrNode); - - if (NS_OK != result) - return result; - - attrNode->Init((CHTMLToken*)aToken,mLineNumber); - - if (tokenTagType == eCalXMLTag_object) { - tokenTagType = TagTypeFromObject(*attrNode); - et->SetTypeID(tokenTagType); - } - - switch(tokenTagType) { - - case eCalXMLTag_calendar: - - case eCalXMLTag_object: - case eCalXMLTag_panel: - case eCalXMLTag_rootpanel: - case eCalXMLTag_foldercanvas: - { - mSink->CloseContainer(*attrNode); - } - break; - - case eCalXMLTag_tcc: - case eCalXMLTag_mcc: - case eCalXMLTag_ctx: - case eCalXMLTag_commandcanvas: - case eCalXMLTag_monthviewcanvas: - case eCalXMLTag_multidayviewcanvas: - case eCalXMLTag_multiuserviewcanvas: - case eCalXMLTag_timebarscale: - case eCalXMLTag_timebaruserheading: - case eCalXMLTag_todocanvas: - case eCalXMLTag_htmlcanvas: - case eCalXMLTag_control: - case eCalXMLTag_xpitem: - break; - - case eCalXMLTag_set: - break; - - - default: - break; - } - - NS_RELEASE(attrNode); - - return result; -} - -eCalXMLTags nsCalXMLDTD::TagTypeFromObject(const nsIParserNode& aNode) -{ - PRInt32 i = 0; - - for (i = 0; i < aNode.GetAttributeCount(); i++) { - - nsString key = aNode.GetKeyAt(i); - - key.StripChars("\""); - - if (key.EqualsIgnoreCase(CAL_STRING_CLASS)) { - - nsString value = aNode.GetValueAt(i); - - value.StripChars("\""); - - if (value.EqualsIgnoreCase(CAL_STRING_TIMEBAR_USER_HEADING)) - return eCalXMLTag_timebaruserheading; - if (value.EqualsIgnoreCase(XPFC_STRING_HTML_CANVAS)) - return eCalXMLTag_htmlcanvas; - if (value.EqualsIgnoreCase(XPFC_STRING_FOLDER_CANVAS)) - return eCalXMLTag_foldercanvas; - if (value.EqualsIgnoreCase(XPFC_STRING_XPITEM)) - return eCalXMLTag_xpitem; - } - - } - - return (eCalXMLTag_unknown); - -} \ No newline at end of file diff --git a/mozilla/calendar/modules/parser/config.mk b/mozilla/calendar/modules/parser/config.mk deleted file mode 100644 index 80d6c5a0367..00000000000 --- a/mozilla/calendar/modules/parser/config.mk +++ /dev/null @@ -1,35 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR - -LD_LIBS += \ - raptorbase \ - $(NATIVE_RAPTOR_GFX) \ - raptorhtmlpars \ - xpcom$(MOZ_BITS) \ - $(NATIVE_LIBNLS_LIBS) \ - $(NATIVE_RAPTOR_WIDGET) \ - xpcom$(MOZ_BITS) \ - xpfc10 \ - $(XP_REG_LIB) - -AR_LIBS += \ - core \ - calxml \ - $(NULL) - -EXTRA_LIBS += $(NSPR_LIBS) - diff --git a/mozilla/calendar/modules/parser/core/Makefile b/mozilla/calendar/modules/parser/core/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/parser/core/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/parser/core/inc/Makefile b/mozilla/calendar/modules/parser/core/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/parser/core/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/parser/core/inc/manifest.mn b/mozilla/calendar/modules/parser/core/inc/manifest.mn deleted file mode 100644 index 9eb771f2a88..00000000000 --- a/mozilla/calendar/modules/parser/core/inc/manifest.mn +++ /dev/null @@ -1,21 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - nsCalParserCIID.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/parser/core/inc/nsCalParserCIID.h b/mozilla/calendar/modules/parser/core/inc/nsCalParserCIID.h deleted file mode 100644 index bd6c2d223b4..00000000000 --- a/mozilla/calendar/modules/parser/core/inc/nsCalParserCIID.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalParserCIID_h__ -#define nsCalParserCIID_h__ - -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsRepository.h" - -// 13b04870-1ab1-11d2-9246-00805f8a7ab6 -#define NS_ICALXML_DTD_IID \ -{ 0x13b04870, 0x1ab1, 0x11d2, \ - {0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } - -// 610f34d0-1ab1-11d2-9246-00805f8a7ab6 -#define NS_CALXMLCONTENTSINK_IID \ -{ 0x610f34d0, 0x1ab1, 0x11d2, \ - {0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } - - -#endif diff --git a/mozilla/calendar/modules/parser/core/manifest.mn b/mozilla/calendar/modules/parser/core/manifest.mn deleted file mode 100644 index 364aaa1bd7f..00000000000 --- a/mozilla/calendar/modules/parser/core/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/parser/core/public/Makefile b/mozilla/calendar/modules/parser/core/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/parser/core/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/parser/core/public/manifest.mn b/mozilla/calendar/modules/parser/core/public/manifest.mn deleted file mode 100644 index f2b2c4e3d89..00000000000 --- a/mozilla/calendar/modules/parser/core/public/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -EXPORTS = \ - nsIXMLParserObject.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = xpfc - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/parser/core/public/nsIXMLParserObject.h b/mozilla/calendar/modules/parser/core/public/nsIXMLParserObject.h deleted file mode 100644 index e5c071a4de6..00000000000 --- a/mozilla/calendar/modules/parser/core/public/nsIXMLParserObject.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsIXMLParserObject_h___ -#define nsIXMLParserObject_h___ - -#include "nsISupports.h" -#include "nsString.h" - -//4afe0210-273d-11d2-9246-00805f8a7ab6 -#define NS_IXML_PARSER_OBJECT_IID \ -{ 0x4afe0210, 0x273d, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -class nsIXMLParserObject : public nsISupports -{ - -public: - - NS_IMETHOD Init() = 0; - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) = 0; - -}; - -#endif /* nsIXMLParserObject_h___ */ diff --git a/mozilla/calendar/modules/parser/core/src/Makefile b/mozilla/calendar/modules/parser/core/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/parser/core/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/parser/core/src/config.mk b/mozilla/calendar/modules/parser/core/src/config.mk deleted file mode 100644 index 817ecc45be3..00000000000 --- a/mozilla/calendar/modules/parser/core/src/config.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include - -LIBRARY_NAME = core -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) - diff --git a/mozilla/calendar/modules/parser/core/src/manifest.mn b/mozilla/calendar/modules/parser/core/src/manifest.mn deleted file mode 100644 index 9277df2137a..00000000000 --- a/mozilla/calendar/modules/parser/core/src/manifest.mn +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalParserFactory.cpp \ - $(NULL) - -REQUIRES = shell xpcom raptor trex julian nls netlib xpfc - diff --git a/mozilla/calendar/modules/parser/core/src/nsCalParserFactory.cpp b/mozilla/calendar/modules/parser/core/src/nsCalParserFactory.cpp deleted file mode 100644 index 221d182b247..00000000000 --- a/mozilla/calendar/modules/parser/core/src/nsCalParserFactory.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsIFactory.h" -#include "nsISupports.h" -#include "nsCalParserCIID.h" - -#include "nsCalXMLDTD.h" -#include "nsCalXMLContentSink.h" - -static NS_DEFINE_IID(kCCalXMLDTD, NS_ICALXML_DTD_IID); -static NS_DEFINE_IID(kCCalXMLContentSink, NS_CALXMLCONTENTSINK_IID); - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); - - -class nsCalParserFactory : public nsIFactory -{ - public: - // nsISupports methods - NS_IMETHOD QueryInterface(const nsIID &aIID, - void **aResult); - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - // nsIFactory methods - NS_IMETHOD CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult); - - NS_IMETHOD LockFactory(PRBool aLock); - - nsCalParserFactory(const nsCID &aClass); - ~nsCalParserFactory(); - - private: - nsrefcnt mRefCnt; - nsCID mClassID; -}; - -nsCalParserFactory::nsCalParserFactory(const nsCID &aClass) -{ - mRefCnt = 0; - mClassID = aClass; -} - -nsCalParserFactory::~nsCalParserFactory() -{ - NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); -} - -nsresult nsCalParserFactory::QueryInterface(const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - // Always NULL result, in case of failure - *aResult = NULL; - - 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; -} - -nsrefcnt nsCalParserFactory::AddRef() -{ - return ++mRefCnt; -} - -nsrefcnt nsCalParserFactory::Release() -{ - if (--mRefCnt == 0) { - delete this; - return 0; // Don't access mRefCnt after deleting! - } - return mRefCnt; -} - -nsresult nsCalParserFactory::CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - *aResult = NULL; - - nsISupports *inst = nsnull; - - if (mClassID.Equals(kCCalXMLDTD)) { - inst = (nsISupports *)new nsCalXMLDTD(); - } else if (mClassID.Equals(kCCalXMLContentSink)) { - inst = (nsISupports *)(nsIXPFCXMLContentSink *)new nsCalXMLContentSink(); - } - - if (inst == NULL) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult res = inst->QueryInterface(aIID, aResult); - - if (res != NS_OK) { - // We didn't get the right interface, so clean up - delete inst; - } - - return res; -} - -nsresult nsCalParserFactory::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; - } - - *aFactory = new nsCalParserFactory(aClass); - - if (nsnull == aFactory) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); -} - diff --git a/mozilla/calendar/modules/parser/ical/Makefile b/mozilla/calendar/modules/parser/ical/Makefile deleted file mode 100644 index e33ca9a48cb..00000000000 --- a/mozilla/calendar/modules/parser/ical/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/parser/ical/inc/Makefile b/mozilla/calendar/modules/parser/ical/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/parser/ical/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/parser/ical/inc/manifest.mn b/mozilla/calendar/modules/parser/ical/inc/manifest.mn deleted file mode 100644 index 2338e489943..00000000000 --- a/mozilla/calendar/modules/parser/ical/inc/manifest.mn +++ /dev/null @@ -1,29 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsCalICalendarTags.h \ - nsCalICalendarTokens.h \ - nscalicalendarpars.h \ - nsCalICalendarDTD.h \ - nsCalICalendarContentSink.h \ - nsCalICalendarParserNode.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor - - - diff --git a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarContentSink.h b/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarContentSink.h deleted file mode 100644 index d26be6e0233..00000000000 --- a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarContentSink.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef NS_CALICALENDARCONTENTSINK -#define NS_CALICALENDARCONTENTSINK - -#include "nsIParserNode.h" -#include "nsIContentSink.h" -#include "nsString.h" -#include "nsxpfcCIID.h" -#include "nsIArray.h" -#include "nsIIterator.h" -#include "nsIStack.h" -#include "nsCalICalendarDTD.h" -#include "nsICalICalendarParserObject.h" -#include "nsICalICalendarContentSink.h" -#include "nsIXPFCICalContentSink.h" -#include "nsIXPFCContentSink.h" -//#include "nsCalICalendarParserCIID.h" - -class nsCalICalendarContentSink : public nsICalICalendarContentSink, - public nsIXPFCICalContentSink, - public nsIXPFCContentSink, - public nsIContentSink -{ -public: - - NS_DECL_ISUPPORTS - - nsCalICalendarContentSink(); - virtual ~nsCalICalendarContentSink(); - - //nsICalICalendarContentSink - NS_IMETHOD Init(); - /*NS_IMETHOD SetViewerContainer(nsIWebViewerContainer * aViewerContainer);*/ - - //nsIContentSink - NS_IMETHOD OpenContainer(const nsIParserNode& aNode); - NS_IMETHOD CloseContainer(const nsIParserNode& aNode); - NS_IMETHOD AddLeaf(const nsIParserNode& aNode); - NS_IMETHOD WillBuildModel(void); - NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel); - NS_IMETHOD WillInterrupt(void); - NS_IMETHOD WillResume(void); - -private: - NS_IMETHOD CIDFromTag(eCalICalendarTags tag, nsCID &aClass); - NS_IMETHOD ConsumeAttributes(const nsIParserNode& aNode, nsICalICalendarParserObject& aObject); - NS_IMETHOD AddToHierarchy(nsICalICalendarParserObject& aObject, PRBool aPush); - -public: - NS_IMETHOD_(PRBool) IsContainer(const nsIParserNode& aNode); - - NS_IMETHOD SetViewerContainer(nsIWebViewerContainer * aViewerContainer); - NS_IMETHOD SetContentSinkContainer(nsISupports * aContentSinkContainer); - NS_IMETHOD SetCalendarList(nsIArray * aCalendarList); - - -private: - nsIWebViewerContainer * mViewerContainer ; - nsIStack * mXPFCStack; - nsIArray * mOrphanMenuList; - nsIArray * mContainerList ; - PRUint32 mState; - - nsIArray * mCalendarList; -}; - - -#endif - - diff --git a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarDTD.h b/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarDTD.h deleted file mode 100644 index 350645af9e8..00000000000 --- a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarDTD.h +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef NS_CALICALENDARDTD__ -#define NS_CALICALENDARDTD__ - -#include "nscalexport.h" -#include "CNavDTD.h" -#include "nscalstrings.h" -#include "nsxpfc.h" -#include "nsIDTD.h" -#include "nsISupports.h" -#include "nsIParser.h" -#include "nsCalICalendarTags.h" -#include "nsCalICalendarTokens.h" -#include "nscalicalendarpars.h" -#include "nsVoidArray.h" -#include "nsDeque.h" -#include "nsCalICalendarParserNode.h" -//#include "nsCalICalendarParserCIID.h" -//#include "nsCalICalendarStrings.h" // todo: - -class nsIHTMLContentSink; -class nsIDTDDebug; -class nsIParserNode; -class nsCParserNode; -class CITokenHandler; -class nsParser; -class nsDTDContext; -class nsTagStack; -class CScanner; -/* -enum eCalICalendarComponents -{ - eCalICalendarComponents_vcalendar = 0, - eCalICalendarComponents_vevent, - eCalICalendarComponents_vtodo, - eCalICalendarComponents_vjournal, - eCalICalendarComponents_vfreebusy, - eCalICalendarComponents_valarm, - eCalICalendarComponents_vtimezone -}; - -enum eCalICalendarProperties -{ - eCalICalendarProperties_attach = 0, - // todo: finish -}; -*/ - -class nsCalICalendarDTD : public nsIDTD { - -public: - - NS_DECL_ISUPPORTS - - nsCalICalendarDTD(); - virtual ~nsCalICalendarDTD(); - - //nsIDID - virtual PRBool CanParse(nsString& aContentType, PRInt32 aVersion); - virtual eAutoDetectResult AutoDetectContentType(nsString& aBuffer,nsString& aType); - NS_IMETHOD HandleToken(CToken* aToken); - virtual nsresult CreateNewInstance(nsIDTD** aInstancePtrResult); - - nsresult HandleBeginToken(CToken* aToken); - nsresult HandleEndToken(CToken* aToken); - nsresult HandleAttributeToken(CToken* aToken); - nsresult HandlePropertyValueToken(CToken* aToken); - - - //more nsIDID - virtual void SetParser(nsIParser* aParser); - virtual nsIContentSink* SetContentSink(nsIContentSink* aSink); - NS_IMETHOD WillBuildModel(nsString& aFilename,PRBool aNotifySink); - NS_IMETHOD DidBuildModel(PRInt32 anErrorCode,PRBool aNotifySink); - NS_IMETHOD ConsumeToken(CToken*& aToken); - NS_IMETHOD WillResumeParse(void); - NS_IMETHOD WillInterruptParse(void); - virtual PRBool CanContain(PRInt32 aParent,PRInt32 aChild) const; - virtual PRBool IsContainer(PRInt32 aTag) const; - virtual PRBool Verify(nsString& aURLRef); - virtual nsITokenRecycler* GetTokenRecycler(void); - - /*nsresult ConsumeBeginTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken); - nsresult ConsumeEndTag(PRUnichar aChar,CScanner& aScanner,CToken*& aToken); - */ - nsresult ConsumeNewline(PRUnichar aChar,CScanner& aScanner,CToken*& aToken); - nsresult ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken); - nsresult ConsumePropertyLine(PRUnichar aChar,CScanner& aScanner,CToken*& aToken); - nsresult ConsumePropertyNameAndAttributes(PRUnichar aChar,CScanner& aScanner,CToken*& aToken); - nsresult ConsumePropertyValue(PRUnichar aChar,CScanner& aScanner,CToken*& aToken); - - nsresult ConsumeAttributes(PRUnichar aChar, CScanner& aScanner, - CCalICalendarBeginToken* aToken); -private: - //NS_IMETHOD_(eCalICalendarTags) ComponentTypeFromObject(const nsIParserNode& aNode); - -protected: - PRInt32 CollectPropertyValue(nsCalICalendarCParserNode& aNode, PRInt32 aCount); - PRInt32 CollectAttributes(nsCalICalendarCParserNode& aNode, PRInt32 aCount); - - nsParser* mParser; - nsIContentSink* mSink; - //CITokenHandler* mTokenHandlers[eToken_last]; - //nsDTDContext* mContext; - nsDeque mTokenDeque; - nsString mFilename; - nsIDTDDebug* mDTDDebug; - PRInt32 mLineNumber; - eParseMode mParseMode; -}; - -extern NS_CALICALENDARPARS nsresult NS_NewICAL_DTD(nsIDTD** aInstancePtrResult); - -#endif - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarParserCIID.h b/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarParserCIID.h deleted file mode 100644 index 067b2e43eae..00000000000 --- a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarParserCIID.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalParserCIID_h__ -#define nsCalParserCIID_h__ - -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsRepository.h" - -// 4d17a720-5a4d-11d2-9432-006008268c31 -/* -#define NS_ICALICALENDAR_DTD_IID \ -{ 0x4d17a720, 0x5a4d, 0x11d2, \ - {0x94, 0x32, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } - -// 7b944f60-5a4d-11d2-9432-006008268c31 -#define NS_CALICALENDARCONTENTSINK_IID \ -{ 0x7b944f60, 0x5a4d, 0x11d2, \ - {0x94, 0x32, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } -*/ -//6758a720-6522-11d2-943c-006008268c31 -#define NS_CALICALENDARPARSER_NODE_IID \ -{ 0x6758a720, 0x6522, 0x11d2 \ - {0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} } -#endif - - - - - - - - diff --git a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarParserNode.h b/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarParserNode.h deleted file mode 100644 index 3f0dd4d3b55..00000000000 --- a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarParserNode.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef NS_CALICALENDARPARSERNODE__ -#define NS_CALICALENDARPARSERNODE__ - -#include "nsIParserNode.h" -#include "nsCalICalendarTokens.h" -#include "nsString.h" -#include "nsParserCIID.h" -#include "nsCalParserCIID.h" - - -class nsCalICalendarCParserNode : public nsIParserNode { - enum {eMaxAttr=20}; - - public: - - NS_DECL_ISUPPORTS - - /** - * Default constructor - * @update gess5/11/98 - * @param aToken is the token this node "refers" to - */ - nsCalICalendarCParserNode(CCalICalendarToken* aToken=nsnull,PRInt32 aLineNumber=1); - - /** - * Destructor - * @update gess5/11/98 - */ - virtual ~nsCalICalendarCParserNode(); - - /** - * Init - * @update gess5/11/98 - */ - virtual nsresult Init(CCalICalendarToken* aToken=nsnull,PRInt32 aLineNumber=1); - - /** - * Retrieve the name of the node - * @update gess5/11/98 - * @return string containing node name - */ - virtual const nsString& GetName() const; - - /** - * Retrieve the text from the given node - * @update gess5/11/98 - * @return string containing node text - */ - virtual const nsString& GetText() const; - - /** - * Retrieve skipped context from node - * @update gess5/11/98 - * @return string containing skipped content - */ - virtual const nsString& GetSkippedContent() const; - - /** - * Retrieve the type of the parser node. - * @update gess5/11/98 - * @return node type. - */ - virtual PRInt32 GetNodeType() const; - - /** - * Retrieve token type of parser node - * @update gess5/11/98 - * @return token type - */ - virtual PRInt32 GetTokenType() const; - - //*************************************** - //methods for accessing key/value pairs - //*************************************** - - /** - * Retrieve the number of attributes in this node. - * @update gess5/11/98 - * @return count of attributes (may be 0) - */ - virtual PRInt32 GetAttributeCount(PRBool askToken=PR_FALSE) const; - - /** - * Retrieve the key (of key/value pair) at given index - * @update gess5/11/98 - * @param anIndex is the index of the key you want - * @return string containing key. - */ - virtual const nsString& GetKeyAt(PRInt32 anIndex) const; - - /** - * Retrieve the value (of key/value pair) at given index - * @update gess5/11/98 - * @param anIndex is the index of the value you want - * @return string containing value. - */ - virtual const nsString& GetValueAt(PRInt32 anIndex) const; - - /** - * NOTE: When the node is an entity, this will translate the entity - * to it's unicode value, and store it in aString. - * @update gess5/11/98 - * @param aString will contain the resulting unicode string value - * @return int (unicode char or unicode index from table) - */ - - virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const; - - /** - * - * @update gess5/11/98 - * @param - * @return - */ - virtual void AddAttribute(CCalICalendarToken* aToken); - - /** - * - * @update gess5/11/98 - * @param - * @return - */ - virtual void SetSkippedContent(CCalICalendarToken* aToken); - - /** - * This getter retrieves the line number from the input source where - * the token occured. Lines are interpreted as occuring between \n characters. - * @update gess7/24/98 - * @return int containing the line number the token was found on - */ - virtual PRInt32 GetSourceLineNumber(void) const; - - protected: - PRInt32 mAttributeCount; - PRInt32 mLineNumber; - CCalICalendarToken* mToken; - CCalICalendarToken* mAttributes[eMaxAttr]; // XXX Ack! This needs to be dynamic! - CCalICalendarToken* mSkippedContent; - // nsAutoString mName; - - static const nsAutoString mEmptyString; - -}; - -#endif - - diff --git a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarTags.h b/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarTags.h deleted file mode 100644 index 110da9fcb89..00000000000 --- a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarTags.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- 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.1 (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. - * - * Contributor(s): - */ - -/* Do not edit - generated by gentags.pl */ -#ifndef nsCalICalendarTags_h___ -#define nsCalICalendarTags_h___ -#include "nscalicalendarpars.h" -enum nsCalICalendarTag { - /* this enum must be first and must be zero */ - eCalICalendarTag_unknown=0, - - /* begin tag enums */ - eCalICalendarTag_action=1, eCalICalendarTag_attach=2, - eCalICalendarTag_attendee=3, eCalICalendarTag_begin=4, - eCalICalendarTag_calscale=5, eCalICalendarTag_categories=6, - eCalICalendarTag_class=7, eCalICalendarTag_comment=8, - eCalICalendarTag_completed=9, eCalICalendarTag_contact=10, - eCalICalendarTag_created=11, eCalICalendarTag_daylight=12, - eCalICalendarTag_description=13, eCalICalendarTag_dtend=14, - eCalICalendarTag_dtstamp=15, eCalICalendarTag_dtstart=16, - eCalICalendarTag_due=17, eCalICalendarTag_duration=18, - eCalICalendarTag_end=19, eCalICalendarTag_exdate=20, - eCalICalendarTag_exrule=21, eCalICalendarTag_freebusy=22, - eCalICalendarTag_geo=23, eCalICalendarTag_last_modified=24, - eCalICalendarTag_location=25, eCalICalendarTag_method=26, - eCalICalendarTag_organizer=27, eCalICalendarTag_percent_complete=28, - eCalICalendarTag_priority=29, eCalICalendarTag_prodid=30, - eCalICalendarTag_rdate=31, eCalICalendarTag_recurrence_id=32, - eCalICalendarTag_related_to=33, eCalICalendarTag_repeat=34, - eCalICalendarTag_request_status=35, eCalICalendarTag_resources=36, - eCalICalendarTag_rrule=37, eCalICalendarTag_sequence=38, - eCalICalendarTag_standard=39, eCalICalendarTag_status=40, - eCalICalendarTag_summary=41, eCalICalendarTag_transp=42, - eCalICalendarTag_trigger=43, eCalICalendarTag_tzid=44, - eCalICalendarTag_tzname=45, eCalICalendarTag_tzoffsetfrom=46, - eCalICalendarTag_tzoffsetto=47, eCalICalendarTag_tzurl=48, - eCalICalendarTag_uid=49, eCalICalendarTag_url=50, - eCalICalendarTag_valarm=51, eCalICalendarTag_vcalendar=52, - eCalICalendarTag_version=53, eCalICalendarTag_vevent=54, - eCalICalendarTag_vfreebusy=55, eCalICalendarTag_vjournal=56, - eCalICalendarTag_vtimezone=57, eCalICalendarTag_vtodo=58, - - /* The remaining enums are not for tags */ - eCalICalendarTag_text=59, eCalICalendarTag_whitespace=60, - eCalICalendarTag_newline=61, eCalICalendarTag_entity=62, - eCalICalendarTag_userdefined=63 -}; -#define NS_CALICALENDAR_TAG_MAX 58 - -extern NS_CALICALENDARPARS nsCalICalendarTag NS_CalICalendarTagToEnum(const char* aTag); -extern NS_CALICALENDARPARS const char* NS_CalICalendarEnumToTag(nsCalICalendarTag aEnum); - -#endif /* nsCalICalendarTags_h___ */ diff --git a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarTokens.h b/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarTokens.h deleted file mode 100644 index 145722dda3c..00000000000 --- a/mozilla/calendar/modules/parser/ical/inc/nsCalICalendarTokens.h +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef CALICALENDARTOKENS_H_ -#define CALICALENDARTOKENS_H_ - -#include "nsToken.h" -#include "nsCalICalendarTags.h" -#include - -const PRUint32 kSemiColon = ';'; -const PRUint32 kColon = ':'; -const PRUint32 kNewline = '\n'; -const PRUint32 kCarriageReturn = '\r'; -class CScanner; -class CToken; - -enum eCalICalendarTokenTypes { - eCalICalendarToken_unknown = 0, - eCalICalendarToken_begin=1, - eCalICalendarToken_end, - eCalICalendarToken_whitespace, - eCalICalendarToken_newline, - eCalICalendarToken_text, - eCalICalendarToken_attribute, - eCalICalendarToken_propertyvalue, - eCalICalendarToken_propertyname, - eCalICalendarToken_identifier, - eCalICalendarToken_last // make sure this stays the last token... -}; - -#define eCalICalendarTags nsCalICalendarTag - -PRInt32 CalICalendarConsumeQuotedString(PRUnichar aChar,nsString& aString,CScanner& aScanner); -PRInt32 CalICalendarConsumeAttributeText(PRUnichar aChar,nsString& aString,CScanner& aScanner); -const char * CalICalendarGetTagName(PRInt32 aTag); - -class CCalICalendarToken: public CToken { -public: - - CCalICalendarToken(eCalICalendarTags aTag); - CCalICalendarToken(const nsString& aString,eCalICalendarTags aTag=eCalICalendarTag_unknown); - virtual void SetStringValue(const char* name); - -protected: -}; - -class CCalICalendarIdentifierToken: public CCalICalendarToken { -public: - CCalICalendarIdentifierToken(eCalICalendarTags aTag); - CCalICalendarIdentifierToken(const nsString& aString,eCalICalendarTags aTag=eCalICalendarTag_unknown); - - virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner); - virtual PRInt32 GetTypeID(void); - virtual const char* GetClassName(void); - virtual PRInt32 GetTokenType(void); - virtual void DebugDumpSource(ostream& out); -}; - -class CCalICalendarPropertyValueToken: public CCalICalendarToken { -public: - CCalICalendarPropertyValueToken(); - CCalICalendarPropertyValueToken(eCalICalendarTags aTag); - CCalICalendarPropertyValueToken(const nsString& aString,eCalICalendarTags aTag=eCalICalendarTag_unknown); - - virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner); - virtual PRInt32 GetTypeID(void); - virtual const char* GetClassName(void); - virtual PRInt32 GetTokenType(void); - virtual void DebugDumpSource(ostream& out); -}; - -class CCalICalendarBeginToken: public CCalICalendarToken { -public: - - CCalICalendarBeginToken(eCalICalendarTags aTag); - CCalICalendarBeginToken(const nsString& aName, eCalICalendarTags aTag=eCalICalendarTag_unknown); - virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner); - virtual PRInt32 GetTypeID(void); - virtual const char* GetClassName(void); - virtual PRInt32 GetTokenType(void); - - PRBool IsAttributed(void); - void SetAttributed(PRBool aValue); - PRBool IsEmpty(void); - void SetEmpty(PRBool aValue); - virtual void DebugDumpSource(ostream& out); - virtual void Reinitialize(PRInt32 aTag, const nsString& aString); - -protected: - PRBool mAttributed; - PRBool mEmpty; -}; - -class CCalICalendarEndToken: public CCalICalendarToken { -public: - CCalICalendarEndToken(eCalICalendarTags aTag); - CCalICalendarEndToken(const nsString& aString, eCalICalendarTags aTag=eCalICalendarTag_unknown); - virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner); - virtual PRInt32 GetTypeID(void); - virtual const char* GetClassName(void); - virtual PRInt32 GetTokenType(void); - virtual void DebugDumpSource(ostream& out); -}; - -class CCalICalendarWhitespaceToken: public CCalICalendarToken { -public: - CCalICalendarWhitespaceToken(); - CCalICalendarWhitespaceToken(const nsString& aString); - virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner); - virtual const char* GetClassName(void); - virtual PRInt32 GetTokenType(void); -}; - -class CCalICalendarTextToken: public CCalICalendarToken { -public: - CCalICalendarTextToken(); - CCalICalendarTextToken(const nsString& aString); - virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner); - virtual const char* GetClassName(void); - virtual PRInt32 GetTokenType(void); -}; - -class CCalICalendarAttributeToken: public CCalICalendarToken { - public: - CCalICalendarAttributeToken(); - CCalICalendarAttributeToken(const nsString& aString); - CCalICalendarAttributeToken(const nsString& aKey, const nsString& aString); - virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner); - virtual const char* GetClassName(void); - virtual PRInt32 GetTokenType(void); - virtual nsString& GetKey(void) {return mTextKey;} - virtual void DebugDumpToken(ostream& out); - virtual void DebugDumpSource(ostream& out); - PRBool mLastAttribute; - virtual void Reinitialize(PRInt32 aTag, const nsString& aString); - - protected: - nsString mTextKey; -}; - -class CCalICalendarNewlineToken: public CCalICalendarToken { - public: - CCalICalendarNewlineToken(); - CCalICalendarNewlineToken(const nsString& aString); - virtual nsresult Consume(PRUnichar aChar,CScanner& aScanner); - virtual const char* GetClassName(void); - virtual PRInt32 GetTokenType(void); - virtual nsString& GetStringValueXXX(void); -}; - -#endif - - - - - - - diff --git a/mozilla/calendar/modules/parser/ical/inc/nscalicalendarpars.h b/mozilla/calendar/modules/parser/ical/inc/nscalicalendarpars.h deleted file mode 100644 index d189349fb9f..00000000000 --- a/mozilla/calendar/modules/parser/ical/inc/nscalicalendarpars.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/** - * MODULE NOTES: - * @update gess 4/1/98 - */ - -#ifndef nscalicalendarpars_h___ -#define nscalicalendarpars_h___ - -#include "nscore.h" - -#ifdef _IMPL_NS_CALICALENDARPARS -#define NS_CALICALENDARPARS NS_EXPORT -#else -#define NS_CALICALENDARPARS NS_IMPORT -#endif - -#if defined(XP_MAC) - #define CLASS_EXPORT_CALICALENDARPARS NS_CALICALENDARPARS class -#else - #define CLASS_EXPORT_CALICALENDARPARS class NS_CALICALENDARPARS -#endif - -#endif /* nscalicalendarpars_h___ */ - - - - - - - - - diff --git a/mozilla/calendar/modules/parser/ical/manifest.mn b/mozilla/calendar/modules/parser/ical/manifest.mn deleted file mode 100644 index 856eaf317de..00000000000 --- a/mozilla/calendar/modules/parser/ical/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = public inc -DIRS_LIBS = src - - - - - - - - diff --git a/mozilla/calendar/modules/parser/ical/public/Makefile b/mozilla/calendar/modules/parser/ical/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/parser/ical/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/parser/ical/public/manifest.mn b/mozilla/calendar/modules/parser/ical/public/manifest.mn deleted file mode 100644 index b2f18b39811..00000000000 --- a/mozilla/calendar/modules/parser/ical/public/manifest.mn +++ /dev/null @@ -1,23 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -EXPORTS = \ - nsICalICalendarParserObject.h \ - nsICalICalendarContentSink.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/parser/ical/public/nsICalICalendarContentSink.h b/mozilla/calendar/modules/parser/ical/public/nsICalICalendarContentSink.h deleted file mode 100644 index f6a6df9ec85..00000000000 --- a/mozilla/calendar/modules/parser/ical/public/nsICalICalendarContentSink.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalICalendarContentSink_h___ -#define nsICalICalendarContentSink_h___ - -#include "nsISupports.h" -#include "nsIWebViewerContainer.h" - -// e2549d00-5a4d-11d2-9432-006008268c31 -#define NS_ICALICALENDAR_CONTENT_SINK_IID \ -{ 0xe2549d00, 0x5a4d, 0x11d2, \ -{ 0x94, 0x32, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } } - -class nsICalICalendarContentSink : public nsISupports -{ - -public: - - NS_IMETHOD Init() = 0 ; - /*NS_IMETHOD SetViewerContainer(nsIWebViewerContainer * aViewerContainer) = 0; */ - -}; - -#endif /* nsICalICalendarContentSink_h___ */ - diff --git a/mozilla/calendar/modules/parser/ical/public/nsICalICalendarParserObject.h b/mozilla/calendar/modules/parser/ical/public/nsICalICalendarParserObject.h deleted file mode 100644 index 6a1abd65d6c..00000000000 --- a/mozilla/calendar/modules/parser/ical/public/nsICalICalendarParserObject.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalICalendarParserObject_h___ -#define nsICalICalendarParserObject_h___ - -#include "nsISupports.h" -#include "nsString.h" - -// 316a1830-5a4e-11d2-9432-006008268c31 -#define NS_ICALICALENDAR_PARSER_OBJECT_IID \ -{ 0x316a1830, 0x5a43, 0x11d2, \ -{ 0x94, 0x32, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } } - -class nsICalICalendarParserObject : public nsISupports -{ - -public: - - NS_IMETHOD Init() = 0; - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) = 0; - -}; - -#endif /* nsICalICalendarParserObject_h___ */ diff --git a/mozilla/calendar/modules/parser/ical/src/Makefile b/mozilla/calendar/modules/parser/ical/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/parser/ical/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/parser/ical/src/config.mk b/mozilla/calendar/modules/parser/ical/src/config.mk deleted file mode 100644 index 5441bc2a281..00000000000 --- a/mozilla/calendar/modules/parser/ical/src/config.mk +++ /dev/null @@ -1,35 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALICALENDARPARS -DNSPR20 -INCLUDES += -I ../public -I../inc -I$(GDEPTH)/include -I$(GDEPTH)/htmlparser/src - -LIBRARY_NAME = ical -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) - - - - - - - - - - - diff --git a/mozilla/calendar/modules/parser/ical/src/manifest.mn b/mozilla/calendar/modules/parser/ical/src/manifest.mn deleted file mode 100644 index 1bfde9c9baf..00000000000 --- a/mozilla/calendar/modules/parser/ical/src/manifest.mn +++ /dev/null @@ -1,30 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalICalendarTags.cpp \ - nsCalICalendarTokens.cpp \ - nsCalICalendarDTD.cpp \ - nsCalICalendarContentSink.cpp \ - nsCalICalendarParserNode.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls netlib shell xpfc - - diff --git a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarContentSink.cpp b/mozilla/calendar/modules/parser/ical/src/nsCalICalendarContentSink.cpp deleted file mode 100644 index 53d3cf3410c..00000000000 --- a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarContentSink.cpp +++ /dev/null @@ -1,588 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - - -#include "jdefines.h" -#include "nsCalICalendarContentSink.h" -#include "nscalcoreicalCIID.h" -#include "nsICalendar.h" -#include "nsICalProperty.h" -#include "nsICalICalendarContainer.h" -#include "nsICalTimeBasedEvent.h" -#include "nsICalVEvent.h" -#include "nsIXPFCICalContentSink.h" -#include "nsxpfcCIID.h" -//#include "nsCalICalendarTokens.h" -//#include "nsCalICalendarDTD.h" -//#include "nsCalICalendarParserCIID.h" -//#include "nsICalICalendarParserObject.h" -//#include "nsICalendarShell.h" -//#include "nsCalParserCIID.h" -//#include "nsxpfcCIID.h" - -// -//#include "vevent.h" -//#include "nscal.h" -//#include "vtodo.h" -//#include "vfrbsy.h" -//#include "vtimezne.h" -//#include "valarm.h" -// - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENT_SINK_IID); -static NS_DEFINE_IID(kICalICalendarContentSinkIID, NS_ICALICALENDAR_CONTENT_SINK_IID); -static NS_DEFINE_IID(kICalICalendarParserObjectIID, NS_ICALICALENDAR_PARSER_OBJECT_IID); -static NS_DEFINE_IID(kICalICalendarContainerIID, NS_ICALICALENDARCONTAINER_IID); - -static NS_DEFINE_IID(kCCalICalendarVCalendarCID, NS_CALICALENDARVCALENDAR_CID); -//static NS_DEFINE_IID(kCCalICalendarVCalendarCID, NS_ICALENDAR_CID); -static NS_DEFINE_IID(kCCalICalendarVEventCID, NS_CALICALENDARVEVENT_CID); -static NS_DEFINE_IID(kCCalICalendarVTodoCID, NS_CALICALENDARVTODO_CID); -static NS_DEFINE_IID(kCCalICalendarVJournalCID, NS_CALICALENDARVJOURNAL_CID); -static NS_DEFINE_IID(kCCalICalendarVFreebusyCID, NS_CALICALENDARVFREEBUSY_CID); -static NS_DEFINE_IID(kCCalICalendarVTimeZoneCID, NS_CALICALENDARVTIMEZONE_CID); -static NS_DEFINE_IID(kCCalICalendarVAlarmCID, NS_CALICALENDARVALARM_CID); -static NS_DEFINE_IID(kICalendarIID, NS_ICALENDAR_IID); -static NS_DEFINE_IID(kICalTimeBasedEventIID, NS_ICALTIMEBASEDEVENT_IID); -static NS_DEFINE_IID(kCCalVEventCID, NS_CALICALENDARVEVENT_CID); -static NS_DEFINE_IID(kICalPropertyIID, NS_ICALPROPERTY_IID); -static NS_DEFINE_IID(kCCalStringPropertyCID, NS_CALSTRINGPROPERTY_CID); -static NS_DEFINE_IID(kCCalDateTimePropertyCID, NS_CALDATETIMEPROPERTY_CID); -static NS_DEFINE_IID(kCCalIntegerPropertyCID, NS_CALINTEGERPROPERTY_CID); - -static NS_DEFINE_IID(kICalXPFCICalContentSinkIID, NS_IXPFC_ICAL_CONTENT_SINK_IID); -static NS_DEFINE_IID(kIXPFCContentSinkIID, NS_IXPFC_CONTENT_SINK_IID); - -//static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); -//static NS_DEFINE_IID(kIXPFCObserverManagerIID, NS_IXPFC_OBSERVERMANAGER_IID); - -nsCalICalendarContentSink::nsCalICalendarContentSink() -{ - NS_INIT_REFCNT(); - static NS_DEFINE_IID(kCStackCID, NS_STACK_CID); - nsresult res = nsRepository::CreateInstance(kCStackCID, nsnull, - kCStackCID, (void **) &mXPFCStack); - if (NS_OK != res) - return; - - mXPFCStack->Init(); - - mCalendarList = nsnull; -#if 0 - static NS_DEFINE_IID(kCArrayCID, NS_ARRAY_CID); - -#ifdef NS_WIN32 - #define XPFC_DLL "xpfc10.dll" -#else - #define XPFC_DLL "libxpfc10.so" -#endif - - static NS_DEFINE_IID(kCArrayIteratorCID, NS_ARRAY_ITERATOR_CID); - - nsRepository::RegisterFactory(kCArrayCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCArrayIteratorCID, XPFC_DLL, PR_FALSE, PR_FALSE); - - if (nsnull == mCalendarList) - { - res = nsRepository::CreateInstance(kCArrayCID, nsnull, - kCArrayCID, (void **)&mCalendarList); - if (NS_OK == res) - { - mCalendarList->Init(); - } - } -#endif - -} - -nsCalICalendarContentSink::~nsCalICalendarContentSink() { - NS_IF_RELEASE(mCalendarList); -} - -NS_IMETHODIMP nsCalICalendarContentSink::Init() -{ - nsresult res; - - return NS_OK; -} - -nsresult nsCalICalendarContentSink::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (nsIContentSink*)(this); - } - else if (aIID.Equals(kIContentSinkIID)) { - *aInstancePtr = (nsIContentSink*)(this); - } - else if (aIID.Equals(kIXPFCContentSinkIID)) { - *aInstancePtr = (nsIXPFCContentSink*)(this); - } - else if (aIID.Equals(kICalICalendarContentSinkIID)) { - *aInstancePtr = (nsICalICalendarContentSink*)(this); - } - else if (aIID.Equals(kICalXPFCICalContentSinkIID)) { - *aInstancePtr = (nsIXPFCICalContentSink*)(this); - } - else { - *aInstancePtr=0; - return NS_NOINTERFACE; - } - NS_ADDREF_THIS(); - return NS_OK; -} - -NS_IMPL_ADDREF(nsCalICalendarContentSink); -NS_IMPL_RELEASE(nsCalICalendarContentSink); - -/* -nsresult nsCalICalendarContentSink::SetViewerContainer(nsIWebViewerContainer * aViewerContainer) -{ - mViewerContainer = aViewerContainer; - return NS_OK; -} -*/ - -NS_IMETHODIMP nsCalICalendarContentSink::OpenContainer(const nsIParserNode& aNode) -{ - nsICalICalendarParserObject * object = nsnull; - eCalICalendarTags tag = (eCalICalendarTags) aNode.GetNodeType(); - nsresult res; - nsCID aclass; - - nsString tex = aNode.GetText(); - res = CIDFromTag(tag, aclass); - - if (NS_OK != res) - return res; - - res = nsRepository::CreateInstance(aclass, nsnull, - kICalICalendarParserObjectIID, - (void **)&object); - if (NS_OK != res) - return res; - - AddToHierarchy(*object, PR_TRUE); - object->Init(); - - ConsumeAttributes(aNode,*object); - // todo: finish - return NS_OK; -} - -NS_IMETHODIMP nsCalICalendarContentSink::CloseContainer(const nsIParserNode& aNode) -{ - - nsISupports * container = (nsISupports *)mXPFCStack->Pop(); - - nsISupports * parent = (nsISupports *) mXPFCStack->Top(); - nsresult res = NS_OK; - - nsICalendar * cal = nsnull; - nsICalVEvent * event = nsnull; - - if (parent != nsnull && container != nsnull) - { - // todo: use ICalComponent instead - res = container->QueryInterface(kCCalVEventCID, (void **) &event); - if (NS_OK == res) - { - res = parent->QueryInterface(kICalendarIID, (void **) & cal); - if (NS_OK == res) - { - if (event->IsValid()) - cal->AddEvent(event); - } - //NS_RELEASE(cal); - } - NS_RELEASE(event); - } - else if (parent == nsnull && container != nsnull) - { - // todo: finish - res = container->QueryInterface(kICalendarIID, (void **) &cal); - if (NS_OK == res) - { - if (nsnull != mCalendarList) - { - mCalendarList->Append(cal); - NS_ADDREF(cal); - } - } - } - - NS_IF_RELEASE(container); - return NS_OK; -} - -NS_IMETHODIMP nsCalICalendarContentSink::AddLeaf(const nsIParserNode& aNode) -{ - nsICalICalendarParserObject * object = nsnull; - nsICalICalendarContainer * container = nsnull; - eCalICalendarTags tag = (eCalICalendarTags) aNode.GetNodeType(); - nsresult res; - nsCID aclass; - - nsString text = aNode.GetText(); - res = CIDFromTag(tag, aclass); - res = nsRepository::CreateInstance(aclass, - nsnull, - kICalICalendarParserObjectIID, - (void **)&object); - if (NS_OK == res) - { - nsICalICalendarContainer * parent = (nsICalICalendarContainer *) mXPFCStack->Top(); - - if (nsnull != parent) - { - res = parent->QueryInterface(kICalICalendarContainerIID, (void **) &container); - nsICalProperty * sp = nsnull; - - if (res == NS_OK) - { - // it's a container - res = object->QueryInterface(kICalPropertyIID, (void **) &sp); - if (res == NS_OK) - container->StoreProperty(tag, sp, 0); - //NS_RELEASE(sp); - } - } - } - -#if 0 - AddToHierarchy(*object, PR_FALSE); - - object->Init(); - - ConsumeAttributes(aNode, *object); -#endif - //ConsumePropertyValues(aNode, *object); - - return NS_OK; -} - -NS_IMETHODIMP nsCalICalendarContentSink::WillBuildModel(void) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalICalendarContentSink::DidBuildModel(PRInt32 aQualityLevel) -{ -#if 0 - static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); - static NS_DEFINE_IID(kXPFCObserverIID, NS_IXPFC_OBSERVER_IID); - - nsIIterator * iterator; - mCalendarList->CreateIterator(&iterator); - - iterator->Init(); - - nsCalendar * item; - - nsICalendar * cal; - nsICalendar * cal2; - - nsIXPFCSubject * subject; - nsIXPFCSubject * subject2; - nsIXPFCObserver * observer; - nsIXPFCObserver * observer2; - - nsIXPFCObserverManager * om; - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - - while (!(iterator->IsDone())) - { - item = (nsCalendar *) iterator->CurrentItem(); - - - - } -#endif - return NS_OK; -} - -NS_IMETHODIMP nsCalICalendarContentSink::WillInterrupt(void) -{ - return NS_OK; -} - -NS_IMETHODIMP nsCalICalendarContentSink::WillResume(void) -{ - return NS_OK; -} - - -/* - * Find the CID from the XML Tag Object - */ - -NS_IMETHODIMP nsCalICalendarContentSink::CIDFromTag(eCalICalendarTags tag, nsCID &aClass) -{ - switch(tag) - { - case eCalICalendarTag_vcalendar: - aClass = kCCalICalendarVCalendarCID; - break; - - case eCalICalendarTag_vevent: - aClass = kCCalICalendarVEventCID; - break; - - case eCalICalendarTag_vtodo: - aClass = kCCalICalendarVTodoCID; - break; - - case eCalICalendarTag_vjournal: - aClass = kCCalICalendarVJournalCID; - break; - - case eCalICalendarTag_vfreebusy: - aClass = kCCalICalendarVFreebusyCID; - break; - - case eCalICalendarTag_vtimezone: - aClass = kCCalICalendarVTimeZoneCID; - break; - - case eCalICalendarTag_valarm: - aClass = kCCalICalendarVAlarmCID; - break; - - case eCalICalendarTag_dtstart: - case eCalICalendarTag_dtstamp: - case eCalICalendarTag_dtend: - case eCalICalendarTag_created: - case eCalICalendarTag_last_modified: - aClass = kCCalDateTimePropertyCID; - break; - - case eCalICalendarTag_summary: - case eCalICalendarTag_calscale: - case eCalICalendarTag_method: - case eCalICalendarTag_version: - case eCalICalendarTag_status: - case eCalICalendarTag_description: - case eCalICalendarTag_transp: - case eCalICalendarTag_location: - aClass = kCCalStringPropertyCID; - break; - - case eCalICalendarTag_sequence: - case eCalICalendarTag_priority: - aClass = kCCalIntegerPropertyCID; - break; - - default: - return (NS_ERROR_UNEXPECTED); - break; - } - - - return NS_OK; -} - -NS_IMETHODIMP nsCalICalendarContentSink::ConsumeAttributes(const nsIParserNode& aNode, - nsICalICalendarParserObject& aObject) -{ - PRInt32 i = 0; - nsString key,value; - nsString scontainer; - //PRBool container; - - for (i = 0; i < aNode.GetAttributeCount(); i++) { - key = aNode.GetKeyAt(i); - value = aNode.GetValueAt(i); - - key.StripChars("\""); - value.StripChars("\""); - - aObject.SetParameter(key,value); - } - - eCalICalendarTags tag = (eCalICalendarTags) aNode.GetNodeType(); - - // todo: finish - - return NS_OK; -} - -/* -NS_IMETHODIMP nsCalICalendarContentSink::ConsumePropertyValues(const nsIParserNode& aNode, - nsICalICalendarParserObject& aObject) -{ - PRInt32 i = 0; - nsString key,value; - nsString scontainer; - //PRBool container; - - for (i = 0; i < aNode.GetAttributeCount(); i++) { - key = aNode.GetKeyAt(i); - value = aNode.GetValueAt(i); - - key.StripChars("\""); - value.StripChars("\""); - - aObject.SetParameter(key,value); - } - - eCalICalendarTags tag = (eCalICalendarTags) aNode.GetNodeType(); - - // todo: finish - - return NS_OK; -} -*/ - -NS_IMETHODIMP nsCalICalendarContentSink::AddToHierarchy(nsICalICalendarParserObject& aObject, - PRBool aPush) -{ - nsICalICalendarContainer * parent = (nsICalICalendarContainer *) mXPFCStack->Top(); - nsICalICalendarContainer * containerToPush = nsnull; - - nsresult res = aObject.QueryInterface(kICalICalendarContainerIID, (void **) &containerToPush); - if (res == NS_OK) - { - if (aPush == PR_TRUE) - mXPFCStack->Push(containerToPush); - return NS_OK; - } - - return NS_OK; - /* - nsICalICalendarContainer * parent = (nsICalICalendarContainer *) mXPFCStack->Top(); - - nsICalICalendarContainer * containerToPush = nsnull; - - nsresult res = aObject.QueryInterface(kICalICalendarContainerIID, (void **) &containerToPush); - - if (NS_OK != res) - return res; - - if (parent == nsnull) - { - //if (aPush == PR_TRUE) - // mXPFCStack->Push(containerToPush); - } - else - { - nsICalICalendarContainer * container = nsnull; - - res = parent->QueryInterface(kICalendarIID, (void **) &container); - - if (res == NS_OK) - { - // it's a calendar - res = aObject.QueryInterface(kIParserNodeIID, (void **) &containerToPush); - if (res == NS_OK) - { - - } - eCalICalendarTags tag = (eCalICalendarTags) aObject.GetNodeType(); - res = container->QueryInterface(kICalendar - switch (tag) - { - case eCalICalendarTags_vevent: - parent->AddVEvent(container); - case eCalICalendarTags_version: - parennt->SetVersion(container); - } - res = aObject.QueryInterface(kICalICalendarVEventIID, (void **)&container); - if (res == NS_OK) - parent->AddVEvent(container); - - } - - //if (aPush == PR_TRUE) - // mXPFCStack->Push(containerToPush); - } - - if (mState == CALICALENDAR_PARSING_VCALENDAR) - - { - nsICalendar * container = nsnull; - nsICalendar * parent = nsnull; - - nsresult res = aObject.QueryInterface(kCCalendarIID, (void **) &container); - - parent = (nsICalendar *) mXPFCStack->Top(); - - if (parent == nsnull) - { - if (aPush == PR_TRUE) - mXPFCStack->Push(container); - } - else - { - - } - } - return NS_OK; - */ -} - -PRBool nsCalICalendarContentSink::IsContainer(const nsIParserNode& aNode) -{ - PRInt32 i = 0; - nsString key; - PRBool container = PR_FALSE; - - for (i = 0; i < aNode.GetAttributeCount(); i++) { - - key = aNode.GetKeyAt(i); - key.StripChars("\""); - - // todo: finish - } - - return container; -} - -nsresult nsCalICalendarContentSink::SetContentSinkContainer(nsISupports * - aContentSinkContainer) -{ - nsresult res; - nsIArray * array; - static NS_DEFINE_IID(kCArrayCID, NS_ARRAY_CID); - res = aContentSinkContainer->QueryInterface(kCArrayCID, (void **)&array); - if (NS_OK == res) - { - res = SetCalendarList(array); - NS_RELEASE(array); - } - return res; -} - -nsresult nsCalICalendarContentSink::SetViewerContainer(nsIWebViewerContainer * aViewerContainer) -{ - mViewerContainer = aViewerContainer; - return NS_OK; -} - -nsresult nsCalICalendarContentSink::SetCalendarList(nsIArray * aCalendarList) -{ - mCalendarList = aCalendarList; - NS_ADDREF(aCalendarList); - return NS_OK; -} diff --git a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarDTD.cpp b/mozilla/calendar/modules/parser/ical/src/nsCalICalendarDTD.cpp deleted file mode 100644 index 772816e28e7..00000000000 --- a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarDTD.cpp +++ /dev/null @@ -1,869 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscalexport.h" -#include "nsCalXMLDTD.h" -#include "nsCalParserCIID.h" -#include "nsxpfcCIID.h" -#include "nsCalICalendarDTD.h" -#include "nsToken.h" -#include "nsScanner.h" -#include "nsParser.h" // ? -#include "nsParserNode.h" // ? -#include "nsIParserNode.h" // ? -#include "nsCalICalendarContentSink.h" -#include "nsCalICalendarTokens.h" // todo: -#include "nsCalICalendarParserCIID.h" -#include "nsParserCIID.h" -#include "nsCRT.h" // ? - -//#include "nsCalICalendarStrings.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID); -static NS_DEFINE_IID(kClassIID, NS_ICALICALENDAR_DTD_IID); -static NS_DEFINE_IID(kBaseClassIID, NS_ICALICALENDAR_DTD_IID); - -static NS_DEFINE_IID(kCalICalendarCParserNodeCID, NS_CALICALENDARPARSER_NODE_IID); -static NS_DEFINE_IID(kCParserNodeIID, NS_IPARSER_NODE_IID); - -static const char* kNullToken = "Error: Null token given"; -static const char* kCalICalendarTextHeader = "BEGIN:VCALENDAR"; -static const char* kCalICalendarTextContentType = "text/calendar"; -static nsAutoString gCalEmpty; - -static eCalICalendarTags gCalNonContainers[]={ - eCalICalendarTag_action, eCalICalendarTag_attach, - eCalICalendarTag_attendee, eCalICalendarTag_calscale, - eCalICalendarTag_categories, eCalICalendarTag_class, - eCalICalendarTag_comment, eCalICalendarTag_completed, - eCalICalendarTag_contact, eCalICalendarTag_created, - eCalICalendarTag_description, - eCalICalendarTag_dtend, eCalICalendarTag_dtstart, - eCalICalendarTag_due, eCalICalendarTag_duration, - eCalICalendarTag_exdate, eCalICalendarTag_exrule, - eCalICalendarTag_freebusy, eCalICalendarTag_geo, - eCalICalendarTag_last_modified, eCalICalendarTag_location, - eCalICalendarTag_method, eCalICalendarTag_organizer, - eCalICalendarTag_percent_complete, eCalICalendarTag_priority, - eCalICalendarTag_prodid, eCalICalendarTag_rdate, - eCalICalendarTag_recurrence_id, eCalICalendarTag_related_to, - eCalICalendarTag_repeat, eCalICalendarTag_request_status, - eCalICalendarTag_resources, eCalICalendarTag_rrule, - eCalICalendarTag_sequence, - eCalICalendarTag_status, eCalICalendarTag_summary, - eCalICalendarTag_transp, eCalICalendarTag_trigger, - eCalICalendarTag_tzid, eCalICalendarTag_tzname, - eCalICalendarTag_tzoffsetfrom, eCalICalendarTag_tzoffsetto, - eCalICalendarTag_tzurl, eCalICalendarTag_uid, - eCalICalendarTag_url, - eCalICalendarTag_version, -}; - -struct nsCalICalendarTagEntry { - char mName[32]; - eCalICalendarTags fTagID; -}; - -nsCalICalendarTagEntry gCalICalendarTagTable[] = -{ - {"vcalendar", eCalICalendarTag_vcalendar}, - {"vevent", eCalICalendarTag_vevent}, - {"vtodo", eCalICalendarTag_vtodo}, - {"vjournal", eCalICalendarTag_vjournal}, - {"vfreebusy", eCalICalendarTag_vfreebusy}, - {"valarm", eCalICalendarTag_valarm}, - {"vtimezone", eCalICalendarTag_vtimezone} -}; - -eCalICalendarTags DetermineCalICalendarComponentType(const nsString& aString) -{ - PRInt32 result=-1; - PRInt32 cnt=sizeof(gCalICalendarTagTable)/sizeof(nsCalICalendarTagEntry); - PRInt32 low=0; - PRInt32 high=cnt-1; - PRInt32 middle=0; - - while(low<=high){ - middle=(PRInt32)(low+high)/2; - //result=aString.Compare(gCalICalendarTagTable[middle].mName, nsCRT::strlen(gXPFCXMLTagTable[middle].mName), PR_TRUE); - result=aString.Compare(gCalICalendarTagTable[middle].mName, PR_TRUE); - if (result==0) - return gCalICalendarTagTable[middle].fTagID; - if (result<0) - high=middle-1; - else low=middle+1; - } - return eCalICalendarTag_userdefined; -} - -PRInt32 CalICalendarDispatchTokenHandler(CToken* aToken,nsIDTD* aDTD) { - PRInt32 result=0; - eCalICalendarTokenTypes theType = (eCalICalendarTokenTypes)aToken->GetTokenType(); - nsCalICalendarDTD* theDTD=(nsCalICalendarDTD*)aDTD; - - nsString& name = aToken->GetStringValueXXX(); - eCalICalendarTags type = DetermineCalICalendarComponentType(name); - - if (type != eCalICalendarTag_userdefined) - aToken->SetTypeID(type); - - if (aDTD) { - switch(theType) { - case eCalICalendarToken_begin: - result=theDTD->HandleBeginToken(aToken); break; - case eCalICalendarToken_end: - result=theDTD->HandleEndToken(aToken); break; - case eCalICalendarToken_attribute: - result=theDTD->HandleAttributeToken(aToken); break; - case eCalICalendarToken_propertyvalue: - result=theDTD->HandlePropertyValueToken(aToken); break; - default: - result=0; - }//switch - }//if - return result; -} - - -/* token deallocator */ -class nsCalTokenDeallocator: public nsDequeFunctor { -public: - virtual void* operator()(void* anObject) { - CToken* aToken = (CToken*)anObject; - delete aToken; - return 0; - } -}; -static nsCalTokenDeallocator gCalTokenKiller; - -/* token recycler, cuts down number of tokens that get created during the run of system */ -class nsCalTokenRecycler: public nsITokenRecycler { -public: - nsCalTokenRecycler(); - virtual ~nsCalTokenRecycler(); - virtual void RecycleToken(CToken* aToken); - virtual CToken* CreateTokenOfType(eCalICalendarTokenTypes aType,eCalICalendarTags aTag, - const nsString& aString); - -protected: - nsDeque* mTokenCache[eCalICalendarToken_last-1]; -}; - -nsCalTokenRecycler::nsCalTokenRecycler() : nsITokenRecycler() { - int i=0; - for (i=0;iGetTokenType(); - mTokenCache[theType-1]->Push(aToken); - } -} - -CToken * nsCalTokenRecycler::CreateTokenOfType(eCalICalendarTokenTypes aType, - eCalICalendarTags aTag, - const nsString& aString) -{ - CToken* result=(CToken*)mTokenCache[aType-1]->Pop(); - - if(result) { - result->Reinitialize(aTag,aString); - } - else { - switch(aType) { - //todo: finish - case eCalICalendarToken_begin: result=new CCalICalendarBeginToken(aString, aTag); break; - case eCalICalendarToken_end: result=new CCalICalendarEndToken(aString, aTag); break; - case eCalICalendarToken_propertyname: result=new CCalICalendarIdentifierToken(aTag); break; - case eCalICalendarToken_attribute: result=new CCalICalendarAttributeToken(); break; - case eCalICalendarToken_propertyvalue: result=new CCalICalendarPropertyValueToken(); break; - default: - break; - } - } - return result; -} - -nsCalTokenRecycler gCalTokenRecycler; - -struct nsCalICalendarComponentEntry { - char mName[32]; - eCalICalendarTags fTagID; -}; - - -nsresult nsCalICalendarDTD::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - - if (aIID.Equals(kISupportsIID)) { //do IUnknown... - *aInstancePtr = (nsIDTD*)(this); - } - else if (aIID.Equals(kIDTDIID)) { //do IParser base class... - *aInstancePtr = (nsIDTD*)(this); - } - else if (aIID.Equals(kClassIID)) { //do this class... - *aInstancePtr = (nsCalICalendarDTD*)(this); - } - else { - *aInstancePtr=0; - return NS_NOINTERFACE; - } - ((nsISupports*) *aInstancePtr)->AddRef(); - return NS_OK; -} - -NS_CALICALENDARPARS nsresult NS_NewICAL_DTD(nsIDTD** aInstancePtrResult) -{ - nsCalICalendarDTD * it = new nsCalICalendarDTD(); - - if (it == 0) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return it->QueryInterface(kClassIID, (void **) aInstancePtrResult); -} - -NS_IMPL_ADDREF(nsCalICalendarDTD) -NS_IMPL_RELEASE(nsCalICalendarDTD) - -nsCalICalendarDTD::nsCalICalendarDTD() : nsIDTD() , mTokenDeque(gCalTokenKiller) -{ - NS_INIT_REFCNT(); - mParser=0; -} - -nsCalICalendarDTD::~nsCalICalendarDTD(){ -} - -PRBool nsCalICalendarDTD::CanParse(nsString& aContentType, PRInt32 aVersion) -{ - if (aContentType == kCalICalendarTextContentType) - return PR_TRUE; - - return PR_FALSE; -} - -eAutoDetectResult nsCalICalendarDTD::AutoDetectContentType(nsString& aBuffer,nsString& aType) -{ - if (aType == kCalICalendarTextContentType || aBuffer.Find(kCalICalendarTextHeader) != -1) - { - aType = kCalICalendarTextContentType; - return eValidDetect; - } - return eUnknownDetect; -} - -nsresult nsCalICalendarDTD::HandleToken(CToken* aToken) -{ - nsresult result=NS_OK; - - if(aToken) { - - CCalICalendarToken* theToken= (CCalICalendarToken*)(aToken); - eCalICalendarTokenTypes theType=eCalICalendarTokenTypes(theToken->GetTokenType()); - - result=CalICalendarDispatchTokenHandler(theToken,this); - } - return result; -} - -nsresult nsCalICalendarDTD::CreateNewInstance(nsIDTD** aInstancePtrResult) -{ - /* - static NS_DEFINE_IID(kCCalCalICalendarDTD, NS_ICALICALENDAR_DTD_IID); - - nsresult result = nsRepository::CreateInstance(kCCalCalICalendarDTD, - nsnull, - kIDTDIID, - (void**) aInstancePtrResult); - - return (result); - */ - return NS_NewICAL_DTD(aInstancePtrResult); -} - -nsresult nsCalICalendarDTD::HandleAttributeToken(CToken* aToken) { - NS_PRECONDITION(0 != aToken,kNullToken); - NS_ERROR("attribute encountered -- this shouldn't happen!"); - - return NS_OK; -} - -nsresult nsCalICalendarDTD::HandlePropertyValueToken(CToken* aToken) { - - /* - todo: handle "Content-type" stuff here - */ - /* - XXX: this is bad hack. I really shouldn't be handling MIME. - Someone else should parse all the MIME. - This DTD should really know how to parse iCal. - I should really NS_ERROR if this is called. - */ - - return NS_OK; -} - -nsresult nsCalICalendarDTD::HandleBeginToken(CToken* aToken) -{ - CCalICalendarBeginToken * st = (CCalICalendarBeginToken*)aToken; - eCalICalendarTags tokenTagType = (eCalICalendarTags) st->GetTypeID(); - nsCalICalendarCParserNode * attrNode = nsnull; - - //Begin by gathering up attributes... - static NS_DEFINE_IID(kCalICalendarCParserNodeCID, NS_CALICALENDARPARSER_NODE_IID); - static NS_DEFINE_IID(kCParserNodeIID, NS_IPARSER_NODE_IID); - - nsresult result = nsRepository::CreateInstance(kCalICalendarCParserNodeCID, nsnull, kCParserNodeIID,(void**) &attrNode); - - if (NS_OK != result) - return result; - - attrNode->Init((CCalICalendarToken*)aToken,mLineNumber); - - PRInt16 attrCount=aToken->GetAttributeCount(); - result=(0==attrCount) ? NS_OK : CollectAttributes(*attrNode,attrCount); - - // now set skipped content to property value token - /* todo: finish - if (tokenTagType == eCalICalendarTag_begin) { - tokenTagType = ComponentTypeFromObject(*attrNode); - st->SetTypeID(tokenTagType); - } - */ - if(NS_OK==result) { - - switch(tokenTagType) { - case eCalICalendarTag_vcalendar: - case eCalICalendarTag_vevent: - case eCalICalendarTag_vtodo: - case eCalICalendarTag_vjournal: - case eCalICalendarTag_vfreebusy: - case eCalICalendarTag_valarm: - case eCalICalendarTag_vtimezone: - { - // todo: xxx: close any already open containers; - mSink->OpenContainer(*attrNode); - } - break; - - case eCalICalendarTag_action: - case eCalICalendarTag_attach: - case eCalICalendarTag_attendee: - case eCalICalendarTag_calscale: - case eCalICalendarTag_categories: - case eCalICalendarTag_class: - case eCalICalendarTag_comment: - case eCalICalendarTag_completed: - case eCalICalendarTag_contact: - case eCalICalendarTag_created: - case eCalICalendarTag_description: - case eCalICalendarTag_dtend: - case eCalICalendarTag_dtstart: - case eCalICalendarTag_dtstamp: - case eCalICalendarTag_due: - case eCalICalendarTag_duration: - case eCalICalendarTag_exdate: - case eCalICalendarTag_exrule: - case eCalICalendarTag_freebusy: - case eCalICalendarTag_geo: - case eCalICalendarTag_last_modified: - case eCalICalendarTag_location: - case eCalICalendarTag_method: - case eCalICalendarTag_organizer: - case eCalICalendarTag_percent_complete: - case eCalICalendarTag_priority: - case eCalICalendarTag_prodid: - case eCalICalendarTag_rdate: - case eCalICalendarTag_rrule: - case eCalICalendarTag_recurrence_id: - case eCalICalendarTag_related_to: - case eCalICalendarTag_repeat: - case eCalICalendarTag_request_status: - case eCalICalendarTag_resources: - case eCalICalendarTag_sequence: - case eCalICalendarTag_status: - case eCalICalendarTag_summary: - case eCalICalendarTag_transp: - case eCalICalendarTag_trigger: - case eCalICalendarTag_tzid: - case eCalICalendarTag_tzname: - case eCalICalendarTag_tzoffsetfrom: - case eCalICalendarTag_tzoffsetto: - case eCalICalendarTag_tzurl: - case eCalICalendarTag_uid: - case eCalICalendarTag_url: - case eCalICalendarTag_version: - { - // todo: finish - /* - if (((nsCalICalendarContentSink *)mSink)->IsContainer(*attrNode) == PR_TRUE) - st->SetTypeID(eCalICalendarTag_property); - */ - result = CollectPropertyValue(*attrNode,attrCount); - mSink->AddLeaf(*attrNode); - } - break; - - default: - break; - } - } - - NS_RELEASE(attrNode); - - if(eCalICalendarTag_newline==tokenTagType) - mLineNumber++; - - return result; -} - -PRInt32 nsCalICalendarDTD::CollectPropertyValue(nsCalICalendarCParserNode& aNode,PRInt32 aCount) { - - CToken* theToken=mParser->PeekToken(); - if(theToken) { - eCalICalendarTokenTypes theType=eCalICalendarTokenTypes(theToken->GetTokenType()); - if(eCalICalendarToken_propertyvalue==theType){ - mParser->PopToken(); //pop it for real... - aNode.SetSkippedContent((CCalICalendarToken*)theToken); - } - else return kInterrupted; - } - return kNoError; -} - -PRInt32 nsCalICalendarDTD::CollectAttributes(nsCalICalendarCParserNode& aNode,PRInt32 aCount) { - int attr=0; - for(attr=0;attrPeekToken(); - if(theToken) { - eCalICalendarTokenTypes theType=eCalICalendarTokenTypes(theToken->GetTokenType()); - if(eCalICalendarToken_attribute==theType){ - mParser->PopToken(); //pop it for real... - aNode.AddAttribute((CCalICalendarToken*)theToken); - } - } - else return kInterrupted; - } - return kNoError; -} - -nsresult nsCalICalendarDTD::HandleEndToken(CToken* aToken) -{ - nsresult result=NS_OK; - CCalICalendarEndToken* et = (CCalICalendarEndToken *)(aToken); - eCalICalendarTags tokenTagType=(eCalICalendarTags)et->GetTypeID(); - nsCParserNode * attrNode = nsnull; - - static NS_DEFINE_IID(kCalICalendarCParserNodeCID, NS_CALICALENDARPARSER_NODE_IID); - static NS_DEFINE_IID(kCParserNodeIID, NS_IPARSER_NODE_IID); - - result = nsRepository::CreateInstance(kCalICalendarCParserNodeCID, nsnull, kCParserNodeIID, (void**)&attrNode); - - if (NS_OK != result) - return result; - - attrNode->Init((CCalICalendarToken *)aToken, mLineNumber); - - /* todo: finish - if (tokenTagType == eCalICalendarTag_object) { - tokenTagType = ComponentTypeFromObject(*attrNode); - et->SetTypeID(tokenTagType); - } - */ - switch(tokenTagType) { - - case eCalICalendarTag_vcalendar: - case eCalICalendarTag_vevent: - case eCalICalendarTag_vtodo: - case eCalICalendarTag_vjournal: - case eCalICalendarTag_vfreebusy: - case eCalICalendarTag_valarm: - case eCalICalendarTag_vtimezone: - { - mSink->CloseContainer(*attrNode); - } - break; - - case eCalICalendarTag_attach: - case eCalICalendarTag_attendee: - case eCalICalendarTag_calscale: - case eCalICalendarTag_categories: - case eCalICalendarTag_class: - case eCalICalendarTag_comment: - case eCalICalendarTag_completed: - case eCalICalendarTag_contact: - case eCalICalendarTag_created: - case eCalICalendarTag_description: - case eCalICalendarTag_dtend: - case eCalICalendarTag_dtstart: - case eCalICalendarTag_due: - case eCalICalendarTag_duration: - case eCalICalendarTag_exdate: - case eCalICalendarTag_exrule: - case eCalICalendarTag_freebusy: - case eCalICalendarTag_geo: - case eCalICalendarTag_last_modified: - case eCalICalendarTag_location: - case eCalICalendarTag_method: - case eCalICalendarTag_organizer: - case eCalICalendarTag_percent_complete: - case eCalICalendarTag_priority: - case eCalICalendarTag_prodid: - case eCalICalendarTag_rdate: - case eCalICalendarTag_rrule: - case eCalICalendarTag_recurrence_id: - case eCalICalendarTag_related_to: - case eCalICalendarTag_repeat: - case eCalICalendarTag_request_status: - case eCalICalendarTag_resources: - case eCalICalendarTag_sequence: - case eCalICalendarTag_status: - case eCalICalendarTag_summary: - case eCalICalendarTag_transp: - case eCalICalendarTag_trigger: - case eCalICalendarTag_tzid: - case eCalICalendarTag_tzname: - case eCalICalendarTag_tzoffsetfrom: - case eCalICalendarTag_tzoffsetto: - case eCalICalendarTag_tzurl: - case eCalICalendarTag_uid: - case eCalICalendarTag_url: - case eCalICalendarTag_version: - break; - default: - break; - } - - NS_RELEASE(attrNode); - - return result; -} - -/* -eCalICalendarTags nsCalICalendarDTD::ComponentTypeFromObject(const nsIParserNode& aNode) -{ - PRInt32 i = 0; - - for (i = 0; i < aNode.GetAttributeCount(); i++) { - - nsString key = aNode.GetKeyAt(i); - key.StripChars("\""); - if (key.EqualsIgnoreCase(XPFC_STRING_CLASS)) { - nsString value = aNode.GetValueAt(i); - - value.StripChars("\""); - - if (value.EqualsIgnoreCase("attach")) - return (eCalICalendarTag_attach); - // todo: finish - } - } - return (eCalICalendarTag_unknown); -} -*/ - -NS_IMETHODIMP nsCalICalendarDTD::WillBuildModel(nsString& aFilename,PRInt32 aLevel) { - nsresult result=NS_OK; -/* - mFilename=aFilename; - - if((aNotifySink) && (mSink)) { - mLineNumber=1; - result = mSink->WillBuildModel(); - } - */ - return result; -} - -NS_IMETHODIMP nsCalICalendarDTD::DidBuildModel(PRInt32 anErrorCode,PRInt32 aLevel){ - nsresult result=NS_OK; - return result; -} - -void nsCalICalendarDTD::SetParser(nsIParser* aParser) { - mParser=(nsParser*)aParser; - if (mParser) - mParseMode = aParser->GetParseMode(); -} - -nsIContentSink* nsCalICalendarDTD::SetContentSink(nsIContentSink* aSink) { - nsIContentSink* old=mSink; - mSink= aSink; - return old; -} - -// todo: consume token - -nsresult nsCalICalendarDTD::WillResumeParse(void){ - nsresult result = NS_OK; - if(mSink) { - result = mSink->WillResume(); - } - return result; -} - -nsresult nsCalICalendarDTD::WillInterruptParse(void){ - nsresult result = NS_OK; - if(mSink) { - result = mSink->WillResume(); - } - return result; -} - -PRBool nsCalICalendarDTD::Verify(nsString& aURLRef){ - PRBool result=PR_TRUE; - return result; -} - -PRBool nsCalICalendarDTD::IsContainer(PRInt32 aTag) const{ - PRBool result=PR_FALSE; - return result; -} - -PRBool nsCalICalendarDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const{ - PRBool result=PR_FALSE; - return result; -} - -nsITokenRecycler* nsCalICalendarDTD::GetTokenRecycler(void){ - return 0; -} - -nsresult nsCalICalendarDTD::ConsumeToken(CToken*& aToken){ - aToken = 0; - if(mTokenDeque.GetSize()>0) - { - aToken=(CToken*)mTokenDeque.Pop(); - return NS_OK; - } - CScanner* theScanner=mParser->GetScanner(); - - PRUnichar aChar; - nsresult result=theScanner->GetChar(aChar); - switch(result) { - case kEOF: - break; - - case kInterrupted: - theScanner->RewindToMark(); - break; - - case NS_OK: - default: - switch(aChar) { - case kNotFound: - break; - - case kCR: case kLF: - result=ConsumeNewline(aChar,*theScanner,aToken); - break; - default: - if (!nsString::IsSpace(aChar)) { - result=ConsumePropertyLine(aChar,*theScanner,aToken); - break; - } - result=ConsumeWhitespace(aChar,*theScanner,aToken); - break; - } //switch - } - //if(NS_OK==result) - // result=theScanner->Eof(); - return result; -} - -nsresult -nsCalICalendarDTD::ConsumePropertyValue(PRUnichar aChar, CScanner& aScanner, - CToken*&aToken) -{ - PRInt32 theDequeSize=mTokenDeque.GetSize(); - nsresult result=NS_OK; - - CCalICalendarPropertyValueToken* theToken= (CCalICalendarPropertyValueToken*) - gCalTokenRecycler.CreateTokenOfType(eCalICalendarToken_propertyvalue, - eCalICalendarTag_unknown, gCalEmpty); - - //aToken=gCalTokenRecycler.CreateTokenOfType(eCalICalendarToken_propertyvalue, - // eCalICalendarTag_unknown, gCalEmpty); - if(theToken) { - result=theToken->Consume(aChar,aScanner);// parse property value (need to handle multiline) - //todo: also handle base64 and quoted-printable - if (NS_OK!=result) { - delete theToken; - aToken=0; - } - else - { - mTokenDeque.Push(theToken); - } - } - return result; -} - -nsresult -nsCalICalendarDTD::ConsumePropertyLine(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) -{ - nsresult result = NS_OK; - result = ConsumePropertyNameAndAttributes(aChar, aScanner, aToken); - if ((0 != aToken) && (NS_OK == result)) - { - if (eCalICalendarTag_begin != aToken->GetTypeID() && eCalICalendarTag_end != aToken->GetTypeID()) - { - result = ConsumePropertyValue(aChar, aScanner, aToken); - if(NS_OK!=result) { - delete aToken; - aToken=0; - } - }//if (eCalICalendarTag_begin ...) - } - return result; -} - -nsresult -nsCalICalendarDTD::ConsumePropertyNameAndAttributes(PRUnichar aChar, CScanner& aScanner, - CToken*& aToken) -{ - PRInt32 theDequeSize=mTokenDeque.GetSize(); - nsresult result=NS_OK; - - aToken=gCalTokenRecycler.CreateTokenOfType(eCalICalendarToken_begin, - eCalICalendarTag_unknown, gCalEmpty); - - if(aToken) { - // eats BEGIN, but not BEGIN: or BEGIN; - result=aToken->Consume(aChar,aScanner); //tell new token to finish consuming text... - - if (eCalICalendarTag_begin != aToken->GetTypeID() && eCalICalendarTag_end != aToken->GetTypeID()) - { - - if (NS_OK==result) { - if (((CCalICalendarBeginToken*)aToken)->IsAttributed()) { - result=ConsumeAttributes(aChar,aScanner,(CCalICalendarBeginToken*)aToken); - } - if (NS_OK!=result) { - while(mTokenDeque.GetSize()>theDequeSize) { - delete mTokenDeque.PopBack(); - } - } - } //if - } //if - if (eCalICalendarTag_end == aToken->GetTypeID()) - { - nsString endval = aToken->GetStringValueXXX(); - delete aToken; - aToken = 0; - // - aToken=gCalTokenRecycler.CreateTokenOfType(eCalICalendarToken_end, - eCalICalendarTag_end, endval); - } - }// if (eCalICalendar_begin ...) - return result; -} - -nsresult -nsCalICalendarDTD::ConsumeWhitespace(PRUnichar aChar, - CScanner& aScanner, - CToken*& aToken) { - aToken=gCalTokenRecycler.CreateTokenOfType(eCalICalendarToken_whitespace, - eCalICalendarTag_whitespace, - gCalEmpty); - nsresult result=NS_OK; - if (aToken) { - result=aToken->Consume(aChar, aScanner); - } - return kNoError; -} - -nsresult -nsCalICalendarDTD::ConsumeNewline(PRUnichar aChar, - CScanner& aScanner, - CToken*& aToken) { - aToken=gCalTokenRecycler.CreateTokenOfType(eCalICalendarToken_newline, - eCalICalendarTag_newline, - gCalEmpty); - nsresult result=NS_OK; - if (aToken) { - result=aToken->Consume(aChar, aScanner); - } - return kNoError; -} - -nsresult -nsCalICalendarDTD::ConsumeAttributes(PRUnichar aChar, - CScanner& aScanner, - CCalICalendarBeginToken* aToken) { - PRBool done=PR_FALSE; - nsresult result=NS_OK; - PRInt16 theAttrCount=0; - - while((!done) && (result==NS_OK)) { - CCalICalendarAttributeToken* theToken= (CCalICalendarAttributeToken*) - gCalTokenRecycler.CreateTokenOfType(eCalICalendarToken_attribute, - eCalICalendarTag_unknown,gCalEmpty); - if(theToken){ - // first eat leading semicolon - result=aScanner.Peek(aChar); - if(aChar=kSemiColon) - aScanner.GetChar(aChar); - - result=theToken->Consume(aChar,aScanner); //tell new token to finish consuming text... - - if (NS_OK==result){ - theAttrCount++; - mTokenDeque.Push(theToken); - }//if - else delete theToken; //we can't keep it.. - }//if - if (NS_OK==result){ - result=aScanner.Peek(aChar); - if(aChar==kColon) { - aScanner.GetChar(aChar); - done=PR_TRUE; - }//if - }//if - }//while - aToken->SetAttributeCount(theAttrCount); - return result; -} - - - - - - - - diff --git a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarParserNode.cpp b/mozilla/calendar/modules/parser/ical/src/nsCalICalendarParserNode.cpp deleted file mode 100644 index 49ddd4bfae9..00000000000 --- a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarParserNode.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - - -#include "nsCalICalendarParserNode.h" -#include "string.h" -#include "nsCalICalendarTokens.h" -#include "nscalicalendarpars.h" - -const nsAutoString nsCalICalendarCParserNode::mEmptyString(""); - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kClassIID, NS_CALICALENDARPARSER_NODE_IID); -static NS_DEFINE_IID(kIParserNodeIID, NS_IPARSER_NODE_IID); - -/** - * Default constructor - * - * @update gess 3/25/98 - * @param aToken -- token to init internal token - * @return - */ -nsCalICalendarCParserNode::nsCalICalendarCParserNode(CCalICalendarToken* aToken,PRInt32 aLineNumber): nsIParserNode() { - NS_INIT_REFCNT(); - mAttributeCount=0; - mLineNumber=aLineNumber; - mToken=aToken; - memset(mAttributes,0,sizeof(mAttributes)); - mSkippedContent=nsnull; -} - - -/** - * default destructor - * - * @update gess 3/25/98 - * @param - * @return - */ -nsCalICalendarCParserNode::~nsCalICalendarCParserNode() { -} - -NS_IMPL_ADDREF(nsCalICalendarCParserNode) -NS_IMPL_RELEASE(nsCalICalendarCParserNode) - -/** - * Init - * - * @update gess 3/25/98 - * @param - * @return - */ - -nsresult nsCalICalendarCParserNode::Init(CCalICalendarToken* aToken,PRInt32 aLineNumber) -{ - mLineNumber=aLineNumber; - mToken=aToken; - return NS_OK; -} - -/** - * This method gets called as part of our COM-like interfaces. - * Its purpose is to create an interface to parser object - * of some type. - * - * @update gess 3/25/98 - * @param nsIID id of object to discover - * @param aInstancePtr ptr to newly discovered interface - * @return NS_xxx result code - */ -nsresult nsCalICalendarCParserNode::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - - if(aIID.Equals(kISupportsIID)) { //do IUnknown... - *aInstancePtr = (nsIParserNode*)(this); - } - else if(aIID.Equals(kIParserNodeIID)) { //do IParser base class... - *aInstancePtr = (nsIParserNode*)(this); - } - else if(aIID.Equals(kClassIID)) { //do this class... - *aInstancePtr = (nsCalICalendarCParserNode*)(this); - } - else { - *aInstancePtr=0; - return NS_NOINTERFACE; - } - NS_ADDREF_THIS(); - return NS_OK; -} - - -/** - * Causes the given attribute to be added to internal - * mAttributes list, and mAttributeCount to be incremented. - * - * @update gess 3/25/98 - * @param aToken -- token to be added to attr list - * @return - */ -void nsCalICalendarCParserNode::AddAttribute(CCalICalendarToken* aToken) { - NS_PRECONDITION(mAttributeCountGetTokenType(), "not a skipped content token"); - mSkippedContent = aToken; - } -} - - -/** - * Gets the name of this node. Currently unused. - * - * @update gess 3/25/98 - * @param - * @return string ref containing node name - */ -const nsString& nsCalICalendarCParserNode::GetName() const { - return mEmptyString; - // return mName; -} - - -/** - * Get text value of this node, which translates into - * getting the text value of the underlying token - * - * @update gess 3/25/98 - * @param - * @return string ref of text from internal token - */ -const nsString& nsCalICalendarCParserNode::GetText() const { - return mToken->GetStringValueXXX(); -} - -/** - * Get text value of this node, which translates into - * getting the text value of the underlying token - * - * @update gess 3/25/98 - * @param - * @return string ref of text from internal token - */ -const nsString& nsCalICalendarCParserNode::GetSkippedContent() const { - if (nsnull != mSkippedContent) { - return ((CCalICalendarPropertyValueToken*)mSkippedContent)->GetStringValueXXX(); - } - return mEmptyString; -} - -/** - * Get node type, meaning, get the tag type of the - * underlying token - * - * @update gess 3/25/98 - * @param - * @return int value that represents tag type - */ -PRInt32 nsCalICalendarCParserNode::GetNodeType(void) const{ - return mToken->GetTypeID(); -} - - -/** - * Gets the token type, which corresponds to a value from - * eHTMLTokens_xxx. - * - * @update gess 3/25/98 - * @param - * @return - */ -PRInt32 nsCalICalendarCParserNode::GetTokenType(void) const{ - return mToken->GetTokenType(); -} - - -/** - * Retrieve the number of attributes on this node - * - * @update gess 3/25/98 - * @param - * @return int -- representing attribute count - */ -PRInt32 nsCalICalendarCParserNode::GetAttributeCount(PRBool askToken) const{ - if(PR_TRUE==askToken) - return mToken->GetAttributeCount(); - return mAttributeCount; -} - -/** - * Retrieve the string rep of the attribute key at the - * given index. - * - * @update gess 3/25/98 - * @param anIndex-- offset of attribute to retrieve - * @return string rep of given attribute text key - */ -const nsString& nsCalICalendarCParserNode::GetKeyAt(PRInt32 anIndex) const { - if(anIndexGetKey(); - } - return mEmptyString; -} - - -/** - * Retrieve the string rep of the attribute at given offset - * - * @update gess 3/25/98 - * @param anIndex-- offset of attribute to retrieve - * @return string rep of given attribute text value - */ -const nsString& nsCalICalendarCParserNode::GetValueAt(PRInt32 anIndex) const { - NS_PRECONDITION(anIndexGetStringValueXXX(); - } - return mEmptyString; -} - -PRInt32 nsCalICalendarCParserNode::TranslateToUnicodeStr(nsString& aString) const -{ - /* - if (eCalICalendarToken_entity == mToken->GetTokenType()) { - return ((CEntityToken*)mToken)->TranslateToUnicodeStr(aString); - } - */ - return -1; -} - - -/** - * This getter retrieves the line number from the input source where - * the token occured. Lines are interpreted as occuring between \n characters. - * @update gess7/24/98 - * @return int containing the line number the token was found on - */ -PRInt32 nsCalICalendarCParserNode::GetSourceLineNumber(void) const { - return mLineNumber; -} - diff --git a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarTags.cpp b/mozilla/calendar/modules/parser/ical/src/nsCalICalendarTags.cpp deleted file mode 100644 index 2a325ce5fc3..00000000000 --- a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarTags.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- 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.1 (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. - * - * Contributor(s): - */ - -/* Do not edit - generated by gentags.pl */ -#include "nsCRT.h" -#include "nsCalICalendarTags.h" - -static char* tagTable[] = { - "ACTION", "ATTACH", "ATTENDEE", "BEGIN", "CALSCALE", "CATEGORIES", "CLASS", - "COMMENT", "COMPLETED", "CONTACT", "CREATED", "DAYLIGHT", "DESCRIPTION", - "DTEND", "DTSTAMP", "DTSTART", "DUE", "DURATION", "END", "EXDATE", - "EXRULE", "FREEBUSY", "GEO", "LAST-MODIFIED", "LOCATION", "METHOD", - "ORGANIZER", "PERCENT-COMPLETE", "PRIORITY", "PRODID", "RDATE", - "RECURRENCE-ID", "RELATED-TO", "REPEAT", "REQUEST-STATUS", "RESOURCES", - "RRULE", "SEQUENCE", "STANDARD", "STATUS", "SUMMARY", "TRANSP", "TRIGGER", - "TZID", "TZNAME", "TZOFFSETFROM", "TZOFFSETTO", "TZURL", "UID", "URL", - "VALARM", "VCALENDAR", "VERSION", "VEVENT", "VFREEBUSY", "VJOURNAL", - "VTIMEZONE", "VTODO" -}; - -nsCalICalendarTag NS_CalICalendarTagToEnum(const char* aTag) { - int low = 0; - int high = NS_CALICALENDAR_TAG_MAX - 1; - while (low <= high) { - int middle = (low + high) >> 1; - int result = nsCRT::strcasecmp(aTag, tagTable[middle]); - if (result == 0) - return (nsCalICalendarTag) (middle + 1); - if (result < 0) - high = middle - 1; - else - low = middle + 1; - } - return eCalICalendarTag_userdefined; -} - -const char* NS_CalICalendarEnumToTag(nsCalICalendarTag aTagID) { - if ((int(aTagID) <= 0) || (int(aTagID) > NS_CALICALENDAR_TAG_MAX)) { - return 0; - } - return tagTable[int(aTagID) - 1]; -} - -#ifdef NS_DEBUG -#include - -class nsCalICalendarTestTagTable { -public: - nsCalICalendarTestTagTable() { - const char *tag; - nsCalICalendarTag id; - - // Make sure we can find everything we are supposed to - for (int i = 0; i < NS_CALICALENDAR_TAG_MAX; i++) { - tag = tagTable[i]; - id = NS_CalICalendarTagToEnum(tag); - NS_ASSERTION(id != eCalICalendarTag_userdefined, "can't find tag id"); - const char* check = NS_CalICalendarEnumToTag(id); - NS_ASSERTION(check == tag, "can't map id back to tag"); - } - - // Make sure we don't find things that aren't there - id = NS_CalICalendarTagToEnum("@"); - NS_ASSERTION(id == eCalICalendarTag_userdefined, "found @"); - id = NS_CalICalendarTagToEnum("zzzzz"); - NS_ASSERTION(id == eCalICalendarTag_userdefined, "found zzzzz"); - - tag = NS_CalICalendarEnumToTag((nsCalICalendarTag) 0); - NS_ASSERTION(0 == tag, "found enum 0"); - tag = NS_CalICalendarEnumToTag((nsCalICalendarTag) -1); - NS_ASSERTION(0 == tag, "found enum -1"); - tag = NS_CalICalendarEnumToTag((nsCalICalendarTag) (NS_CALICALENDAR_TAG_MAX + 1)); - NS_ASSERTION(0 == tag, "found past max enum"); - } -}; -nsCalICalendarTestTagTable validateTagTable; -#endif - diff --git a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarTokens.cpp b/mozilla/calendar/modules/parser/ical/src/nsCalICalendarTokens.cpp deleted file mode 100644 index d9b4ea562c4..00000000000 --- a/mozilla/calendar/modules/parser/ical/src/nsCalICalendarTokens.cpp +++ /dev/null @@ -1,627 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include -#include -#include -#include "nsScanner.h" -#include "nsToken.h" -#include "nsCalICalendarTokens.h" -#include "nsParserTypes.h" -#include "prtypes.h" -#include "nsDebug.h" -#include "nsCalICalendarTags.h" -//#include "nsCalICalendarEntities.h" // todo: if necessary -#include "nsCRT.h" - -static nsString gIdentChars("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"); -static nsString gNewLine("\n\r"); -static nsAutoString gDigits("0123456789"); -static nsAutoString gWhitespace("\b\t "); -static nsAutoString gDelimeters("\n\r:;"); -static const char* gUserdefined = "userdefined"; -static const char* gEmpty = ""; - -const PRInt32 kMAXNAMELEN=10; - -CCalICalendarToken::CCalICalendarToken(const nsString& aName, eCalICalendarTags aTag) : CToken(aName) { - mTypeID=aTag; -} - -CCalICalendarToken::CCalICalendarToken(eCalICalendarTags aTag) : CToken(aTag) { -} - -void CCalICalendarToken::SetStringValue(const char* name){ - if(name) { - mTextValue=name; - mTypeID = NS_CalICalendarTagToEnum(name); - } -} - -CCalICalendarIdentifierToken::CCalICalendarIdentifierToken(eCalICalendarTags aTag) - : CCalICalendarToken(aTag) { -} - -CCalICalendarIdentifierToken::CCalICalendarIdentifierToken(const nsString& aString, - eCalICalendarTags aTag) - : CCalICalendarToken(aString, aTag) { -} - - -nsresult CCalICalendarIdentifierToken::Consume(PRUnichar aChar, CScanner& aScanner) -{ - mTextValue=aChar; - - nsresult result=aScanner.ReadUntil(mTextValue,gIdentChars,PR_FALSE,PR_FALSE); - if (NS_OK==result) { - mTextValue.StripChars("\r"); - } - return result; -} - - -PRInt32 CCalICalendarIdentifierToken::GetTypeID(){ - if(eCalICalendarTag_unknown==mTypeID) { - nsAutoString tmp(mTextValue); - tmp.ToUpperCase(); - char cbuf[20]; - tmp.ToCString(cbuf, sizeof(cbuf)); - mTypeID = NS_CalICalendarTagToEnum(cbuf); - } - return mTypeID; -} - -const char* CCalICalendarIdentifierToken::GetClassName(void) { - return "identifier"; -} - -PRInt32 CCalICalendarIdentifierToken::GetTokenType(void) { - return eCalICalendarToken_identifier; -} - -void CCalICalendarIdentifierToken::DebugDumpSource(ostream& out) { - char buffer[200]; - mTextValue.ToCString(buffer,sizeof(buffer)-1); - out << "<" << buffer; -} - -CCalICalendarPropertyValueToken::CCalICalendarPropertyValueToken() - : CCalICalendarToken(eCalICalendarTag_unknown) { -} - -CCalICalendarPropertyValueToken::CCalICalendarPropertyValueToken(eCalICalendarTags aTag) - : CCalICalendarToken(aTag) { -} - -CCalICalendarPropertyValueToken::CCalICalendarPropertyValueToken(const nsString& aString, - eCalICalendarTags aTag) - : CCalICalendarToken(aString, aTag) { -} - - -nsresult CCalICalendarPropertyValueToken::Consume(PRUnichar aChar, CScanner& aScanner) -{ - //mTextValue=aChar; - PRUnichar nextChar; - PRBool done = PR_FALSE; - nsString cString; - - nsresult result=aScanner.ReadUntil(mTextValue,gNewLine,PR_TRUE,PR_FALSE); - - /* Consume the next line if starts with a space */ - while (!done) - { - - /* Consume the '\r\n'. Also handles UNIX where '\r' is line end */ - aScanner.GetChar(nextChar); // eat next '\r'; - - // if next char is '\n' eat it also - result = aScanner.Peek(nextChar); - if (kNewline == nextChar) - aScanner.GetChar(nextChar); - - // handle multi-line property values - result = aScanner.Peek(nextChar); - if (kSpace==nextChar) - { - aScanner.GetChar(nextChar); // eat space - cString = ""; - result = aScanner.ReadUntil(cString,gNewLine,PR_TRUE,PR_FALSE); - if (NS_OK == result) - { - mTextValue.Append(cString); - } - else { - // XXX: todo: handle error here. - } - } - else - { - done = PR_TRUE; - } - } - if (NS_OK==result) { - mTextValue.StripChars("\r"); - } - return result; -} - - -PRInt32 CCalICalendarPropertyValueToken::GetTypeID(){ - if(eCalICalendarTag_unknown==mTypeID) { - nsAutoString tmp(mTextValue); - tmp.ToUpperCase(); - char cbuf[20]; - tmp.ToCString(cbuf, sizeof(cbuf)); - mTypeID = NS_CalICalendarTagToEnum(cbuf); - } - return mTypeID; -} - -const char* CCalICalendarPropertyValueToken::GetClassName(void) { - return "propertyValue"; -} - -PRInt32 CCalICalendarPropertyValueToken::GetTokenType(void) { - return eCalICalendarToken_propertyvalue; -} - -void CCalICalendarPropertyValueToken::DebugDumpSource(ostream& out) { - char buffer[200]; - mTextValue.ToCString(buffer,sizeof(buffer)-1); - out << "<" << buffer; -} - -CCalICalendarBeginToken::CCalICalendarBeginToken(eCalICalendarTags aTag) : - CCalICalendarToken(aTag) { - mAttributed=PR_FALSE; - mEmpty=PR_FALSE; -} - -CCalICalendarBeginToken::CCalICalendarBeginToken(const nsString& aString, - eCalICalendarTags aTag) : - CCalICalendarToken(aString,aTag) { - mAttributed=PR_FALSE; - mEmpty=PR_FALSE; -} - -void CCalICalendarBeginToken::Reinitialize(PRInt32 aTag, const nsString& aString){ - CToken::Reinitialize(aTag,aString); - mAttributed=PR_FALSE; - mEmpty=PR_FALSE; -} - - -PRInt32 CCalICalendarBeginToken::GetTypeID(){ - if(eCalICalendarTag_unknown==mTypeID) { - nsAutoString tmp(mTextValue); - tmp.ToUpperCase(); - char cbuf[20]; - tmp.ToCString(cbuf, sizeof(cbuf)); - mTypeID = NS_CalICalendarTagToEnum(cbuf); - } - return mTypeID; -} - -const char* CCalICalendarBeginToken::GetClassName(void) { - return "begin"; -} - -PRInt32 CCalICalendarBeginToken::GetTokenType(void) { - return eCalICalendarToken_begin; -} - -void CCalICalendarBeginToken::SetAttributed(PRBool aValue) { - mAttributed=aValue; -} - -PRBool CCalICalendarBeginToken::IsAttributed(void) { - return mAttributed; -} - -void CCalICalendarBeginToken::SetEmpty(PRBool aValue) { - mEmpty=aValue; -} - -PRBool CCalICalendarBeginToken::IsEmpty(void) { - return mEmpty; -} - -//todo: this needs to be modified more -nsresult CCalICalendarBeginToken::Consume(PRUnichar aChar, CScanner& aScanner) { - - //if you're here, we've need to consume the BEGIN: char, and are - //ready to Consume the rest of the open tag identifier. - //Stop consuming as soon as you see a space or a '\r\n'. - //NOTE: We don't Consume the tag attributes here, nor do we eat the "\r\n" - /* - nsresult result=NS_OK; - aScanner.GetChar(aChar); - mTextValue="BEGIN:"; - if(kMinus==aChar) { - mTextValue+="-"; - */ - - mTextValue=aChar; - nsresult result=aScanner.ReadWhile(mTextValue,gIdentChars,PR_TRUE,PR_FALSE); - char buffer[300]; - mTextValue.ToCString(buffer,sizeof(buffer)-1); - mTypeID = NS_CalICalendarTagToEnum(buffer); - - //Good. Now, let's skip whitespace after the identifier, - //and see if the next char is ">". If so, we have a complete - //tag without attributes. - if(NS_OK==result) { - result=aScanner.SkipWhitespace(); - if(NS_OK==result) { - result=aScanner.GetChar(aChar); - if(NS_OK==result) { - if(kSemiColon==aChar) { //look for ';' - //push that char back, since we apparently have attributes... - aScanner.PutBack(aChar); - mAttributed=PR_TRUE; - } //if - } //if - }//if - } - - // skip "BEGIN" or "END", reset mTextValue to VCALENDAR,VEVENT,etc.. - if (mTypeID == eCalICalendarTag_begin || mTypeID == eCalICalendarTag_end) - { - result = aScanner.SkipWhitespace(); - if (NS_OK == result) - { - mTextValue=""; - result = aScanner.ReadWhile(mTextValue,gIdentChars,PR_TRUE,PR_FALSE); - } - } - - return result; -}; - -void CCalICalendarBeginToken::DebugDumpSource(ostream& out) { - char buffer[200]; - mTextValue.ToCString(buffer,sizeof(buffer)-1); - out << "BEGIN:" << buffer; - if(!mAttributed) - out << "\r\n"; -} - -CCalICalendarEndToken::CCalICalendarEndToken(eCalICalendarTags aTag) - : CCalICalendarToken(aTag) { -} - -CCalICalendarEndToken::CCalICalendarEndToken(const nsString& aName, eCalICalendarTags aTag) - : CCalICalendarToken(aName, aTag) { -} - -// todo: revisit -nsresult CCalICalendarEndToken::Consume(PRUnichar aChar, CScanner& aScanner) { - - //if you're here, we've already Consumed the "END:" chars, and are - //ready to Consume the rest of the open tag identifier. - //Stop consuming as soon as you see a space or a '\r\n'. - //NOTE: We don't Consume the tag attributes here, nor do we eat the ">" - - mTextValue=""; - nsresult result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_FALSE); - - char buffer[300]; - mTextValue.ToCString(buffer,sizeof(buffer)-1); - mTypeID= NS_CalICalendarTagToEnum(buffer); - - if(NS_OK==result) - result=aScanner.GetChar(aChar); //eat the closing '>; - return result; -} - -PRInt32 CCalICalendarEndToken::GetTypeID(){ - if (eCalICalendarTag_unknown==mTypeID) { - nsAutoString tmp(mTextValue); - tmp.ToUpperCase(); - char cbuf[200]; - tmp.ToCString(cbuf, sizeof(cbuf)); - mTypeID = NS_CalICalendarTagToEnum(cbuf); - } - return mTypeID; -} - -const char* CCalICalendarEndToken::GetClassName(void) { - return "/end"; -} - -PRInt32 CCalICalendarEndToken::GetTokenType(void) { - return eCalICalendarToken_end; -} - -void CCalICalendarEndToken::DebugDumpSource(ostream& out) { - char buffer[200]; - mTextValue.ToCString(buffer,sizeof(buffer)-1); - out << "END:" << buffer << "\r\n"; -} - -CCalICalendarTextToken::CCalICalendarTextToken() : - CCalICalendarToken(eCalICalendarTag_text) { -} - -CCalICalendarTextToken::CCalICalendarTextToken(const nsString& aName) : - CCalICalendarToken(aName) { - mTypeID=eCalICalendarTag_text; -} - -const char* CCalICalendarTextToken::GetClassName(void) { - return "text"; -} - -PRInt32 CCalICalendarTextToken::GetTokenType(void) { - return eCalICalendarToken_text; -} - -//todo: revisit -nsresult CCalICalendarTextToken::Consume(PRUnichar aChar, CScanner& aScanner) { - static nsAutoString terminals("&<\r"); - nsresult result=NS_OK; - PRBool done=PR_FALSE; - - while((NS_OK==result) && (!done)) { - result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE,PR_FALSE); - if(NS_OK==result) { - result=aScanner.Peek(aChar); - if(kCR==aChar) { - result=aScanner.GetChar(aChar); //strip off the \r - result=aScanner.Peek(aChar); //then see what's next. - switch(aChar) { - case kCR: - result=aScanner.GetChar(aChar); //strip off the \r - mTextValue.Append("\n\n"); - break; - case kNewLine: - //which means we saw \r\n, which becomes \n - result=aScanner.GetChar(aChar); //strip off the \n - //now fall through on purpose... - default: - mTextValue.Append("\n"); - break; - } - } - else done=PR_TRUE; - } - } - return result; -} - -CCalICalendarNewlineToken::CCalICalendarNewlineToken() : CCalICalendarToken(eCalICalendarTag_newline) { -} - -CCalICalendarNewlineToken::CCalICalendarNewlineToken(const nsString& aName) : CCalICalendarToken(aName) { - mTypeID=eCalICalendarTag_newline; -} - -const char* CCalICalendarNewlineToken::GetClassName(void) { - return "CRLF"; -} - -PRInt32 CCalICalendarNewlineToken::GetTokenType(void) { - return eCalICalendarToken_newline; -} - -nsString& CCalICalendarNewlineToken::GetStringValueXXX(void) { - static nsAutoString theStr("\n"); - return theStr; -} - -nsresult CCalICalendarNewlineToken::Consume(PRUnichar aChar, CScanner& aScanner) { - mTextValue=aChar; - - //we already read the \r or \n, let's see what's next! - PRUnichar nextChar; - nsresult result=aScanner.Peek(nextChar); - - if(NS_OK==result) { - switch(aChar) { - case kNewLine: - if(kCR==nextChar) { - result=aScanner.GetChar(nextChar); - mTextValue+=nextChar; - } - break; - case kCR: - if(kNewLine==nextChar) { - result=aScanner.GetChar(nextChar); - mTextValue+=nextChar; - } - break; - default: - break; - } - } - return result; -} - -CCalICalendarAttributeToken::CCalICalendarAttributeToken() : CCalICalendarToken(eCalICalendarTag_unknown) { -} - -CCalICalendarAttributeToken::CCalICalendarAttributeToken(const nsString& aName) : - CCalICalendarToken(aName), - mTextKey() { - mLastAttribute=PR_FALSE; -} - -CCalICalendarAttributeToken::CCalICalendarAttributeToken(const nsString& aKey, - const nsString& aName) : - CCalICalendarToken(aName) { - mTextKey = aKey; - mLastAttribute=PR_FALSE; -} - -void CCalICalendarAttributeToken::Reinitialize(PRInt32 aTag, const nsString& aString){ - CCalICalendarToken::Reinitialize(aTag,aString); - mTextKey.Truncate(); - mLastAttribute=PR_FALSE; -} - -const char* CCalICalendarAttributeToken::GetClassName(void) { - return "attr"; -} - -PRInt32 CCalICalendarAttributeToken::GetTokenType(void) { - return eCalICalendarToken_attribute; -} - -void CCalICalendarAttributeToken::DebugDumpToken(ostream& out) { - char buffer[200]; - mTextKey.ToCString(buffer,sizeof(buffer)-1); - out << "[" << GetClassName() << "] " << buffer << "="; - mTextValue.ToCString(buffer,sizeof(buffer)-1); - out << buffer << ": " << mTypeID << endl; -} - -PRInt32 CalICalendarConsumeQuotedString(PRUnichar aChar,nsString& aString,CScanner& aScanner){ - PRInt32 result=kNotFound; - switch(aChar) { - case kQuote: - result=aScanner.ReadUntil(aString,kQuote,PR_TRUE); - break; - case kApostrophe: - result=aScanner.ReadUntil(aString,kApostrophe,PR_TRUE); - break; - default: - break; - } - PRUnichar ch=aString.Last(); - if(ch!=aChar) - aString+=aChar; - return result; -} - -// todo: revisit -PRInt32 CalICalendarConsumeAttributeValueText(PRUnichar,nsString& aString,CScanner& aScanner){ - - PRInt32 result=kNotFound; - static nsAutoString terminals(":;"); - - result=aScanner.ReadUntil(aString,terminals,PR_FALSE,PR_FALSE); - return result; -} - -PRInt32 ConsumeAttributeValueText(PRUnichar,nsString& aString,CScanner& aScanner) { - PRInt32 result=kNotFound; - static nsAutoString terminals(":;"); - result=aScanner.ReadUntil(aString,terminals,PR_FALSE,PR_FALSE); - return result; -} - -// todo: revisit -nsresult CCalICalendarAttributeToken::Consume(PRUnichar aChar, CScanner& aScanner) { - - aScanner.SkipWhitespace(); //skip leading whitespace - nsresult result=aScanner.Peek(aChar); - if(NS_OK==result) { - static nsAutoString terminals("\b\t\n\r \"="); - result=aScanner.ReadUntil(mTextKey,terminals,PR_TRUE,PR_FALSE); - - //now it's time to Consume the (optional) value... - if(NS_OK == (result=aScanner.SkipWhitespace())) { - //Skip ahead until you find an equal sign or a '>'... - if(NS_OK == (result=aScanner.Peek(aChar))) { - if(kEqual==aChar){ - result=aScanner.GetChar(aChar); //skip the equal sign... - if(NS_OK==result) { - result=aScanner.SkipWhitespace(); //now skip any intervening whitespace - if(NS_OK==result) { - result=aScanner.GetChar(aChar); //and grab the next char. - if(NS_OK==result) { - if((kQuote==aChar) || (kApostrophe==aChar)) { - mTextValue=aChar; - result=CalICalendarConsumeQuotedString(aChar,mTextValue,aScanner); - } - else { - mTextValue=aChar; //it's an alphanum attribute... - result=ConsumeAttributeValueText(aChar,mTextValue,aScanner); - } - }//if - if(NS_OK==result) - result=aScanner.SkipWhitespace(); - }//if - }//if - }//if - }//if -// }if - } - if(NS_OK==result) { - result=aScanner.Peek(aChar); - mLastAttribute= PRBool((kColon==aChar) || (kEOF==result)); - } - } - return result; -} - -void CCalICalendarAttributeToken::DebugDumpSource(ostream& out) { - char buffer[200]; - mTextKey.ToCString(buffer,sizeof(buffer)-1); - out << " " << buffer; - if(mTextValue.Length()){ - mTextValue.ToCString(buffer,sizeof(buffer)-1); - out << "=" << buffer; - } - if(mLastAttribute) - out<<">"; -} - -CCalICalendarWhitespaceToken::CCalICalendarWhitespaceToken() : - CCalICalendarToken(eCalICalendarTag_whitespace) { -} - -CCalICalendarWhitespaceToken::CCalICalendarWhitespaceToken(const nsString& aName) : - CCalICalendarToken(aName) { - mTypeID=eCalICalendarTag_whitespace; -} - -const char* CCalICalendarWhitespaceToken::GetClassName(void) { - return "ws"; -} - -PRInt32 CCalICalendarWhitespaceToken::GetTokenType(void) { - return eCalICalendarToken_whitespace; -} - -nsresult CCalICalendarWhitespaceToken::Consume(PRUnichar aChar, CScanner& aScanner) { - - mTextValue=aChar; - - nsresult result=aScanner.ReadWhile(mTextValue,gWhitespace,PR_FALSE,PR_FALSE); - if(NS_OK==result) { - mTextValue.StripChars("\r"); - } - return result; -} - -const char* CalICalendarGetTagName(PRInt32 aTag) { - const char* result = NS_CalICalendarEnumToTag((nsCalICalendarTag) aTag); - if (0 == result) { - if(aTag>=eCalICalendarTag_userdefined) - result = gUserdefined; - else result= gEmpty; - } - return result; -} - diff --git a/mozilla/calendar/modules/parser/ical/tools/gentags.pl b/mozilla/calendar/modules/parser/ical/tools/gentags.pl deleted file mode 100644 index 9681fcf1723..00000000000 --- a/mozilla/calendar/modules/parser/ical/tools/gentags.pl +++ /dev/null @@ -1,278 +0,0 @@ -#! /usr/local/bin/perl - -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (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. -# -# Contributor(s): - -###################################################################### - -# Table of tag names; it doesn't have to be sorted because code -# below will do it. However, for the sake of ease of additions, keep -# it sorted so that its easy to tell where to add a new tag and that -# the tag hasn't already been added. -$i = 0; -$tags[$i++] = "action"; -$tags[$i++] = "attach"; -$tags[$i++] = "attendee"; -$tags[$i++] = "begin"; -$tags[$i++] = "calscale"; -$tags[$i++] = "categories"; -$tags[$i++] = "class"; -$tags[$i++] = "comment"; -$tags[$i++] = "completed"; -$tags[$i++] = "contact"; -$tags[$i++] = "created"; -$tags[$i++] = "daylight"; -$tags[$i++] = "description"; -$tags[$i++] = "dtend"; -$tags[$i++] = "dtstart"; -$tags[$i++] = "dtstamp"; -$tags[$i++] = "due"; -$tags[$i++] = "duration"; -$tags[$i++] = "end"; -$tags[$i++] = "exdate"; -$tags[$i++] = "exrule"; -$tags[$i++] = "freebusy"; -$tags[$i++] = "geo"; -$tags[$i++] = "last_modified"; -$tags[$i++] = "location"; -$tags[$i++] = "method"; -$tags[$i++] = "organizer"; -$tags[$i++] = "percent_complete"; -$tags[$i++] = "priority"; -$tags[$i++] = "prodid"; -$tags[$i++] = "rdate"; -$tags[$i++] = "rrule"; -$tags[$i++] = "recurrence_id"; -$tags[$i++] = "related_to"; -$tags[$i++] = "repeat"; -$tags[$i++] = "request_status"; -$tags[$i++] = "resources"; -$tags[$i++] = "sequence"; -$tags[$i++] = "standard"; -$tags[$i++] = "status"; -$tags[$i++] = "summary"; -$tags[$i++] = "transp"; -$tags[$i++] = "trigger"; -$tags[$i++] = "tzid"; -$tags[$i++] = "tzname"; -$tags[$i++] = "tzoffsetfrom"; -$tags[$i++] = "tzoffsetto"; -$tags[$i++] = "tzurl"; -$tags[$i++] = "uid"; -$tags[$i++] = "url"; -$tags[$i++] = "valarm"; -$tags[$i++] = "vcalendar"; -$tags[$i++] = "version"; -$tags[$i++] = "vevent"; -$tags[$i++] = "vfreebusy"; -$tags[$i++] = "vjournal"; -$tags[$i++] = "vtimezone"; -$tags[$i++] = "vtodo"; - -###################################################################### - -# These are not tags; rather they are extra values to place into the -# tag enumeration after the normal tags. These do not need to be sorted -# and they do not go into the tag table, just into the tag enumeration. -$extra = 0; -$extra_tags[$extra++] = "text"; -$extra_tags[$extra++] = "whitespace"; -$extra_tags[$extra++] = "newline"; -$extra_tags[$extra++] = "entity"; -$extra_tags[$extra++] = "userdefined"; - -###################################################################### - -# Sort the tag table before using it -@tags = sort @tags; - -$copyright = "/* -*- 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 \"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. - */ - -/* Do not edit - generated by gentags.pl */ -"; - -###################################################################### - -$file_base = @ARGV[0]; - -# Generate the header file first -open(HEADER_FILE, ">$file_base.h"); - -# Print out copyright and do not edit notice -print HEADER_FILE $copyright; -print HEADER_FILE "#ifndef " . $file_base . "_h___\n"; -print HEADER_FILE "#define " . $file_base . "_h___\n"; -print HEADER_FILE "#include \"nscalicalendarpars.h\"\n"; - -# Print out enum's for the tag symbols -print HEADER_FILE "enum nsCalICalendarTag {\n"; -print HEADER_FILE " /* this enum must be first and must be zero */\n"; -print HEADER_FILE " eCalICalendarTag_unknown=0,\n\n"; -print HEADER_FILE " /* begin tag enums */\n "; -$width = 2; -print HEADER_FILE $str; -for ($j = 0; $j < $i; $j++) { - $lower = $tags[$j]; - $lower =~ tr/A-Z/a-z/; - $str = "eCalICalendarTag_" . $lower . "=" . ($j + 1); - $str = $str . ", "; - $len = length($str); - if ($width + $len > 78) { - print HEADER_FILE "\n "; - $width = 2; - } - print HEADER_FILE $str; - $width = $width + $len; -} -print HEADER_FILE "\n\n /* The remaining enums are not for tags */\n "; - -# Print out extra enum's that are not in the tag table -$width = 2; -for ($k = 0; $k < $extra; $k++) { - $lower = $extra_tags[$k]; - $lower =~ tr/A-Z/a-z/; - $str = "eCalICalendarTag_" . $lower . "=" . ($j + $k + 1); - if ($k < $extra - 1) { - $str = $str . ", "; - } - $len = length($str); - if ($width + $len > 78) { - print HEADER_FILE "\n "; - $width = 2; - } - print HEADER_FILE $str; - $width = $width + $len; -} - -print HEADER_FILE "\n};\n#define NS_CALICALENDAR_TAG_MAX " . $j . "\n\n"; -print HEADER_FILE "extern NS_CALICALENDARPARS nsCalICalendarTag NS_CalICalendarTagToEnum(const char* aTag);\n"; -print HEADER_FILE "extern NS_CALICALENDARPARS const char* NS_CalICalendarEnumToTag(nsCalICalendarTag aEnum);\n\n"; -print HEADER_FILE "#endif /* " . $file_base . "_h___ */\n"; -close(HEADER_FILE); - -###################################################################### - -# Generate the source file -open(CPP_FILE, ">$file_base.cpp"); -print CPP_FILE $copyright; -print CPP_FILE "#include \"nsCRT.h\"\n"; -print CPP_FILE "#include \"$file_base.h\"\n\n"; - -# Print out table of tag names -print CPP_FILE "static char* tagTable[] = {\n "; -$width = 2; -for ($j = 0; $j < $i; $j++) { - $upper = $tags[$j]; - $upper =~ tr/a-z/A-Z/; - $upper =~ s/_/-/; - $str = "\"" . $upper . "\""; - if ($j < $i - 1) { - $str = $str . ", "; - } - $len = length($str); - if ($width + $len > 78) { - print CPP_FILE "\n "; - $width = 2; - } - print CPP_FILE $str; - $width = $width + $len; -} -print CPP_FILE "\n};\n"; - -# Finally, dump out the search routine that takes a char* and finds it -# in the table. -print CPP_FILE " -nsCalICalendarTag NS_CalICalendarTagToEnum(const char* aTag) { - int low = 0; - int high = NS_CALICALENDAR_TAG_MAX - 1; - while (low <= high) { - int middle = (low + high) >> 1; - int result = nsCRT::strcasecmp(aTag, tagTable[middle]); - if (result == 0) - return (nsCalICalendarTag) (middle + 1); - if (result < 0) - high = middle - 1; - else - low = middle + 1; - } - return eCalICalendarTag_userdefined; -} - -const char* NS_CalICalendarEnumToTag(nsCalICalendarTag aTagID) { - if ((int(aTagID) <= 0) || (int(aTagID) > NS_CALICALENDAR_TAG_MAX)) { - return 0; - } - return tagTable[int(aTagID) - 1]; -} - -#ifdef NS_DEBUG -#include - -class nsCalICalendarTestTagTable { -public: - nsCalICalendarTestTagTable() { - const char *tag; - nsCalICalendarTag id; - - // Make sure we can find everything we are supposed to - for (int i = 0; i < NS_CALICALENDAR_TAG_MAX; i++) { - tag = tagTable[i]; - id = NS_CalICalendarTagToEnum(tag); - NS_ASSERTION(id != eCalICalendarTag_userdefined, \"can't find tag id\"); - const char* check = NS_CalICalendarEnumToTag(id); - NS_ASSERTION(check == tag, \"can't map id back to tag\"); - } - - // Make sure we don't find things that aren't there - id = NS_CalICalendarTagToEnum(\"@\"); - NS_ASSERTION(id == eCalICalendarTag_userdefined, \"found @\"); - id = NS_CalICalendarTagToEnum(\"zzzzz\"); - NS_ASSERTION(id == eCalICalendarTag_userdefined, \"found zzzzz\"); - - tag = NS_CalICalendarEnumToTag((nsCalICalendarTag) 0); - NS_ASSERTION(0 == tag, \"found enum 0\"); - tag = NS_CalICalendarEnumToTag((nsCalICalendarTag) -1); - NS_ASSERTION(0 == tag, \"found enum -1\"); - tag = NS_CalICalendarEnumToTag((nsCalICalendarTag) (NS_CALICALENDAR_TAG_MAX + 1)); - NS_ASSERTION(0 == tag, \"found past max enum\"); - } -}; -nsCalICalendarTestTagTable validateTagTable; -#endif - -"; - -close(CPP_FILE); diff --git a/mozilla/calendar/modules/parser/manifest.mn b/mozilla/calendar/modules/parser/manifest.mn deleted file mode 100644 index 9b115e42f43..00000000000 --- a/mozilla/calendar/modules/parser/manifest.mn +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../.. -DEPTH = ../../.. - -DIRS = core calxml - -LIBRARY_NAME = calparser - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = xpcom raptor shell trex diff --git a/mozilla/calendar/modules/shell/Makefile b/mozilla/calendar/modules/shell/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/shell/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/shell/inc/Makefile b/mozilla/calendar/modules/shell/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/shell/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/shell/inc/manifest.mn b/mozilla/calendar/modules/shell/inc/manifest.mn deleted file mode 100644 index 5591b71c19f..00000000000 --- a/mozilla/calendar/modules/shell/inc/manifest.mn +++ /dev/null @@ -1,30 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. - -EXPORTS = \ - nsCalendarWidget.h \ - nsCalendarShell.h \ - nsCalendarContainer.h \ - nsCalShellCIID.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - nscalcids.h \ - nsCalShellCIID.h \ - nsCalendarShell.h \ - nsCalendarWidget.h \ - nsCalShellFactory.h \ - nsCalTestStrings.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/shell/inc/nsCalShellCIID.h b/mozilla/calendar/modules/shell/inc/nsCalShellCIID.h deleted file mode 100644 index 7e1a18560f4..00000000000 --- a/mozilla/calendar/modules/shell/inc/nsCalShellCIID.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalShellCIID_h__ -#define nsCalSehllCIID_h__ - -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsRepository.h" - -//d98368c0-ea8e-11d1-9244-00805f8a7ab6 -#define NS_CALENDAR_WIDGET_CID \ -{ 0xd98368c0, 0xea8e, 0x11d1, \ -{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//dffa50d0-ea8e-11d1-9244-00805f8a7ab6 -#define NS_CAL_SHELL_CID \ -{ 0xdffa50d0, 0xea8e, 0x11d1, \ -{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//ac62f5d0-3077-11d2-9247-00805f8a7ab6 -#define NS_CALENDAR_CONTAINER_CID \ -{ 0xac62f5d0, 0x3077, 0x11d2, \ -{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - - -#endif diff --git a/mozilla/calendar/modules/shell/inc/nsCalShellFactory.h b/mozilla/calendar/modules/shell/inc/nsCalShellFactory.h deleted file mode 100644 index 03a1ae69891..00000000000 --- a/mozilla/calendar/modules/shell/inc/nsCalShellFactory.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsIFactory.h" -#include "nsISupports.h" -#include "nsCalShellCIID.h" - -#include "nsCalendarShell.h" -#include "nsCalendarWidget.h" - -class nsCalShellFactory : public nsIFactory -{ - public: - // nsISupports methods - NS_IMETHOD QueryInterface(const nsIID &aIID, - void **aResult); - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - // nsIFactory methods - NS_IMETHOD CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult); - - NS_IMETHOD LockFactory(PRBool aLock); - - nsCalShellFactory(const nsCID &aClass); - ~nsCalShellFactory(); - - private: - nsrefcnt mRefCnt; - nsCID mClassID; -}; - diff --git a/mozilla/calendar/modules/shell/inc/nsCalTestStrings.h b/mozilla/calendar/modules/shell/inc/nsCalTestStrings.h deleted file mode 100644 index d04d69db0d4..00000000000 --- a/mozilla/calendar/modules/shell/inc/nsCalTestStrings.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTestStrings_h___ -#define nsCalTestStrings_h___ - -#define ZULUCOMMAND_HELP "Valid JS commands are:\r\n\r\n" \ - " zulucommand(\"help\",\"help\"); Get even more help on help\r\n" \ - " zulucommand(\"help\",\"panel\"); Get help on specifying methods for panels\r\n" - -#define ZULUCOMMAND_HELP_PANEL "***panel syntax is:***\r\n\r\n" \ - " zulucommand(\"panel\",\"name\",\"method\",\"param1\",...,\"paramN\");\r\n\r\n" \ - " where: \r\n" \ - " name: XML Name of the panel\r\n" \ - " method: Method to be invoked on panel\r\n" \ - " paramX: Arbitrary list of parameters to be passed to method\r\n\r\n" \ - "***Available Methods include:***\r\n" \ - " \"getbackgroundcolor\" - Get the background color for named canvas\r\n" \ - " \"setbackgroundcolor\",\"#RRGGBB\" - Set the background color to named canvas\r\n" \ - -#endif //nsCalTestStrings_h___ - diff --git a/mozilla/calendar/modules/shell/inc/nsCalendarContainer.h b/mozilla/calendar/modules/shell/inc/nsCalendarContainer.h deleted file mode 100644 index a4ec4f6303d..00000000000 --- a/mozilla/calendar/modules/shell/inc/nsCalendarContainer.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalendarContainer_h___ -#define nsCalendarContainer_h___ - -#include -#include "nsICalendarContainer.h" -#include "nsIXPFCMenuBar.h" -#include "nsString.h" -#include "nsICalendarShell.h" -#include "nsICalendarWidget.h" -#include "nsIWidget.h" -#include "nsIStreamListener.h" -#include "nsIMenuManager.h" -#include "nsICalToolkit.h" -#include "nsIViewManager.h" - -class nsCalendarContainer : public nsICalendarContainer { - -public: - nsCalendarContainer(); - ~nsCalendarContainer(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(nsIWidget * aParent, - const nsRect& aBounds, - nsICalendarShell * aCalendarShell); - NS_IMETHOD LoadURL(const nsString& aURLSpec, - nsIStreamObserver* aListener, - nsIXPFCCanvas * aParentCanvas = 0, - nsIPostData* aPostData = 0); - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent); - -public: - NS_IMETHOD SetTitle(const nsString& aTitle) ; - NS_IMETHOD GetTitle(nsString& aResult) ; - - NS_IMETHOD SetMenuBar(nsIXPFCMenuBar * aMenuBar) ; - NS_IMETHOD UpdateMenuBar(); - - NS_IMETHOD_(nsICalendarWidget *) GetDocumentWidget(); - - NS_IMETHOD SetMenuManager(nsIMenuManager * aMenuManager) ; - NS_IMETHOD_(nsIMenuManager *) GetMenuManager() ; - - NS_IMETHOD QueryCapability(const nsIID &aIID, void** aResult); - NS_IMETHOD Embed(nsIContentViewer* aDocViewer, - const char* aCommand, - nsISupports* aExtraInfo); - NS_IMETHOD SetContentViewer(nsIContentViewer* aViewer); - NS_IMETHOD GetContentViewer(nsIContentViewer*& aResult); - NS_IMETHOD SetApplicationShell(nsIApplicationShell* aShell); - NS_IMETHOD GetApplicationShell(nsIApplicationShell*& aResult); - - NS_IMETHOD SetToolbarManager(nsIXPFCToolbarManager * aToolbarManager); - NS_IMETHOD_(nsIXPFCToolbarManager *) GetToolbarManager(); - NS_IMETHOD AddToolbar(nsIXPFCToolbar * aToolbar); - NS_IMETHOD RemoveToolbar(nsIXPFCToolbar * aToolbar); - NS_IMETHOD UpdateToolbars(); - - NS_IMETHOD ShowDialog(nsIXPFCDialog * aDialog); - - NS_IMETHOD_(nsEventStatus) ProcessCommand(nsIXPFCCommand * aCommand) ; - -private: - NS_METHOD ProcessActionCommand(nsString& aCommand); - -public: - nsICalendarShell * mCalendarShell; - -private: - nsIMenuManager * mMenuManager; - nsIXPFCToolbarManager * mToolbarManager; - nsICalendarWidget * mCalendarWidget; - nsIXPFCCanvas * mRootCanvas; - nsICalToolkit * mToolkit; - -}; - -extern NS_CALENDAR nsresult NS_NewCalendarContainer(nsICalendarContainer** aInstancePtrResult); - -#endif //nsCalendarContainer_h___ diff --git a/mozilla/calendar/modules/shell/inc/nsCalendarShell.h b/mozilla/calendar/modules/shell/inc/nsCalendarShell.h deleted file mode 100644 index c11fd8bd6ef..00000000000 --- a/mozilla/calendar/modules/shell/inc/nsCalendarShell.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef _nsCalendarShell_h__ -#define _nsCalendarShell_h__ - -#include -#include "nsICalendarShell.h" -#include "nsIFactory.h" -#include "nsRepository.h" -#include "nsIShellInstance.h" -#include "nsIWidget.h" -#include "nsGUIEvent.h" -#include "nsRect.h" -#include "nsApplicationManager.h" -#include "nsIContentViewer.h" -#include "nsCalendarContainer.h" -#include "nsIXPFCObserverManager.h" -#include "nsCalUICIID.h" -#include "nsCalUtilCIID.h" -#include "nsCRT.h" -#include "plstr.h" -#include "julnstr.h" -#include "nsICommandServer.h" -#include "nsCalList.h" -#include "nsCalUserList.h" -#include "nsCalSessionMgr.h" -#include "capi.h" - -/* - * CalendarShell Class Declaration - */ -class nsCalLoggedInUser; - -class nsCalendarShell : public nsICalendarShell { -public: - nsCalendarShell(); - ~nsCalendarShell(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - NS_METHOD Logon(); - NS_METHOD Logoff(); - NS_METHOD LoadUI(); - NS_METHOD LoadPreferences(); - NS_METHOD ParseCommandLine(); - NS_METHOD ExecuteCommandScript(nsString aScript); - - NS_METHOD EnsureUserPath( JulianString& sPath ); - - NS_IMETHOD SetCAPISession(CAPISession aCAPISession); - NS_IMETHOD_(CAPISession) GetCAPISession(); - - NS_IMETHOD SetCAPIHandle(CAPIHandle aCAPIHandle); - NS_IMETHOD_(CAPIHandle) GetCAPIHandle(); - - NS_IMETHOD SetCAPIPassword(char * aPassword) ; - NS_IMETHOD_(char *) GetCAPIPassword() ; - - NS_IMETHOD GetLoggedInUser(nsICalendarUser** LoggInUser); - - // nsIAppShell interfaces - NS_IMETHOD Create(int* argc, char ** argv) ; - NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener) ; - NS_IMETHOD Exit(); - virtual nsresult Run(); - virtual void* GetNativeData(PRUint32 aDataType) ; - - NS_IMETHOD ReceiveCallback(nsICollectedData& aReply); - NS_IMETHOD CreateEventFunc(nsICollectedData& cdp); - - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) ; - NS_IMETHOD GetWebViewerContainer(nsIWebViewerContainer ** aWebViewerContainer) ; - - NS_IMETHOD StartCommandServer(); - NS_IMETHOD ReceiveCommand(nsString& aCommand, nsString& aReply); - NS_IMETHOD InitFactoryObjs(); - -private: - NS_METHOD InitialLoadData(); - NS_METHOD RegisterFactories(); - NS_METHOD SetDefaultPreferences(); - NS_METHOD EnvVarsToValues(JulianString& s); - NS_METHOD SendCommand(nsString& aCommand, nsString& aReply); - -private: - nsIXPFCObserverManager * mObserverManager; - -// XXX Should be private -public: - nsIShellInstance * mShellInstance ; - nsICalendarContainer * mDocumentContainer ; - - CAPISession mCAPISession; - CAPIHandle mCAPIHandle; - nsICalendarUser* mpLoggedInUser; - - JulianString msCalURL; /* the calendar associated with this user */ - char * mCAPIPassword; /* the password which must be entered by the user */ - - nsCalUserList mUserList; - nsCalList mCalList; - nsCalSessionMgr mSessionMgr; - nsICommandServer * mCommandServer; - -}; - -nsEventStatus PR_CALLBACK HandleEventApplication(nsGUIEvent *aEvent) ; - -#endif diff --git a/mozilla/calendar/modules/shell/inc/nsCalendarWidget.h b/mozilla/calendar/modules/shell/inc/nsCalendarWidget.h deleted file mode 100644 index cc929b1511f..00000000000 --- a/mozilla/calendar/modules/shell/inc/nsCalendarWidget.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalendarWidget_h___ -#define nsCalendarWidget_h___ - -#include -#include "nsICalendarWidget.h" -#include "nsIWidget.h" -#include "nsString.h" -#include "nsIXPFCCanvas.h" -#include "nsFont.h" -#include "nsIURL.h" -#include "nsIStreamListener.h" -#include "nsIDTD.h" -#include "nsIParser.h" -#include "nscalexport.h" -#include "nsICalToolkit.h" -#include "nsXPFCCanvas.h" - - -// Machine independent implementation portion of the calendar widget -class nsCalendarWidget : public nsICalendarWidget -{ -public: - nsCalendarWidget(); - ~nsCalendarWidget(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(nsNativeWidget aParent, - nsIDeviceContext* aDeviceContext, - nsIPref* aPrefs, - const nsRect& aBounds, - nsScrollPreference aScrolling = nsScrollPreference_kAuto); - - - NS_IMETHOD Init(nsIView * aParent, - const nsRect& aBounds, - nsICalendarShell * aCalendarShell); - - virtual nsRect GetBounds(); - virtual void SetBounds(const nsRect& aBounds); - virtual void Show(); - virtual void Hide(); - virtual void Move(PRInt32 aX, PRInt32 aY) ; - - NS_IMETHOD BindToDocument(nsISupports *aDoc, const char *aCommand); - - NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer); - - NS_IMETHOD GetContainer(nsIContentViewerContainer*& aContainerResult); - - NS_IMETHOD LoadURL(const nsString& aURLSpec, - nsIStreamObserver* aListener, - nsIXPFCCanvas * aParentCanvas = 0, - nsIPostData* aPostData = 0); - - virtual nsIWidget* GetWWWindow(); - - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent); - -private: - nsIWidget * mWindow; - nsIStreamListener * mStreamListener; - -public: - nsICalendarShell * mCalendarShell; - -}; - -// Create a new calendar widget that uses the default presentation -// context. -extern NS_CALENDAR nsresult NS_NewCalendarWidget(nsICalendarWidget** aInstancePtrResult); - -#endif //nsCalendarWidget_h___ diff --git a/mozilla/calendar/modules/shell/inc/nscalcids.h b/mozilla/calendar/modules/shell/inc/nscalcids.h deleted file mode 100644 index fd20efb9bdc..00000000000 --- a/mozilla/calendar/modules/shell/inc/nscalcids.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef __NS_CALCIDS_H -#define __NS_CALCIDS_H - -#include "nsCalUICIID.h" -#include "nsCalUtilCIID.h" -#include "nsCalParserCIID.h" -#include "nsxpfcCIID.h" - -static NS_DEFINE_IID(kICalWidgetIID, NS_ICALENDAR_WIDGET_IID); -static NS_DEFINE_IID(kCCalMultiDayViewCID, NS_CAL_MULTIDAYVIEWCANVAS_CID); -static NS_DEFINE_IID(kCCalMultiUserViewCID, NS_CAL_MULTIUSERVIEWCANVAS_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); -static NS_DEFINE_IID(kCXPFCCanvasCID, NS_XPFC_CANVAS_CID); -static NS_DEFINE_IID(kCCalTimeContextCID, NS_CAL_TIME_CONTEXT_CID); -static NS_DEFINE_IID(kCCalComponentCID, NS_CAL_COMPONENT_CID); -static NS_DEFINE_IID(kCCalContextControllerCID, NS_CAL_CONTEXT_CONTROLLER_CID); -static NS_DEFINE_IID(kCLayoutCID, NS_LAYOUT_CID); -static NS_DEFINE_IID(kCBoxLayoutCID, NS_BOXLAYOUT_CID); -static NS_DEFINE_IID(kCCalTimebarContextControllerCID, NS_CAL_TIMEBAR_CONTEXT_CONTROLLER_CID); -static NS_DEFINE_IID(kCCalMonthContextControllerCID, NS_CAL_MONTH_CONTEXT_CONTROLLER_CID); -static NS_DEFINE_IID(kCXPFCCommandCID, NS_XPFC_COMMAND_CID); -static NS_DEFINE_IID(kCXPFCObserverCID, NS_XPFC_OBSERVER_CID); -static NS_DEFINE_IID(kCXPFCSubjectCID, NS_XPFC_SUBJECT_CID); -static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); -static NS_DEFINE_IID(kCXPFCCanvasManagerCID, NS_XPFC_CANVASMANAGER_CID); -static NS_DEFINE_IID(kCCalToolkitCID, NS_CAL_TOOLKIT_CID); -static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID); -static NS_DEFINE_IID(kCVectorIteratorCID, NS_ARRAY_ITERATOR_CID); -static NS_DEFINE_IID(kCDateTimeCID, NS_DATETIME_CID); -static NS_DEFINE_IID(kCstackCID, NS_STACK_CID); -static NS_DEFINE_IID(kCDurationCID, NS_DURATION_CID); -static NS_DEFINE_IID(kCCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID); -static NS_DEFINE_IID(kCCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID); -static NS_DEFINE_IID(kCCalFetchEventsCommandCID, NS_CAL_FETCHEVENTS_COMMAND_CID); -static NS_DEFINE_IID(kCCalNewModelCommandCID, NS_CAL_NEWMODEL_COMMAND_CID); -static NS_DEFINE_IID(kCXPFCMethodInvokerCommandCID, NS_XPFC_METHODINVOKER_COMMAND_CID); -static NS_DEFINE_IID(kCXPFCNotificationStateCommandCID, NS_XPFC_NOTIFICATIONSTATE_COMMAND_CID); -static NS_DEFINE_IID(kCXPFCModelUpdateCommandCID, NS_XPFC_MODELUPDATE_COMMAND_CID); -static NS_DEFINE_IID(kCCalStatusCanvasCID, NS_CAL_STATUSCANVAS_CID); -static NS_DEFINE_IID(kCCalCommandCanvasCID, NS_CAL_COMMANDCANVAS_CID); -static NS_DEFINE_IID(kCalTimebarScaleCID, NS_CAL_TIMEBARSCALE_CID); -static NS_DEFINE_IID(kCalTimebarHeadingCID, NS_CAL_TIMEBARHEADING_CID); -static NS_DEFINE_IID(kCalTimebarUserHeadingCID, NS_CAL_TIMEBARUSERHEADING_CID); -static NS_DEFINE_IID(kCalTimebarTimeHeadingCID, NS_CAL_TIMEBARTIMEHEADING_CID); -static NS_DEFINE_IID(kCCalDayViewCID, NS_CAL_DAYVIEWCANVAS_CID); -static NS_DEFINE_IID(kCCalMonthViewCID, NS_CAL_MONTHVIEWCANVAS_CID); -static NS_DEFINE_IID(kCCalTodoComponentCanvasCID, NS_CAL_TODOCOMPONENTCANVAS_CID); -static NS_DEFINE_IID(kCCalXMLDTD, NS_ICALXML_DTD_IID); -static NS_DEFINE_IID(kCCalXMLContentSink, NS_CALXMLCONTENTSINK_IID); -static NS_DEFINE_IID(kCCalXPFCDTD, NS_IXPFCXML_DTD_IID); -static NS_DEFINE_IID(kCCalXPFCContentSink, NS_XPFCXMLCONTENTSINK_IID); -static NS_DEFINE_IID(kCXPFCActionCommandCID, NS_XPFC_ACTION_COMMAND_CID); - -#endif - diff --git a/mozilla/calendar/modules/shell/manifest.mn b/mozilla/calendar/modules/shell/manifest.mn deleted file mode 100644 index 8e4420ee209..00000000000 --- a/mozilla/calendar/modules/shell/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../.. -DEPTH = ../../.. - -DIRS_EXPORT = public inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/shell/public/Makefile b/mozilla/calendar/modules/shell/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/shell/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/shell/public/manifest.mn b/mozilla/calendar/modules/shell/public/manifest.mn deleted file mode 100644 index b90b60a553d..00000000000 --- a/mozilla/calendar/modules/shell/public/manifest.mn +++ /dev/null @@ -1,24 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -EXPORTS = \ - nsICalendarWidget.h \ - nsICalendarShell.h \ - nsICalendarContainer.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor shell diff --git a/mozilla/calendar/modules/shell/public/nsICalendarContainer.h b/mozilla/calendar/modules/shell/public/nsICalendarContainer.h deleted file mode 100644 index c0b7a200061..00000000000 --- a/mozilla/calendar/modules/shell/public/nsICalendarContainer.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsICalendarContainer_h___ -#define nsICalendarContainer_h___ - -#include "nsIWebViewerContainer.h" -#include "nsIWidget.h" -#include "nsIStreamListener.h" -#include "nsICalendarShell.h" -#include "nsICalendarWidget.h" -#include "nsIMenuManager.h" - -//9a221a70-3077-11d2-9247-00805f8a7ab6 -#define NS_ICALENDAR_CONTAINER_IID \ -{ 0x9a221a70, 0x3070, 0x11d2, \ -{ 0x92, 0x47, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -class nsICalendarContainer : public nsIWebViewerContainer -{ - -public: - NS_IMETHOD Init(nsIWidget * aParent, - const nsRect& aBounds, - nsICalendarShell * aCalendarShell) = 0; - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) = 0; - - NS_IMETHOD_(nsICalendarWidget *) GetDocumentWidget() = 0; - - -}; - - -#endif /* nsICalendarContainer */ diff --git a/mozilla/calendar/modules/shell/public/nsICalendarShell.h b/mozilla/calendar/modules/shell/public/nsICalendarShell.h deleted file mode 100644 index 3cec6ac8ae7..00000000000 --- a/mozilla/calendar/modules/shell/public/nsICalendarShell.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsICalendarShell_h___ -#define nsICalendarShell_h___ - -#include "nsISupports.h" -#include "nsIApplicationShell.h" -#include "nscore.h" -#include "nsIAppShell.h" -#include "nsICalendarUser.h" - -#include "capi.h" -#include "nscal.h" - -class nsICollectedData; - -//fe35e400-ea8d-11d1-9244-00805f8a7ab6 -#define NS_ICAL_SHELL_IID \ -{ 0xfe35e400, 0xea8d, 0x11d1, \ -{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -// Interface to the application shell. -class nsICalendarShell : public nsIApplicationShell, - public nsIAppShell -{ - -public: - - NS_IMETHOD Logon() = 0; - NS_IMETHOD Logoff() = 0; - NS_IMETHOD LoadUI() = 0; - NS_IMETHOD LoadPreferences() = 0; - NS_IMETHOD ParseCommandLine() = 0; - NS_IMETHOD ExecuteCommandScript(nsString aScript) = 0; - - - NS_IMETHOD SetCAPISession(CAPISession aCAPISession) = 0; - NS_IMETHOD_(CAPISession) GetCAPISession() = 0; - - NS_IMETHOD SetCAPIHandle(CAPIHandle aCAPIHandle) = 0; - NS_IMETHOD_(CAPIHandle) GetCAPIHandle() = 0; - - NS_IMETHOD SetCAPIPassword(char * aPassword) = 0; - NS_IMETHOD_(char *) GetCAPIPassword() = 0; - - NS_IMETHOD ReceiveCallback(nsICollectedData& aReply) = 0; - - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) = 0 ; - - NS_IMETHOD GetLoggedInUser(nsICalendarUser** LoggInUser) = 0; - -}; - -#endif /* nsICalendarShell_h___ */ diff --git a/mozilla/calendar/modules/shell/public/nsICalendarWidget.h b/mozilla/calendar/modules/shell/public/nsICalendarWidget.h deleted file mode 100644 index 87eb4dbe088..00000000000 --- a/mozilla/calendar/modules/shell/public/nsICalendarWidget.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsICalendarWidget_h___ -#define nsICalendarWidget_h___ - -#include "nsIContentViewer.h" -#include "nsIParser.h" -#include "nsIXPFCCanvas.h" -#include "nsIXPFCMenuBar.h" - -class nsIPostData; -class nsICalendarShell; - - -// Interface to the calendar widget. This object defines -// a rectangular region in the ICalendarApp object which -// contains CalendarPanels - -//2a5b8ac0-ea8e-11d1-9244-00805f8a7ab6 -#define NS_ICALENDAR_WIDGET_IID \ -{ 0x2a5b8ac0, 0xea8e, 0x11d1, \ -{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -class nsICalendarWidget : public nsIContentViewer -{ - -public: - - // Create a native window for this calendar widget - NS_IMETHOD Init(nsNativeWidget aNativeParent, - nsIDeviceContext* aDeviceContext, - nsIPref* aPrefs, - const nsRect& aBounds, - nsScrollPreference aScrolling = nsScrollPreference_kAuto) = 0; - NS_IMETHOD Init(nsIView * aParent, - const nsRect& aBounds, - nsICalendarShell * aCalendarShell) = 0; - - - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) = 0 ; - - NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer) = 0; - - NS_IMETHOD GetContainer(nsIContentViewerContainer*& aContainerResult) = 0; - - NS_IMETHOD BindToDocument(nsISupports *aDoc, const char *aCommand) = 0; - - NS_IMETHOD LoadURL(const nsString& aURLSpec, - nsIStreamObserver* aListener, - nsIXPFCCanvas * aParentCanvas = 0, - nsIPostData* aPostData = 0) = 0; - -}; - - -#endif /* nsCalendarWidget_h___ */ diff --git a/mozilla/calendar/modules/shell/src/Makefile b/mozilla/calendar/modules/shell/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/shell/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/shell/src/config.mk b/mozilla/calendar/modules/shell/src/config.mk deleted file mode 100644 index 4b4790bbe0b..00000000000 --- a/mozilla/calendar/modules/shell/src/config.mk +++ /dev/null @@ -1,72 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -I$(GDEPTH)/include - -PROGRAM = zulu - -OS_LIBS += $(GUI_LIBS) - -LD_LIBS += \ - raptorbase \ - raptorhtmlpars \ - raptorhtml \ - png \ - abouturl \ - fileurl \ - ftpurl \ - gophurl \ - httpurl \ - $(XP_PREF_DLL) \ - img$(MOZ_BITS)$(VERSION_NUMBER) \ - jpeg$(MOZ_BITS)$(VERSION_NUMBER) \ - js$(MOZ_BITS)$(VERSION_NUMBER) \ - jsdom \ - mimetype \ - netlib \ - remoturl \ - netcache \ - netcnvts \ - netutil \ - network \ - netlib \ - xpfc10 \ - $(NATIVE_MSG_COMM_LIB) \ - $(NATIVE_SMTP_LIB) \ - $(NATIVE_MIME_LIB) \ - $(NATIVE_RAPTOR_WIDGET) \ - calui10 \ - calparser10 \ - calcapi10 \ - $(NATIVE_RAPTOR_GFX) \ - $(RAPTOR_GFX) \ - $(NATIVE_ZLIB_DLL) \ - $(NATIVE_XP_DLL) \ - $(NATIVE_LIBNLS_LIBS) \ - xpcom$(MOZ_BITS) \ - util10 \ - calcore10 \ - cal_core_ical10 \ - $(XP_REG_LIB) - -ifeq ($(OS_ARCH),Linux) -LD_LIBS += \ - secfree stubnj stubsj util xp pwcac dbm -endif - -STATIC_LIBS += shell - -EXTRA_LIBS += \ - $(NSPR_LIBS) diff --git a/mozilla/calendar/modules/shell/src/manifest.mn b/mozilla/calendar/modules/shell/src/manifest.mn deleted file mode 100644 index a1c5d1d2b87..00000000000 --- a/mozilla/calendar/modules/shell/src/manifest.mn +++ /dev/null @@ -1,29 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalendarWidget.cpp \ - nsCalendarShell.cpp \ - nsCalShellFactory.cpp \ - nsCalendarContainer.cpp \ - $(NULL) - - -REQUIRES = xpcom raptor shell trex julian nls netlib pref js xpfc - diff --git a/mozilla/calendar/modules/shell/src/nsCalShellFactory.cpp b/mozilla/calendar/modules/shell/src/nsCalShellFactory.cpp deleted file mode 100644 index 94464265683..00000000000 --- a/mozilla/calendar/modules/shell/src/nsCalShellFactory.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsIFactory.h" -#include "nsISupports.h" -#include "nsCalShellCIID.h" - -#include "nsCalendarShell.h" -#include "nsCalendarWidget.h" -#include "nsCalendarContainer.h" -#include "nsCalShellFactory.h" - -static NS_DEFINE_IID(kCCalWidget, NS_CALENDAR_WIDGET_CID); -static NS_DEFINE_IID(kCCalContainer, NS_CALENDAR_CONTAINER_CID); -static NS_DEFINE_IID(kCCalShell, NS_CAL_SHELL_CID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); - - -nsCalShellFactory::nsCalShellFactory(const nsCID &aClass) -{ - mRefCnt = 0; - mClassID = aClass; -} - -nsCalShellFactory::~nsCalShellFactory() -{ - NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); -} - -nsresult nsCalShellFactory::QueryInterface(const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - // Always NULL result, in case of failure - *aResult = NULL; - - 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; -} - -nsrefcnt nsCalShellFactory::AddRef() -{ - return ++mRefCnt; -} - -nsrefcnt nsCalShellFactory::Release() -{ - if (--mRefCnt == 0) { - delete this; - return 0; // Don't access mRefCnt after deleting! - } - return mRefCnt; -} - -nsresult nsCalShellFactory::CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - *aResult = NULL; - - nsISupports *inst = nsnull; - - if (aIID.Equals(kCCalWidget)) { - inst = (nsISupports *)new nsCalendarWidget(); - } - else if (aIID.Equals(kCCalShell)) { - inst = (nsISupports *)(nsIApplicationShell *)new nsCalendarShell(); - } - else if (aIID.Equals(kCCalContainer)) { - inst = (nsISupports *)new nsCalendarContainer(); - } - - if (inst == NULL) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult res = inst->QueryInterface(aIID, aResult); - - if (res != NS_OK) { - // We didn't get the right interface, so clean up - delete inst; - } - - return res; -} - -nsresult nsCalShellFactory::LockFactory(PRBool aLock) -{ - // Not implemented in simplest case. - return NS_OK; -} - diff --git a/mozilla/calendar/modules/shell/src/nsCalendarContainer.cpp b/mozilla/calendar/modules/shell/src/nsCalendarContainer.cpp deleted file mode 100644 index e44622aa190..00000000000 --- a/mozilla/calendar/modules/shell/src/nsCalendarContainer.cpp +++ /dev/null @@ -1,780 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include -#include "nsCalendarContainer.h" -#include "nsCalShellCIID.h" -#include "nsCalendarShell.h" -#include "nsCalendarWidget.h" -#include "nsxpfcCIID.h" -#include "nsIMenuManager.h" -#include "nsWidgetsCID.h" -#include "nsIFileWidget.h" -#include "nsCalShellCIID.h" -#include "nscalcids.h" -#include "nsBoxLayout.h" -#include "nsViewsCID.h" -#include "nsIViewManager.h" -#include "nsXPFCToolkit.h" -#include "nsXPFCActionCommand.h" -#include "nsICalendarUser.h" -#include "nsICalendarModel.h" -#include "nsCoreCIID.h" -#include "nsIUser.h" -#include "nsCurlParser.h" -#include "nsX400Parser.h" -#include "nscal.h" -#include "nsCalMultiDayViewCanvas.h" -#include "nsCalMultiUserViewCanvas.h" -#include "nsLayer.h" -#include "nsCalTimebarCanvas.h" -#include "nsCalUICIID.h" -#include "nsCalNewModelCommand.h" -#include "nsIXPFCCommand.h" - -// XXX: This code should use XML for defining the Root UI. We need to -// implement the stream manager first to do this, then lots of -// this specific code should be removed (it would load trex.ui) - -static NS_DEFINE_IID(kICalContainerIID, NS_ICALENDAR_CONTAINER_IID); - -static NS_DEFINE_IID(kFileWidgetCID, NS_FILEWIDGET_CID); -static NS_DEFINE_IID(kIFileWidgetIID, NS_IFILEWIDGET_IID); - -static NS_DEFINE_IID(kViewManagerCID, NS_VIEW_MANAGER_CID); -static NS_DEFINE_IID(kIViewManagerIID, NS_IVIEWMANAGER_IID); -static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID); -static NS_DEFINE_IID(kViewCID, NS_VIEW_CID); -static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID); - - -static NS_DEFINE_IID(kIModelIID, NS_IMODEL_IID); -static NS_DEFINE_IID(kICalendarModelIID, NS_ICALENDAR_MODEL_IID); -static NS_DEFINE_IID(kCCalendarModelCID, NS_CALENDAR_MODEL_CID); - - -nsCalendarContainer::nsCalendarContainer() -{ - NS_INIT_REFCNT(); - mMenuManager = nsnull; - mCalendarWidget = nsnull; - mCalendarShell = nsnull; - mRootCanvas = nsnull; - mToolkit = nsnull; - mToolbarManager = nsnull; -} - -NS_IMPL_QUERY_INTERFACE(nsCalendarContainer, kICalContainerIID) -NS_IMPL_ADDREF(nsCalendarContainer) -NS_IMPL_RELEASE(nsCalendarContainer) - -nsCalendarContainer::~nsCalendarContainer() -{ - NS_IF_RELEASE(mMenuManager); - NS_IF_RELEASE(mCalendarWidget); - NS_IF_RELEASE(mRootCanvas); - NS_IF_RELEASE(mToolkit); - NS_IF_RELEASE(mToolbarManager); -} - -nsresult nsCalendarContainer::Init(nsIWidget * aParent, - const nsRect& aBounds, - nsICalendarShell * aCalendarShell) -{ - - /* - * Create the UI Toolkit. - */ - static NS_DEFINE_IID(kICalToolkitIID, NS_ICAL_TOOLKIT_IID); - - nsresult res = NS_OK; - res = nsRepository::CreateInstance(kCCalToolkitCID, - nsnull, - kICalToolkitIID, - (void **)&mToolkit); - - if (NS_OK != res) - return res ; - - mToolkit->Init((nsIApplicationShell *)aCalendarShell); - - - static NS_DEFINE_IID(kIMenuManagerIID, NS_IMENU_MANAGER_IID); - static NS_DEFINE_IID(kCMenuManagerCID, NS_MENU_MANAGER_CID); - - res = nsRepository::CreateInstance(kCMenuManagerCID, - nsnull, - kIMenuManagerIID, - (void **)&mMenuManager); - - if (NS_OK != res) - return res ; - - mMenuManager->Init(); - - /* - * Create the view manager - */ - - nsIViewManager * viewManager; - - res = nsRepository::CreateInstance(kViewManagerCID, - nsnull, - kIViewManagerIID, - (void **)&viewManager); - - - if (NS_OK != res) - return res ; - - viewManager->Init(aParent->GetDeviceContext()); - - viewManager->SetFrameRate(25); - - gXPFCToolkit->GetCanvasManager()->SetViewManager(viewManager); - - gXPFCToolkit->GetCanvasManager()->SetWebViewerContainer((nsIWebViewerContainer *) this); - - /* - * Create the Root UI - */ - - if (mRootCanvas == nsnull) - { - /* - * Create a basic canvas with ybox. When a toolbar gets added to - * us, it should be inserted first in the child list, after other - * toolbars. - * - * The calendar widget's rootCanvas is last in the child list - */ - - static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); - - res = nsRepository::CreateInstance(kCXPFCCanvasCID, - nsnull, - kCXPFCCanvasCID, - (void **)&mRootCanvas); - - mRootCanvas->Init(); - - gXPFCToolkit->GetCanvasManager()->SetRootCanvas(mRootCanvas); - - /* - * Associate the Logged In User's content model with the canvas - */ - - nsICalendarModel * calmodel = nsnull; - nsIModel * model = nsnull; - - res = nsRepository::CreateInstance(kCCalendarModelCID, - nsnull, - kICalendarModelIID, - (void **)&calmodel); - - if (NS_OK != res) - return res; - - calmodel->Init(); - - calmodel->SetCalendarUser(((nsCalendarShell *)aCalendarShell)->mpLoggedInUser); - - calmodel->QueryInterface(kIModelIID, (void**)&model); - - if (NS_OK != res) - return res; - - mRootCanvas->SetModel(model); - - NS_RELEASE(model); - - nsNativeWidget native = aParent->GetNativeData(NS_NATIVE_WIDGET); - - mRootCanvas->Init(native, - aBounds); - - gXPFCToolkit->GetViewManager()->SetRootView(mRootCanvas->GetView()); - - //mRootCanvas->SetVisibility(PR_FALSE); - ((nsBoxLayout *)(mRootCanvas->GetLayout()))->SetLayoutAlignment(eLayoutAlignment_vertical); - - NS_RELEASE(calmodel); - - } - - - /* - * Embed the Calendar Widget - */ - - if (mCalendarWidget == nsnull) - { - res = NS_NewCalendarWidget(&mCalendarWidget); - - if (res != NS_OK) - return res; - - } - - /* - * ReParent. Need a cleaner way to do this. Maybe the - * Widget itself should implement the nsIXPFCCanvas interface? - */ - - res = mCalendarWidget->Init(mRootCanvas->GetView(), aBounds, aCalendarShell); - - mRootCanvas->Layout(); - - return (res); -} - - -nsresult nsCalendarContainer::SetMenuBar(nsIXPFCMenuBar * aMenuBar) -{ - mMenuManager->SetMenuBar(aMenuBar); - - aMenuBar->SetShellContainer(((nsCalendarShell *)mCalendarShell)->mShellInstance, - (nsIWebViewerContainer *)this); - - return NS_OK; - -} - - -nsresult nsCalendarContainer::SetMenuManager(nsIMenuManager * aMenuManager) -{ - mMenuManager = aMenuManager; - - NS_ADDREF(mMenuManager); - - return NS_OK; - -} - -nsIMenuManager * nsCalendarContainer::GetMenuManager() -{ - return (mMenuManager); - -} - -nsresult nsCalendarContainer::SetToolbarManager(nsIXPFCToolbarManager * aToolbarManager) -{ - mToolbarManager = aToolbarManager; - - NS_ADDREF(mToolbarManager); - - return NS_OK; - -} - -nsIXPFCToolbarManager * nsCalendarContainer::GetToolbarManager() -{ - return (mToolbarManager); -} - -nsresult nsCalendarContainer::AddToolbar(nsIXPFCToolbar * aToolbar) -{ - nsIXPFCCanvas * canvas; - - nsresult res = aToolbar->QueryInterface(kIXPFCCanvasIID,(void**)&canvas); - - if (NS_OK == res) - { - mRootCanvas->AddChildCanvas(canvas,0); - - /* - * Let's add a native widget here. This code should be in XPFC - */ - - /* - * We want to instantiate a window widget which the canvas - * aggregates. - */ - static NS_DEFINE_IID(kCWidgetCID, NS_CHILD_CID); - - nsIView * parent = canvas->GetView(); - - res = canvas->LoadView(kViewCID); - - NS_RELEASE(canvas); - } - - return NS_OK; -} - -nsresult nsCalendarContainer::RemoveToolbar(nsIXPFCToolbar * aToolbar) -{ - return NS_OK; -} - -nsresult nsCalendarContainer::UpdateToolbars() -{ - // XXX Ugly ugly! - - nsIWidget * w; - nsRect bounds; - - w = ((nsCalendarShell *)mCalendarShell)->mShellInstance->GetApplicationWidget(); - - if (w == nsnull) - return NS_OK; - - mRootCanvas->Layout(); - - w->Invalidate(PR_FALSE); - - return NS_OK; -} - -nsresult nsCalendarContainer::ShowDialog(nsIXPFCDialog * aDialog) -{ - nsIXPFCCanvas * canvas; - - nsresult res = aDialog->QueryInterface(kIXPFCCanvasIID,(void**)&canvas); - - if (NS_OK == res) - { - static NS_DEFINE_IID(kCWidgetCID, NS_WINDOW_CID); - - nsIView * parent = canvas->GetView(); - - res = canvas->LoadView(kViewCID, &kCWidgetCID, nsnull); - - nsIWidget * widget ; - - canvas->GetView()->GetWidget(widget); - - - widget->SetBorderStyle(eBorderStyle_dialog); - - NS_RELEASE(widget); - - nsRect rect(400,0,400,600); - canvas->SetBounds(rect); - - NS_RELEASE(canvas); - } - return NS_OK; -} - -nsresult nsCalendarContainer::UpdateMenuBar() -{ - static NS_DEFINE_IID(kCIXPFCMenuContainerIID, NS_IXPFCMENUCONTAINER_IID); - - nsIXPFCMenuContainer * container = nsnull; - - nsresult res = mMenuManager->GetMenuBar()->QueryInterface(kCIXPFCMenuContainerIID,(void**)&container); - - if (res == NS_OK) - { - container->Update(); - NS_RELEASE(container); - } - - // XXX Ugly ugly! - // Windows seems to get confused when the menubar changes - // physical dimensions. We need a way to tell the native window - // that it's dimentions have changed ... argh. - - nsIWidget * w; - nsRect bounds; - - w = ((nsCalendarShell *)mCalendarShell)->mShellInstance->GetApplicationWidget(); - - if (w == nsnull) - return NS_OK; - - w->Resize(800, - 600+1, - PR_TRUE); - - return NS_OK; -} - -nsresult nsCalendarContainer::SetTitle(const nsString& aTitle) -{ - return NS_OK; -} -nsresult nsCalendarContainer::GetTitle(nsString& aResult) -{ - return NS_OK; -} - -nsresult nsCalendarContainer::QueryCapability(const nsIID &aIID, void** aResult) -{ - return NS_OK; -} -nsresult nsCalendarContainer::Embed(nsIContentViewer* aDocViewer, - const char* aCommand, - nsISupports* aExtraInfo) -{ - return NS_OK; -} - -nsresult nsCalendarContainer::SetContentViewer(nsIContentViewer* aViewer) -{ - return NS_OK; -} - -nsresult nsCalendarContainer::GetContentViewer(nsIContentViewer*& aResult) -{ - return NS_OK; -} - - -nsresult nsCalendarContainer::SetApplicationShell(nsIApplicationShell* aShell) -{ - mCalendarShell = (nsCalendarShell*) aShell; - return NS_OK; -} - -nsresult nsCalendarContainer::GetApplicationShell(nsIApplicationShell*& aResult) -{ - aResult = (nsIApplicationShell *) mCalendarShell; - NS_ADDREF((nsIApplicationShell *)mCalendarShell); - return NS_OK; -} - - -nsresult nsCalendarContainer::LoadURL(const nsString& aURLSpec, - nsIStreamObserver* aListener, - nsIXPFCCanvas * aParentCanvas, - nsIPostData * aPostData) -{ - /* - * this is temp hack code til get capi url's in the stream manager....sorry! - */ - - if (aURLSpec.Find(".ics") == -1) - { - - /* - * This is a normal url, go thru the stream manager - */ - - return(mCalendarWidget->LoadURL(aURLSpec, aListener, aParentCanvas, aPostData)); - } - - /* - * This is a capi url. Today, we assume that this is an additional - * item for a group agenda - */ - - nsCalendarShell * shell = (nsCalendarShell *) mCalendarShell; - - /* - * Create a New User - */ - - static NS_DEFINE_IID(kICalendarUserIID, NS_ICALENDAR_USER_IID); - static NS_DEFINE_IID(kCCalendarUserCID, NS_CALENDAR_USER_CID); - static NS_DEFINE_IID(kIUserIID, NS_IUSER_IID); - - nsresult res; - CAPIStatus s; - - nsICalendarUser * caluser ; - nsIUser* pUser; - - res = nsRepository::CreateInstance(kCCalendarUserCID, - nsnull, - kICalendarUserIID, - (void**)&caluser); - - if (NS_OK != res) - return res; - - caluser->Init(); - - if (NS_OK != (res = caluser->QueryInterface(kIUserIID,(void**)&pUser))) - return res ; - - - nsCurlParser theURL; - - char * cstring = aURLSpec.ToNewCString(); - - theURL.SetCurl(cstring); - - delete cstring; - - JulianString sUserName(256); - nsString nsUserName; - - sUserName = theURL.GetUser(); - - cstring = sUserName.GetBuffer(); - nsUserName = cstring; - - pUser->SetUserName(nsUserName); - - sUserName.DoneWithBuffer(); - - pUser->GetUserName(nsUserName); - JulianString sHandle(256); - nsUserName.ToCString(sHandle.GetBuffer(),256); - sHandle.DoneWithBuffer(); - - /* - * Ask the session manager for a session... - */ - res = shell->mSessionMgr.GetSession(theURL.GetCurl().GetBuffer(), - 0L, - shell->GetCAPIPassword(), - shell->mCAPISession); - - if (nsCurlParser::eCAPI == theURL.GetProtocol()) - { - nsX400Parser x(theURL.GetExtra()); - x.Delete("ND"); - x.GetValue(sHandle); - sHandle.Prepend(":"); - } - - nsCalSession* pCalSession; - /* - * Get the session from the session manager... - */ - s = shell->mSessionMgr.GetSession(theURL.GetCurl(),0,"",pCalSession); - if (CAPI_ERR_OK != s) - return NS_OK; - /* - * Get a handle to the specific calendar store from the session - */ - - - JulianString jfile = theURL.GetCSID(); - - s = pCalSession->mCapi->CAPI_GetHandle(shell->mCAPISession, - jfile.GetBuffer(),//sHandle.GetBuffer(), - 0, - &(shell->mCAPIHandle)); - - - /* - * Create the Model interfaces to the view system .... - */ - - nsILayer* pLayer; - - static NS_DEFINE_IID(kILayerIID, NS_ILAYER_IID); - static NS_DEFINE_IID(kCLayerCID, NS_LAYER_CID); - - if (NS_OK != (res = nsRepository::CreateInstance( - kCLayerCID, // class id that we want to create - nsnull, // not aggregating anything (this is the aggregatable interface) - kILayerIID, // interface id of the object we want to get back - (void**)&pLayer))) - return 1; // XXX fix this - pLayer->Init(); - pLayer->SetCurl(theURL.GetCurl()); - caluser->SetLayer(pLayer); - - /* - * Begin a calendar for the logged in user... - */ - - NSCalendar * pCalendar; - - pLayer->GetCal(pCalendar); - NS_RELEASE(pLayer); - - switch(theURL.GetProtocol()) - { - case nsCurlParser::eFILE: - case nsCurlParser::eCAPI: - { - DateTime d; - DateTime d1; - JulianPtrArray EventList; - nsILayer *pLayer; - d.prevDay(14); - d1.nextDay(14); - caluser->GetLayer(pLayer); - NS_ASSERTION(0 != pLayer,"null pLayer"); - pLayer->SetShell(shell); - pLayer->FetchEventsByRange(&d,&d1,&EventList); - pCalendar->addEventList(&EventList); - NS_RELEASE(pLayer); - } - break; - - default: - { - /* need to report that this is an unhandled curl type */ - } - break; - } - - nsICalendarModel * calmodel = nsnull; - nsIModel * model = nsnull; - - res = nsRepository::CreateInstance(kCCalendarModelCID, - nsnull, - kICalendarModelIID, - (void **)&calmodel); - - if (NS_OK != res) - return res; - - calmodel->Init(); - - calmodel->SetCalendarUser(caluser); - - res = calmodel->QueryInterface(kIModelIID, (void**)&model); - - if (NS_OK != res) - return res; - - /* - * find a multi canvas and add one here and then set it's model ... yeehaaa - */ - - /* - * Send an NewModelCommand to all canvas's.... - * - * This event basically specifies that a new model - * needs to be viewed somewhere. Currently, only - * the multi canvas handles this - */ - - static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); - - nsCalNewModelCommand * command = nsnull; - - res = nsRepository::CreateInstance(kCCalNewModelCommandCID, - nsnull, - kXPFCCommandIID, - (void **)&command); - if (NS_OK != res) - return res; - - command->Init(); - - command->mModel = model; - - mRootCanvas->BroadcastCommand(*command); - - NS_RELEASE(command); - NS_RELEASE(model); - - - return NS_OK; - -} - -nsICalendarWidget * nsCalendarContainer::GetDocumentWidget() -{ - return(mCalendarWidget); -} - -nsEventStatus nsCalendarContainer::HandleEvent(nsGUIEvent *aEvent) -{ - nsIXPFCCanvas * canvas = nsnull ; - nsEventStatus es ; - - /* - * find the canvas this event is associated with! - */ - - canvas = gXPFCToolkit->GetCanvasManager()->CanvasFromWidget(aEvent->widget); - - if (canvas != nsnull) - { - es = canvas->HandleEvent(aEvent); - - //mViewManager->DispatchEvent(aEvent, es); - - return es; - } - - if (aEvent->message == NS_SIZE) - mRootCanvas->SetBounds(*(((nsSizeEvent*)aEvent)->windowSize)); - - return (mRootCanvas->HandleEvent(aEvent)); -} - -NS_CALENDAR nsresult NS_NewCalendarContainer(nsICalendarContainer** aInstancePtrResult) -{ - NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); - if (nsnull == aInstancePtrResult) { - return NS_ERROR_NULL_POINTER; - } - nsCalendarContainer* it = new nsCalendarContainer(); - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - return it->QueryInterface(kICalContainerIID, (void **) aInstancePtrResult); -} - - -nsEventStatus nsCalendarContainer::ProcessCommand(nsIXPFCCommand * aCommand) -{ - /* - * Check to see this is an ActionCommand - */ - - nsresult res; - - nsXPFCActionCommand * action_command = nsnull; - - static NS_DEFINE_IID(kXPFCActionCommandCID, NS_XPFC_ACTION_COMMAND_CID); - - res = aCommand->QueryInterface(kXPFCActionCommandCID,(void**)&action_command); - - if (NS_OK != res) - return nsEventStatus_eIgnore; - - - /* - * Yeah, this is an action command. Do something - */ - - ProcessActionCommand(action_command->mAction); - - NS_RELEASE(action_command); - - return (nsEventStatus_eIgnore); -} - - -nsresult nsCalendarContainer::ProcessActionCommand(nsString& aAction) -{ - nsString command ; - PRUint32 offset = aAction.Find("?"); - - if (offset > 0) - aAction.Left(command,offset); - else - command = aAction; - - if (command.EqualsIgnoreCase("LoadUrl")) - { - nsString url ; - - aAction.Mid(url, offset+1, aAction.Length() - offset - 1); - - LoadURL(url, nsnull); - } - - return NS_OK; -} diff --git a/mozilla/calendar/modules/shell/src/nsCalendarShell.cpp b/mozilla/calendar/modules/shell/src/nsCalendarShell.cpp deleted file mode 100644 index 93d76428201..00000000000 --- a/mozilla/calendar/modules/shell/src/nsCalendarShell.cpp +++ /dev/null @@ -1,1420 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#include "jdefines.h" -#include "julnstr.h" -#include "nsCalShellFactory.h" -#include "nsString.h" -#include "nsFont.h" -#include "nsCalShellCIID.h" -#include "nsXPFCObserverManager.h" -#include "nsCRT.h" -#include "plstr.h" -#include "prmem.h" -#include "prenv.h" -#include "icalfrdr.h" -#include "nsIPref.h" -#include "nsCurlParser.h" -#include "nsCalendarShell.h" -#include "nscalstrings.h" -#include "nsxpfcCIID.h" -#include "nsIAppShell.h" -#include "nsICommandServer.h" -#include "nsCalUICIID.h" -#include "nsCalCommandCanvas.h" -#include "nlsloc.h" -#include "nsCapiCIID.h" -#include "nspr.h" -#include "prcvar.h" -#include "nsXPFCToolkit.h" -#include "nsX400Parser.h" -#include "nsxpfcCIID.h" -#include "nsIXPFCDataCollectionManager.h" -#include "nscalcids.h" - -#include "capi.h" -#include "nsICapi.h" -#include "uidrgntr.h" -#include "attendee.h" - -#include "nsxpfcstrings.h" -#include "nsCoreCIID.h" -#include "nsLayer.h" -#include "nsLayerCollection.h" -#include "nsCalUser.h" -#include "nsCalendarUser.h" -#include "nsCalendarModel.h" -#include "nsIServiceManager.h" - -#include "plgetopt.h" - -/* for CAPI to work in general form */ -#include "nsCapiCallbackReader.h" -#include "nsCalStreamReader.h" - -#ifdef NS_WIN32 -#include "windows.h" -#endif - -#ifdef NS_UNIX -#include "Xm/Xm.h" -#include "Xm/MainW.h" -#include "Xm/Frame.h" -#include "Xm/XmStrDefs.h" -#include "Xm/DrawingA.h" - -extern XtAppContext app_context; -extern Widget topLevel; - -#endif - -// All Applications must specify this *special* application CID -// to their own unique IID. -nsIID kIXPCOMApplicationShellCID = NS_CAL_SHELL_CID ; - -static NS_DEFINE_IID(kIXPFCObserverManagerIID, NS_IXPFC_OBSERVERMANAGER_IID); -static NS_DEFINE_IID(kCXPFCDTD, NS_IXPFCXML_DTD_IID); -static NS_DEFINE_IID(kCXPFCContentSink, NS_XPFCXMLCONTENTSINK_IID); -static NS_DEFINE_IID(kCXPFCCommandServerCID, NS_XPFC_COMMAND_SERVER_CID); -static NS_DEFINE_IID(kCXPFCHTMLCanvasCID, NS_XPFC_HTML_CANVAS_CID); -static NS_DEFINE_IID(kCXPFolderCanvasCID, NS_XP_FOLDER_CANVAS_CID); -static NS_DEFINE_IID(kCCalCanvasCID, NS_CAL_CANVAS_CID); - -// hardcode names of dll's -// hardcode names of dll's -#ifdef NS_WIN32 - #define CALUI_DLL "calui10.dll" - #define UTIL_DLL "util10.dll" - #define PARSER_DLL "calparser10.dll" - #define XPFC_DLL "xpfc10.dll" - #define CAPI_DLL "calcapi10.dll" - #define CORE_DLL "calcore10.dll" -#else - #define CALUI_DLL "libcalui10.so" - #define UTIL_DLL "libutil10.so" - #define PARSER_DLL "libcalparser10.so" - #define XPFC_DLL "libxpfc10.so" - #define CAPI_DLL "libcalcapi10.so" - #define CORE_DLL "libcalcore10.so" -#endif - -static NS_DEFINE_IID(kCCapiLocalCID, NS_CAPI_LOCAL_CID); -static NS_DEFINE_IID(kCCapiCSTCID, NS_CAPI_CST_CID); -static NS_DEFINE_IID(kCLayerCID, NS_LAYER_CID); -static NS_DEFINE_IID(kILayerIID, NS_ILAYER_IID); -static NS_DEFINE_IID(kCLayerCollectionCID, NS_LAYER_COLLECTION_CID); -static NS_DEFINE_IID(kILayerCollectionIID, NS_ILAYER_COLLECTION_IID); -static NS_DEFINE_IID(kCCalendarModelCID, NS_CALENDAR_MODEL_CID); -static NS_DEFINE_IID(kICalendarUserIID, NS_ICALENDAR_USER_IID); -static NS_DEFINE_IID(kCCalendarUserCID, NS_CALENDAR_USER_CID); -static NS_DEFINE_IID(kIUserIID, NS_IUSER_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCUserCID, NS_USER_CID); -static NS_DEFINE_IID(kCSMTPServiceCID, NS_SMTP_SERVICE_CID); -static NS_DEFINE_IID(kCMessageCID, NS_MESSAGE_CID); -static NS_DEFINE_IID(kCMIMEMessageCID, NS_MIME_MESSAGE_CID); -static NS_DEFINE_IID(kCMIMEBodyPartCID, NS_MIME_BODY_PART_CID); -static NS_DEFINE_IID(kCMIMEBasicBodyPartCID, NS_MIME_BASIC_BODY_PART_CID); -static NS_DEFINE_IID(kCMIMEServiceCID, NS_MIME_SERVICE_CID); - -#include "nsXPFCMethodInvokerCommand.h" -#include "nsIXPFCObserver.h" -#define kNotFound -1 - -#include "nsCalTestStrings.h" - -// All Application Must implement this function -nsresult NS_RegisterApplicationShellFactory() -{ - - nsresult res = nsRepository::RegisterFactory(kIXPCOMApplicationShellCID, - new nsCalShellFactory(kIXPCOMApplicationShellCID), - PR_FALSE) ; - - return res; -} - -static PRFileDesc *output = NULL; - -static nsresult Usage(void) -{ - PR_fprintf(output, "zulu usage:\n"); - PR_fprintf(output, ">zulu [-d] [-c] [-v] [-s ]\n"); - PR_fprintf(output, " -d\t\tdebug mode\n"); - PR_fprintf(output, " -c\t\tlaunch command server\n"); - PR_fprintf(output, " -v\t\tverbose output\n"); - PR_fprintf(output, " -s \tlaunch command script \t(implies -c)\n"); - return 1; -} - -/* - * nsCalendarShell Definition - */ -nsCalendarShell::nsCalendarShell() -{ - NS_INIT_REFCNT(); - - mShellInstance = nsnull ; - mDocumentContainer = nsnull ; - mObserverManager = nsnull; - mCAPIPassword = nsnull; - mpLoggedInUser = nsnull; - mCommandServer = nsnull; - mCAPISession = nsnull; - mCAPIHandle = nsnull; -} - -nsCalendarShell::~nsCalendarShell() -{ - nsCalSession * session = mSessionMgr.GetAt(0L); - - if (session != nsnull) - session->mCapi->CAPI_DestroyHandles(mCAPISession, &mCAPIHandle, 1, 0L); - - Logoff(); - - if (nsnull != mObserverManager) - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, mObserverManager); - - if (mCAPIPassword) - PR_Free(mCAPIPassword); - - NS_IF_RELEASE(mpLoggedInUser); - NS_IF_RELEASE(mDocumentContainer); - NS_IF_RELEASE(mShellInstance); - NS_IF_RELEASE(mCommandServer); -} - -static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID); - - -nsresult nsCalendarShell::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - - if(aIID.Equals(kISupportsIID)) { //do IUnknown... - *aInstancePtr = (nsISupports*)(nsIApplicationShell *)(this); - } - else if(aIID.Equals(kIXPCOMApplicationShellCID)) { //do nsIContentSink base class... - *aInstancePtr = (nsICalendarShell*)(this); - } - else if(aIID.Equals(kIAppShellIID)) { //do nsIContentSink base class... - *aInstancePtr = (nsIAppShell*)(this); - } - else { - *aInstancePtr=0; - return NS_NOINTERFACE; - } - ((nsISupports*) *aInstancePtr)->AddRef(); - return NS_OK; -} - -NS_IMPL_ADDREF(nsCalendarShell) -NS_IMPL_RELEASE(nsCalendarShell) - -// eyork temp place for this -static NS_DEFINE_IID(kCCalShell, NS_CAL_SHELL_CID); - -nsresult nsCalendarShell::ReceiveCallback(nsICollectedData& aReply) -{ - - CreateEventFunc(aReply); - return NS_OK; -} - -nsresult nsCalendarShell::CreateEventFunc(nsICollectedData& cdp) -{ -#define BUF_SIZE 2048 - char temp[BUF_SIZE]; - Attendee *aAttendee = nsnull; - VEvent ev; - nsString StringValue; - nsString StringLabel; - nsICalendarUser* CalUser = nsnull; - - ev.setDTStamp(DateTime()); // Default DataTime is now - ev.setUID(nsCalUIDRandomGenerator::generate()); - - StringLabel = nsString("ReqiEditableUserFields"); - cdp.FindValueInCollectedData(StringLabel, StringValue); - StringValue.ToCString(temp, BUF_SIZE); ev.setOrganizer(UnicodeString(temp)); - - StringLabel = nsString("ComposeArea"); - cdp.FindValueInCollectedData(StringLabel, StringValue); - StringValue.ToCString(temp, BUF_SIZE); ev.setDescription(UnicodeString(temp)); - - StringLabel = nsString("SubjectEditableTimeFields"); - cdp.FindValueInCollectedData(StringLabel, StringValue); - StringValue.ToCString(temp, BUF_SIZE); ev.setSummary(UnicodeString(temp)); - - StringLabel = nsString("StartEditableTimeFields"); - cdp.FindValueInCollectedData(StringLabel, StringValue); - ev.setDTStart(DateTime((UnicodeString(StringValue.ToCString(temp, BUF_SIZE))))); - - StringLabel = nsString("EndEditableTimeFields"); - cdp.FindValueInCollectedData(StringLabel, StringValue); - ev.setDTEnd(DateTime((UnicodeString(StringValue.ToCString(temp, BUF_SIZE))))); - - PRInt32 index = 0; - int16 my_space = 0x0020; - - StringLabel = nsString("ReqsEditableUserFields"); - cdp.FindValueInCollectedData(StringLabel, StringValue); - - while (index < StringValue.Length()) - { - nsString CurrentAttendee; - - while (index < StringValue.Length()) - { - if (StringValue[index] != my_space) - CurrentAttendee += StringValue[index++]; - else { - index++; - break; - } - } - - aAttendee = new Attendee(ICalComponent::ICAL_COMPONENT_VEVENT); - if (aAttendee) - { - aAttendee->setName(UnicodeString(CurrentAttendee.ToCString(temp, BUF_SIZE))); - aAttendee->setRole(Attendee::ROLE_REQ_PARTICIPANT); - ev.addAttendee(aAttendee); - } - } - - index = 0; - StringLabel = nsString("OptEditableUserFields"); - cdp.FindValueInCollectedData(StringLabel, StringValue); - - while (index < StringValue.Length()) - { - nsString CurrentAttendee; - - while (index < StringValue.Length()) - { - if (StringValue[index] != my_space) - CurrentAttendee += StringValue[index++]; - else { - index++; - break; - } - } - - aAttendee = new Attendee(ICalComponent::ICAL_COMPONENT_VEVENT); - if (aAttendee) - { - aAttendee->setName(UnicodeString(CurrentAttendee.ToCString(temp, BUF_SIZE))); - aAttendee->setRole(Attendee::ROLE_OPT_PARTICIPANT); - ev.addAttendee(aAttendee); - } - } - - Logon(); - GetLoggedInUser(&CalUser); - if (CalUser) - { - nsILayer* aLayer = nsnull; - - CalUser->GetLayer(aLayer); - - if (aLayer) - { - aLayer->StoreEvent(ev); - } - } - - return NS_OK; -} - -nsresult nsCalendarShell::Init() -{ - /* - * Get the shell instance - */ - - nsresult res = nsApplicationManager::GetShellInstance(this, &mShellInstance); - - /* - * Register class factrories needed for application - */ - NLS_Initialize(nsnull,nsnull); - RegisterFactories() ; - InitFactoryObjs(); - - - /* - * Parse command Line - */ - - - res = ParseCommandLine(); - - if (NS_OK != res) - return res; - - /* - * Load Application Prefs - */ - LoadPreferences(); - - /* - * Logon to the system - */ - Logon(); - - /* - * Create the UI - */ - LoadUI(); - - /* - * Register the DataCollection Funciotn CreateEvent - */ - nsIXPFCDataCollectionManager *theMan = mShellInstance->GetDataCollectionManager(); - if (theMan) - { - nsString ce = nsString("CreateEvent"); -// theMan->AddDataCollection(ce, (DataCollectionHandlerFunc *)CreateEventFunc); - theMan->AddDataCollection(ce, this); - } - - return res; -} - -/** - * Create factory objects... - * @return NS_OK on success - */ -nsresult nsCalendarShell::InitFactoryObjs() -{ - nsresult res; - - res = nsRepository::CreateInstance(kCCalendarUserCID, // class id that we want to create - nsnull, // not aggregating anything (this is the aggregatable interface) - kICalendarUserIID, // interface id of the object we want to get back - (void**)&mpLoggedInUser); - - if (NS_OK == res) - { - mpLoggedInUser->Init(); - } - - return res; -} - -nsresult nsCalendarShell::ParseCommandLine() -{ - PLOptStatus os; - PLOptState *opt; - - output = PR_GetSpecialFD(PR_StandardError); - - mShellInstance->GetCommandLineOptions(&opt,"cGhdl:s:"); - - while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) - { - if (PL_OPT_BAD == os) - continue; - - switch (opt->option) - { - case 'G': /* GLOBAL threads */ - //thread_scope = PR_GLOBAL_THREAD; - break; - - case 'd': /* debug mode */ - break; - - case 'c': /* */ - StartCommandServer(); - break; - - case 's': - { - nsString script = opt->value; - ExecuteCommandScript(script); - } - break; - - case 'h': /* confused */ - default: - return Usage(); - } - } - return NS_OK; -} - -nsresult nsCalendarShell::GetLoggedInUser(nsICalendarUser** LoggInUser) -{ - *LoggInUser = mpLoggedInUser; - return NS_OK; -} - -/** - * This method establishes a logged in user and opens a connection to - * the calendar server (or local database file if they're working offline). - * - * @return NS_OK on success - * 1 = could not create or write to a local capi directory - */ -nsresult nsCalendarShell::Logon() -{ - CAPIStatus s; - nsIUser* pUser; - nsresult res; - - if (NS_OK != (res = mpLoggedInUser->QueryInterface(kIUserIID,(void**)&pUser))) - return res ; - - - /* - * THIS WHOLE AREA NEEDS TO BE MOVED INTO USERMGR. Have it - * create the user, etc based on a curl or curllist. - */ - - - /* - * Getting the first calendar by user name should be reviewed. - */ - nsString nsstrUserName; - pUser->GetUserName(nsstrUserName); - JulianString sUserName(256); - nsstrUserName.ToCString(sUserName.GetBuffer(),256); - sUserName.DoneWithBuffer(); - - nsCurlParser theURL(sUserName); - nsCurlParser sessionURL(msCalURL); - theURL |= sessionURL; - - /* - * Ask the session manager for a session... - */ - res = mSessionMgr.GetSession( - msCalURL.GetBuffer(), // may contain a password, if so it will be used - 0L, - GetCAPIPassword(), - mCAPISession); - - pUser->GetUserName(nsstrUserName); - JulianString sHandle(256); - nsstrUserName.ToCString(sHandle.GetBuffer(),256); - sHandle.DoneWithBuffer(); - - - NS_RELEASE(pUser); - - if (nsCurlParser::eCAPI == theURL.GetProtocol()) - { - nsX400Parser x(theURL.GetExtra()); - x.Delete("ND"); - x.GetValue(sHandle); - sHandle.Prepend(":"); - } - - s = mSessionMgr.GetAt(0L)->mCapi->CAPI_GetHandle(mCAPISession,sHandle.GetBuffer(),0,&mCAPIHandle); - - if (CAPI_ERR_OK != s) - return NS_OK; - - /* - * Begin a calendar for the logged in user... - */ - - switch(theURL.GetProtocol()) - { - case nsCurlParser::eFILE: - case nsCurlParser::eCAPI: - { - DateTime d; - DateTime d1; - JulianPtrArray EventList; - nsILayer *pLayer; - d.prevDay(14); - d1.nextDay(14); - mpLoggedInUser->GetLayer(pLayer); - NS_ASSERTION(0 != pLayer,"null pLayer"); - { - char sBuf[2048]; - int iBufSize = sizeof(sBuf); - JulianString sTmp; - mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_PREFERRED_ADDR,sBuf, &iBufSize ); - sTmp = sBuf; - EnvVarsToValues(sTmp); - pLayer->SetCurl(sTmp); - } - pLayer->SetShell(this); - pLayer->FetchEventsByRange(&d,&d1,&EventList); - } - break; - - default: - { - /* need to report that this is an unhandled curl type */ - } - break; - } - - return NS_OK; -} - -nsresult nsCalendarShell::Logoff() -{ - /* - * Shut down any open CAPI sessions. - */ - mSessionMgr.Shutdown(); - - return NS_OK; -} - - -/* - * DEFAULT PREFERENCES - * If you have a new preference for calendar, here's what to do: - * 1. Add the defines for the key name and a default value in nscalstrings.h - * 2. Add the key name and default value defines in the table below. - * 3. you're all set - */ -typedef struct -{ - char* psKey; - char* psVal; -} JULIAN_KEY_VAL; - -static JULIAN_KEY_VAL KVPairs[] = -{ - CAL_STRING_PREF_JULIAN_UI_XML_MENUBAR, CAL_STRING_RESOURCE_UI_MENUBAR, - CAL_STRING_PREF_JULIAN_UI_XML_TOOLBAR, CAL_STRING_RESOURCE_UI_TOOLBAR, - CAL_STRING_PREF_JULIAN_UI_XML_CALENDAR, CAL_STRING_RESOURCE_UI_CALENDAR, - CAL_STRING_PREF_LOCAL_ADDRESS, CAL_STRING_PREF_LOCAL_ADDRESS_DEFAULT, - CAL_STRING_PREF_PREFERRED_ADDR, CAL_STRING_PREF_PREFERRED_ADDR_DEFAULT, - CAL_STRING_PREF_USERNAME, CAL_STRING_PREF_USERNAME_DEFAULT, - CAL_STRING_PREF_USER_DISPLAY_NAME, CAL_STRING_PREF_USER_DISPLAY_NAME_DEFAULT, - - /* Enter new key, default-value pairs above this line */ - 0, 0 -}; - -/** - * Load all the preferences listed in the table above. Set any - * preferences that do not exist to their default value. Save the - * preferences upon completion. - * @return NS_OK - */ -nsresult nsCalendarShell::SetDefaultPreferences() -{ - char pref[1024]; - int i = 1024; - - for (int j = 0; 0 != KVPairs[j].psKey ; j++) - { - if (0 != mShellInstance->GetPreferences()->GetCharPref(KVPairs[j].psKey, pref, &i)) - mShellInstance->GetPreferences()->SetCharPref(KVPairs[j].psKey, KVPairs[j].psVal); - } - - return mShellInstance->GetPreferences()->SavePrefFile(); -} - -/* - * the list of environment variables we're interested in... - */ -static char *gtVars[] = -{ - "$USERNAME", - "$USERPROFILE", - 0 -}; - -/** - * Preferences may contain references to variables that are filled - * in at run time. The current list is: - * - *
- *  variable         meaning
- *  ---------------  ----------------------------------------------
- *  $USERNAME        the OS username or other default user name
- *  $USERPROFILE     the file path to where the user's local data
- *                   should be stored.
- *  
- * - * This routine replaces the variables with their current values. - * The results are returned in the supplied buffer. - * - * @param s the calendar url preference - * @param iBufSize the amount of space available in psCurl - * @return 0 on success - */ -nsresult nsCalendarShell::EnvVarsToValues(JulianString& s) -{ - PRInt32 iIndex; - PRInt32 i; - char* p; - char* psEnv; - - /* - * Replace all callouts of the env vars with their values... - */ - for (i = 0; 0 != gtVars[i]; i++) - { - p = gtVars[i]; - if (-1 != s.Find(p)) - { - psEnv = PR_GetEnv(&p[1]); - if (0 != psEnv) - { - while (-1 != (iIndex = s.Find(p))) - { - s.Replace(iIndex, iIndex + PL_strlen(p) - 1, psEnv); - } - } - } - } - return 0; -} - - -/** - * Load the preferences that help us get bootstrapped. Specifically, - * determine the cal url for the user. - * @return NS_OK on success. Otherwise errors from retrieving preferences. - */ -nsresult nsCalendarShell::LoadPreferences() -{ - nsresult res = NS_OK; - - nsCurlParser curl; - - /* - * Load the overriding user preferences - */ - mShellInstance->GetPreferences()->Startup("prefs.js"); - - /* - * Set the default preferences - */ - SetDefaultPreferences(); - char sBuf[1024]; - int iBufSize = 1024; - int iSavePrefs = 0; - JulianString s; - - sBuf[0]=0; - - nsIUser* pUser; - if (NS_OK != (res = mpLoggedInUser->QueryInterface(kIUserIID,(void**)&pUser))) - return res ; - - /* - * fill in info for the user... - */ - mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_USERNAME,sBuf, &iBufSize ); - s = sBuf; - EnvVarsToValues(s); - nsString nsstrUserName = s.GetBuffer(); - pUser->SetUserName(nsstrUserName); - - /* - * Add the logged in user to the user list... - */ - mUserList.Add( mpLoggedInUser ); - - /*****************************************************************/ - - /* - * This section of code needs to be revamped after a review. - * Currently, it expects to load a local and preferred cal url. - * We need to rethink this. - */ - - /* - * Get the local cal address. - */ - mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_LOCAL_ADDRESS,sBuf, &iBufSize ); - s = sBuf; - EnvVarsToValues(s); - curl = s; - curl.ResolveFileURL(); - - /* XXX for now, we're ignoring this value... */ - - /* - * Load the preferred cal address. For now, the local cal address is the default too... - */ - mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_PREFERRED_ADDR,sBuf, &iBufSize ); - s = sBuf; - EnvVarsToValues(s); - curl = s; - curl.ResolveFileURL(); - // mpLoggedInUser->AddCalAddr(new JulianString(curl.GetCurl().GetBuffer())); - - /* - * create a layer for the preferred address - */ - nsILayer* pLayer; - if (NS_OK != (res = nsRepository::CreateInstance( - kCLayerCollectionCID, // class id that we want to create - nsnull, // not aggregating anything (this is the aggregatable interface) - kILayerIID, // interface id of the object we want to get back - (void**)&pLayer))) - return 1; // XXX fix this - pLayer->Init(); - pLayer->SetCurl(curl.GetCurl()); - mpLoggedInUser->SetLayer(pLayer); - NS_RELEASE(pLayer); - - /*****************************************************************/ - - /* - * Get the user's display name - */ - mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_USER_DISPLAY_NAME,sBuf, &iBufSize ); - // mpLoggedInUser->SetDisplayName(sBuf); // XXX fix this - - /* - * Set the curl to use for the logged in user's calendar... - */ - // msCalURL = * mpLoggedInUser->GetPreferredCalAddr(); - msCalURL = curl.GetCurl(); - - /* - * XXX: We gotta ask for this or save a secure password pref or something... - */ - SetCAPIPassword("HeyBaby"); - - NS_RELEASE(pUser); - - return NS_OK; -} - -/* - * Load the UI for this instance - */ - -nsresult nsCalendarShell::LoadUI() -{ - - /* - * First, create the ObserverManager - */ - - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&mObserverManager); - - /* - * Now create an actual window into the world - */ - - nsRect aRect(20,20,800,600) ; - - /* - * Get our nsIAppShell interface and pass it down - */ - - nsIAppShell * appshell = nsnull; - - nsresult res = QueryInterface(kIAppShellIID,(void**)&appshell); - - if (NS_OK != res) - return res ; - - mShellInstance->CreateApplicationWindow(appshell, aRect); - - NS_RELEASE(appshell); - - /* - * Load a Container - */ - - static NS_DEFINE_IID(kCCalContainerCID, NS_CALENDAR_CONTAINER_CID); - - res = NS_NewCalendarContainer((nsICalendarContainer **)&(mDocumentContainer)) ; - - if (NS_OK != res) - return res ; - - mDocumentContainer->SetApplicationShell((nsIApplicationShell*)this); - - mDocumentContainer->SetToolbarManager(mShellInstance->GetToolbarManager()); - - // Start the widget from upper left corner - aRect.x = aRect.y = 0; - - mDocumentContainer->Init(mShellInstance->GetApplicationWidget(), - aRect, - this) ; - - char pUI[1024]; - int i = 1024; - - /* - * Now Load the Canvas UI - */ - - mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_JULIAN_UI_XML_CALENDAR,pUI,&i); - res = mDocumentContainer->LoadURL(pUI,nsnull); - - mShellInstance->ShowApplicationWindow(PR_TRUE) ; - - return res ; -} - -nsresult nsCalendarShell::SetCAPIPassword(char * aCAPIPassword) -{ - if (mCAPIPassword) - PR_Free(mCAPIPassword); - - mCAPIPassword = (char *) PR_Malloc(nsCRT::strlen(aCAPIPassword)+1); - - nsCRT::memcpy(mCAPIPassword, aCAPIPassword, nsCRT::strlen(aCAPIPassword)+1); - - return NS_OK; -} - -char * nsCalendarShell::GetCAPIPassword() -{ - return (mCAPIPassword); -} - - -nsresult nsCalendarShell::SetCAPIHandle(CAPIHandle aCAPIHandle) -{ - mCAPIHandle = aCAPIHandle; - return NS_OK; -} - -CAPIHandle nsCalendarShell::GetCAPIHandle() -{ - return (mCAPIHandle); -} - -nsresult nsCalendarShell::SetCAPISession(CAPISession aCAPISession) -{ - mCAPISession = aCAPISession; - return NS_OK; -} - -CAPISession nsCalendarShell::GetCAPISession() -{ - return (mCAPISession); -} - -nsresult nsCalendarShell::Create(int* argc, char ** argv) -{ - return NS_OK; -} -nsresult nsCalendarShell::Exit() -{ - NS_IF_RELEASE(mDocumentContainer); - - NLS_Terminate(); - - return NS_OK; -} - -nsresult nsCalendarShell::Run() -{ - mShellInstance->Run(); - return NS_OK; -} - -nsresult nsCalendarShell::SetDispatchListener(nsDispatchListener* aDispatchListener) -{ - return NS_OK; -} -void* nsCalendarShell::GetNativeData(PRUint32 aDataType) -{ -#ifdef XP_UNIX - if (aDataType == NS_NATIVE_SHELL) - return topLevel; - - return nsnull; -#else - return (mShellInstance->GetApplicationWidget()); -#endif - -} - -nsresult nsCalendarShell::RegisterFactories() -{ - /* - Until an installer does this for us, we do it here - */ - - // hardcode names of dll's -#ifdef NS_WIN32 - #define CALUI_DLL "calui10.dll" - #define XPFC_DLL "xpfc10.dll" -#else - #define CALUI_DLL "libcalui10.so" - #define XPFC_DLL "libxpfc10.so" -#endif - - // register graphics classes - static NS_DEFINE_IID(kCXPFCCanvasCID, NS_XPFC_CANVAS_CID); - static NS_DEFINE_IID(kCCalTimeContextCID, NS_CAL_TIME_CONTEXT_CID); - static NS_DEFINE_IID(kCCalContextControllerCID, NS_CAL_CONTEXT_CONTROLLER_CID); - - nsRepository::RegisterFactory(kCXPFCCanvasCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalTimeContextCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalContextControllerCID, CALUI_DLL, PR_FALSE, PR_FALSE); - - static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID); - static NS_DEFINE_IID(kCVectorIteratorCID, NS_ARRAY_ITERATOR_CID); - - nsRepository::RegisterFactory(kCVectorCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCVectorIteratorCID, XPFC_DLL, PR_FALSE, PR_FALSE); - - static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); - nsRepository::RegisterFactory(kCXPFCObserverManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE); - - // Register the CAPI implementations - nsRepository::RegisterFactory(kCCapiLocalCID, CAPI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCapiCSTCID, CAPI_DLL, PR_FALSE, PR_FALSE); - - // Register the Core Implementations - nsRepository::RegisterFactory(kCCalendarUserCID, CORE_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalendarModelCID, CORE_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCLayerCID, CORE_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCLayerCollectionCID, CORE_DLL, PR_FALSE, PR_FALSE); - - // register classes - nsRepository::RegisterFactory(kCCalTimeContextCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalComponentCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalContextControllerCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalTimebarContextControllerCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalCanvasCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalMonthContextControllerCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalToolkitCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCVectorCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCVectorIteratorCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCDateTimeCID, UTIL_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCstackCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCDurationCID, UTIL_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalDurationCommandCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalDayListCommandCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalFetchEventsCommandCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalNewModelCommandCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalStatusCanvasCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalCommandCanvasCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalTodoComponentCanvasCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalDayViewCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalMonthViewCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalMultiDayViewCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalMultiUserViewCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCalTimebarHeadingCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCalTimebarUserHeadingCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCalTimebarTimeHeadingCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCalTimebarScaleCID, CALUI_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalXMLDTD, PARSER_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCCalXMLContentSink, PARSER_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCDTD, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCContentSink, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCLayoutCID, XPFC_DLL, PR_TRUE, PR_TRUE); - nsRepository::RegisterFactory(kCBoxLayoutCID, XPFC_DLL, PR_TRUE, PR_TRUE); - nsRepository::RegisterFactory(kCXPFCObserverCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCSubjectCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCObserverManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCCommandCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCCanvasCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCHTMLCanvasCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFolderCanvasCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCCanvasCID, XPFC_DLL, PR_TRUE, PR_TRUE); - nsRepository::RegisterFactory(kCXPFCCanvasManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCMethodInvokerCommandCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCNotificationStateCommandCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCModelUpdateCommandCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCActionCommandCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCXPFCCommandServerCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCSMTPServiceCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCMIMEServiceCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCMessageCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCMIMEMessageCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCMIMEBodyPartCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCMIMEBasicBodyPartCID, XPFC_DLL, PR_FALSE, PR_FALSE); - - return NS_OK; -} - -nsresult nsCalendarShell::GetWebViewerContainer(nsIWebViewerContainer ** aWebViewerContainer) -{ - *aWebViewerContainer = (nsIWebViewerContainer*) mDocumentContainer; - NS_ADDREF(*aWebViewerContainer); - return NS_OK; -} - -nsEventStatus nsCalendarShell::HandleEvent(nsGUIEvent *aEvent) -{ - nsEventStatus result = nsEventStatus_eConsumeNoDefault; - - switch(aEvent->message) { - - case NS_CREATE: - { - return nsEventStatus_eConsumeNoDefault; - } - break ; - - case NS_DESTROY: - { - if (mShellInstance->GetApplicationWidget() == aEvent->widget) - { - result = mDocumentContainer->HandleEvent(aEvent); - Exit(); - return result; - } - if (mDocumentContainer != nsnull) - return (mDocumentContainer->HandleEvent(aEvent)); - } - break ; - - case NS_PAINT: - { - ((nsPaintEvent*)aEvent)->rect->x = 0 ; - ((nsPaintEvent*)aEvent)->rect->y = 0 ; - if (mDocumentContainer != nsnull) - return (mDocumentContainer->HandleEvent(aEvent)); - } - break; - - case NS_SIZE: - { - ((nsSizeEvent*)aEvent)->windowSize->x = 0 ; - ((nsSizeEvent*)aEvent)->windowSize->y = 0 ; - } - default: - { - if (mDocumentContainer != nsnull) - return (mDocumentContainer->HandleEvent(aEvent)); - } - break; - - } - - return nsEventStatus_eIgnore; - -} - -nsresult nsCalendarShell::ReceiveCommand(nsString& aCommand, nsString& aReply) -{ - SendCommand(aCommand,aReply); -#if 0 - /* - * Call SendCommand on the CommandCanvas! - */ - nsIXPFCCanvas * root = nsnull ; - nsIXPFCCanvas * canvas = nsnull; - - nsString name("CommandCanvas"); - - gXPFCToolkit->GetRootCanvas(&root); - - canvas = root->CanvasFromName(name); - - if (canvas != nsnull) - { - nsCalCommandCanvas * cc ; - - static NS_DEFINE_IID(kCalCommandCanvasCID, NS_CAL_COMMANDCANVAS_CID); - nsresult res = canvas->QueryInterface(kCalCommandCanvasCID,(void**)&cc); - - if (res == NS_OK) - { - cc->SendCommand(aCommand, aReply); - NS_RELEASE(cc); - } - } - - NS_RELEASE(root); -#endif - return NS_OK; -} - -nsresult nsCalendarShell::ExecuteCommandScript(nsString aScript) -{ - /* - * Make sure the CommandServer is running ... - */ - - StartCommandServer(); - - /* - * Now launch the app that can handle scripting interaction with zulu - */ - - nsString script = "-s "; - script += aScript; - - mShellInstance->LaunchApplication(nsString("zulutest"),script); - - return NS_OK; -} - -nsresult nsCalendarShell::StartCommandServer() -{ - - if (mCommandServer) - return NS_OK; - - static NS_DEFINE_IID(kICommandServerIID, NS_IXPFC_COMMAND_SERVER_IID); - static NS_DEFINE_IID(kCCommandServerCID, NS_XPFC_COMMAND_SERVER_CID); - static NS_DEFINE_IID(kIApplicationShellIID, NS_IAPPLICATIONSHELL_IID); - - nsresult res = nsRepository::CreateInstance(kCCommandServerCID, - nsnull, - kICommandServerIID, - (void **)&mCommandServer); - - if (NS_OK != res) - return res ; - - mCommandServer->Init((nsIApplicationShell *)this); - - return NS_OK; -} - - - -// XXX BAD BAD BAD GROSSNESS ... Here so Linux will link ... ARGH! - - -#include "xp_mcom.h" -#include "net.h" - -extern "C" XP_Bool ValidateDocData(MWContext *window_id) -{ - printf("ValidateDocData not implemented, stubbed in CalendarShell.cpp\n"); - return PR_TRUE; -} - -/* dist/public/xp/xp_linebuf.h */ -extern "C" int XP_ReBuffer (const char *net_buffer, int32 net_buffer_size, - uint32 desired_buffer_size, - char **bufferP, uint32 *buffer_sizeP, - uint32 *buffer_fpP, - int32 (*per_buffer_fn) (char *buffer, - uint32 buffer_size, - void *closure), - void *closure) -{ - - printf("XP_ReBuffer not implemented, stubbed in CalendarShell.cpp\n"); - return(0); -} - - -/* mozilla/include/xp_trace.h */ - -#if defined(NS_DEBUG) -extern "C" void XP_Trace( const char *, ... ) -{ - printf("XP_Trace not implemented, stubbed in CalendarShell.cpp\n"); -} -#endif - -// XXX: Move Me. This code was in the CommandCanvas, but is really -// independent of any UI -// XXX: Lots of testing code is going here, needs to be moved... - -nsresult nsCalendarShell :: SendCommand(nsString& aCommand, nsString& aReply) -{ - - /* - * Extract the CanvasName, method and params out - */ - - nsString target, name, method, param; - - aCommand.Trim(" \r\n\t"); - - PRInt32 offset = aCommand.Find(' '); - - if (offset == kNotFound) - { - target = aCommand; - } else { - - aCommand.Left(target,offset); - aCommand.Cut(0,offset); - aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE); - - offset = aCommand.Find(' '); - - if (offset == kNotFound) - { - name = aCommand; - } else { - - aCommand.Left(name,offset); - aCommand.Cut(0,offset); - aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE); - - offset = aCommand.Find(' '); - - if (offset == kNotFound) - { - method = aCommand; - param = ""; - } else - { - aCommand.Left(method,offset); - aCommand.Cut(0,offset); - aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE); - - param = aCommand; - } - } - } - - /* - * MCC mini calendar controller - */ - if (target.EqualsIgnoreCase(CAL_STRING_CMD_MCC)) - { - nsIXPFCCanvas * root = nsnull; - nsIXPFCCanvas * canvas = nsnull; - gXPFCToolkit->GetRootCanvas(&root); - canvas = root->CanvasFromName(name); - NS_RELEASE(root); - if (canvas == nsnull) - return NS_OK; - - /* - * Send this command directly to the the canvas. - */ - static NS_DEFINE_IID(kCXPFCMethodInvokerCommandCID, NS_XPFC_METHODINVOKER_COMMAND_CID); - static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); - static NS_DEFINE_IID(kCXPFCObserverIID, NS_IXPFC_OBSERVER_IID); - static NS_DEFINE_IID(kCXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); - nsXPFCMethodInvokerCommand * command; - nsresult res = nsRepository::CreateInstance(kCXPFCMethodInvokerCommandCID, nsnull, kXPFCCommandIID, (void **)&command); - if (NS_OK != res) - return res ; - command->Init(); - command->mMethod = method; - command->mParams = param; - - /* - * Pass this Command onto the Observer interface of the target canvas directly. - * There is no need to go through the ObserverManager since we have the - * necessary info - */ - nsIXPFCObserver * observer = nsnull; - nsIXPFCSubject * subject = nsnull; - res = canvas->QueryInterface(kCXPFCObserverIID, (void **)&observer); - if (res == NS_OK) - observer->Update(subject,command); - aReply = command->mReply; - - NS_IF_RELEASE(command); - NS_IF_RELEASE(observer); - } - - if (target.EqualsIgnoreCase(XPFC_STRING_PANEL)) - { - nsIXPFCCanvas * root = nsnull; - nsIXPFCCanvas * canvas = nsnull; - - gXPFCToolkit->GetRootCanvas(&root); - - canvas = root->CanvasFromName(name); - - NS_RELEASE(root); - - if (canvas == nsnull) - return NS_OK; - - /* - * Send this command directly to the the canvas. - */ - - static NS_DEFINE_IID(kCXPFCMethodInvokerCommandCID, NS_XPFC_METHODINVOKER_COMMAND_CID); - static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); - static NS_DEFINE_IID(kCXPFCObserverIID, NS_IXPFC_OBSERVER_IID); - static NS_DEFINE_IID(kCXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); - - nsXPFCMethodInvokerCommand * command; - - nsresult res = nsRepository::CreateInstance(kCXPFCMethodInvokerCommandCID, - nsnull, - kXPFCCommandIID, - (void **)&command); - - if (NS_OK != res) - return res ; - - command->Init(); - - command->mMethod = method; - command->mParams = param; - - /* - * Pass this Command onto the Observer interface of the target canvas directly. - * There is no need to go through the ObserverManager since we have the - * necessary info - */ - - nsIXPFCObserver * observer = nsnull; - nsIXPFCSubject * subject = nsnull; - - res = canvas->QueryInterface(kCXPFCObserverIID, (void **)&observer); - if (res == NS_OK) - observer->Update(subject,command); - - aReply = command->mReply; - - NS_IF_RELEASE(command); - NS_IF_RELEASE(observer); - } - /* - * HELP - */ - else if (target.EqualsIgnoreCase(XPFC_STRING_HELP)) { - - /* - * Return basic help? - */ - - if (name.Length() == 0) - { - aReply = ZULUCOMMAND_HELP; - - } else if (name.EqualsIgnoreCase(XPFC_STRING_PANEL)) { - - aReply = ZULUCOMMAND_HELP_PANEL; - - } else { - - aReply = "ERROR: Command Not Known:\r\n"; - aReply += ZULUCOMMAND_HELP; - - } - - - } else { - aReply = "ERROR: target class unknown\r\n"; - } - - return NS_OK; -} - diff --git a/mozilla/calendar/modules/shell/src/nsCalendarWidget.cpp b/mozilla/calendar/modules/shell/src/nsCalendarWidget.cpp deleted file mode 100644 index 24702096877..00000000000 --- a/mozilla/calendar/modules/shell/src/nsCalendarWidget.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -/* - * Define while hooking up the XML parser... - */ - -#define USE_PARSER 1 -#define HARDCODE_UI - -class nsICalendarShell; - -#include -#include "nsCalendarWidget.h" - -#include "nsCalShellCIID.h" -#include "nscalcids.h" -#include "nsCRT.h" -#include "plstr.h" -#include "julnstr.h" -#include "nsICalTimeContext.h" -#include "nsICalComponent.h" -#include "nsIXPFCObserver.h" -#include "nsIXPFCCanvasManager.h" -#include "nsIXPFCCommand.h" -#include "nsCalDurationCommand.h" -#include "nsXPFCActionCommand.h" -#include "nsIXPFCSubject.h" -#include "nsICalContextController.h" -#include "nsCalTimebarContextController.h" -#include "nsCalMonthContextController.h" -#include "nsIXPFCCanvas.h" -#include "nsIParser.h" -#include "nsParserCIID.h" -#include "nsIDTD.h" -#include "nsCalXMLContentSink.h" -#include "nsCalXMLDTD.h" -#include "nsXPFCXMLContentSink.h" -#include "nsXPFCXMLDTD.h" -#include "nsCurlParser.h" -#include "nsCalToolkit.h" -#include "nsBoxLayout.h" -#include "nsStreamManager.h" - -#include "nsColor.h" -#include "nsFont.h" - -#include "nsCalDayViewCanvas.h" -#include "nsCalMonthViewCanvas.h" -#include "nsCalMultiDayViewCanvas.h" -#include "nsCalMultiUserViewCanvas.h" -#include "nsCalTodoComponentCanvas.h" -#include "nsCalTimebarHeading.h" -#include "nsCalTimebarUserHeading.h" -#include "nsCalTimebarTimeHeading.h" - -#include "nsCalStatusCanvas.h" -#include "nsCalCommandCanvas.h" - -#include "nsICalendarShell.h" -#include "nsCalendarShell.h" -#include "nsIView.h" - -#include "plstr.h" -#include "prprf.h" /* PR_snprintf(...) */ -#include "prmem.h" /* PR_Malloc(...) / PR_Free(...) */ - -// hardcode names of dll's -#ifdef NS_WIN32 - #define CALUI_DLL "calui10.dll" - #define UTIL_DLL "util10.dll" - #define PARSER_DLL "calparser10.dll" - #define XPFC_DLL "xpfc10.dll" -#else - #define CALUI_DLL "libcalui10.so" - #define UTIL_DLL "libutil10.so" - #define PARSER_DLL "libcalparser10.so" - #define XPFC_DLL "libxpfc10.so" -#endif - -#define FOREGROUND_COLOR NS_RGB(0,0,128) - -#define HARDCODE_SPACE 420 - -nsCalendarWidget::nsCalendarWidget() -{ - NS_INIT_REFCNT(); - mCalendarShell = nsnull; - mWindow = nsnull; -} - -NS_IMPL_QUERY_INTERFACE(nsCalendarWidget, kICalWidgetIID) -NS_IMPL_ADDREF(nsCalendarWidget) -NS_IMPL_RELEASE(nsCalendarWidget) - -nsCalendarWidget::~nsCalendarWidget() -{ - // Release windows and views - NS_IF_RELEASE(mWindow); - ((nsIApplicationShell *)mCalendarShell)->Release(); -} - - -nsresult nsCalendarWidget::Init(nsNativeWidget aNativeParent, - nsIDeviceContext* aDeviceContext, - nsIPref* aPrefs, - const nsRect& aBounds, - nsScrollPreference aScrolling) - -{ - return NS_OK; -} - -nsresult nsCalendarWidget::Init(nsIView * aParent, - const nsRect& aBounds, - nsICalendarShell * aCalendarShell) -{ - - mCalendarShell = aCalendarShell; - - NS_ADDREF(((nsIApplicationShell *)mCalendarShell)); - - return NS_OK; - -} - -nsRect nsCalendarWidget::GetBounds() -{ - nsRect zr(0, 0, 0, 0); - - nsIXPFCCanvas * root = nsnull ; - - gXPFCToolkit->GetRootCanvas(&root); - - if (nsnull != root) { - root->GetBounds(zr); - NS_RELEASE(root); - } - - return zr; -} - -void nsCalendarWidget::SetBounds(const nsRect& aBounds) -{ -} - -void nsCalendarWidget::Move(PRInt32 aX, PRInt32 aY) -{ -} - -void nsCalendarWidget::Show() -{ -} - -void nsCalendarWidget::Hide() -{ -} - -nsresult nsCalendarWidget::BindToDocument(nsISupports *aDoc, const char *aCommand) -{ - return NS_OK; -} - -nsresult nsCalendarWidget::SetContainer(nsIContentViewerContainer* aContainer) -{ - return NS_OK; -} - -nsresult nsCalendarWidget::GetContainer(nsIContentViewerContainer*& aContainerResult) -{ - return NS_OK; -} - -nsresult nsCalendarWidget::LoadURL(const nsString& aURLSpec, - nsIStreamObserver* aListener, - nsIXPFCCanvas * aParentCanvas, - nsIPostData * aPostData) -{ - - nsresult res ; - - nsString aURLToLoad = aURLSpec; - - nsIXPFCCanvas * target_canvas = aParentCanvas; - - nsIStreamManager * stream_manager = ((nsCalendarShell *)mCalendarShell)->mShellInstance->GetStreamManager(); - - if (stream_manager == nsnull) - return NS_OK; - - nsIID * iid_dtd = nsnull; - nsIID * iid_sink = nsnull ; - - /* - * Let's see if there is a target on this URL and delete that tree. - * - * Note we need some way of maintaining the model hookup here .... I think - */ - - if (aURLSpec.Find("?") != -1) - { - /* - * We have options, let's see if one of them in target= - */ - - PRInt32 offset = aURLSpec.Find("target="); - - if (offset != -1) - { - - /* - * Ok, find the container with the specified name, - * destroy all its contents, and use it as the target - * base parent for the new XML! - */ - - nsString target ; - nsString temp = aURLSpec ; - - offset += 7; - - temp.Mid(target, offset, aURLSpec.Length() - offset); - - offset = target.Find("?"); - - if (offset != -1) - { - target.Cut(offset, target.Length() - offset); - } - - /* - * find the target canvas - */ - - nsIXPFCCanvas * root = nsnull ; - - gXPFCToolkit->GetRootCanvas(&root); - - target_canvas = root->CanvasFromName(target); - - if (target_canvas) - { - target_canvas->DeleteChildren(); - } - - NS_RELEASE(root); - - } - - } - - /* - * change the DTD and Sink if this is a Calendar XML - */ - - if (aURLSpec.Find(".cal") != -1) - { - static NS_DEFINE_IID(kCCalXMLDTD, NS_ICALXML_DTD_IID); - static NS_DEFINE_IID(kCCalXMLContentSinkCID, NS_CALXMLCONTENTSINK_IID); - - iid_dtd = (nsIID *) &kCCalXMLDTD; - iid_sink = (nsIID *) &kCCalXMLContentSinkCID; - - } - - /* - * XXX: Get rid of this code! - * - * If we do not understand this url, lets create a canvas that embeds - * raptor. - * - * Ideally, we'd all be using netlib and some sort of mime registration, - * but til then.... - */ - - if (aURLSpec.Find(".cal") == -1 && aURLSpec.Find(".ui") == -1) - { - aURLToLoad = "resource://res/ui/julian_html_blank.cal?target=content" ; - - /* - * Register ourselves as a StreamListener, and then load the actual - * URL when the ui framework is done - */ - } - - - /* - * Load the URL - */ - - res = stream_manager->LoadURL(((nsCalendarShell*)mCalendarShell)->mDocumentContainer, - target_canvas, - aURLToLoad, - aPostData, - iid_dtd, - iid_sink); - - return res; - -} - - -NS_CALENDAR nsresult NS_NewCalendarWidget(nsICalendarWidget** aInstancePtrResult) -{ - NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); - if (nsnull == aInstancePtrResult) { - return NS_ERROR_NULL_POINTER; - } - nsCalendarWidget* it = new nsCalendarWidget(); - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - return it->QueryInterface(kICalWidgetIID, (void **) aInstancePtrResult); -} - -nsIWidget* nsCalendarWidget::GetWWWindow() -{ - if (nsnull != mWindow) { - NS_ADDREF(mWindow); - } - return mWindow; -} - -nsEventStatus nsCalendarWidget::HandleEvent(nsGUIEvent *aEvent) -{ - nsIXPFCCanvas * root = nsnull ; - - gXPFCToolkit->GetRootCanvas(&root); - - nsEventStatus st = root->HandleEvent(aEvent); - - NS_RELEASE(root); - - return (st); -} - diff --git a/mozilla/calendar/modules/test/Makefile b/mozilla/calendar/modules/test/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/test/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/test/inc/Makefile b/mozilla/calendar/modules/test/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/test/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/test/inc/manifest.mn b/mozilla/calendar/modules/test/inc/manifest.mn deleted file mode 100644 index 4b8c45aef69..00000000000 --- a/mozilla/calendar/modules/test/inc/manifest.mn +++ /dev/null @@ -1,24 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. - -EXPORTS = \ - nsTrexTestShell.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsTrexTestShell.h \ - nsTrexTestShellCIID.h \ - nsTrexTestShellFactory.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor xpfc diff --git a/mozilla/calendar/modules/test/inc/nsTrexTestShell.h b/mozilla/calendar/modules/test/inc/nsTrexTestShell.h deleted file mode 100644 index 2a68fdff342..00000000000 --- a/mozilla/calendar/modules/test/inc/nsTrexTestShell.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef _nsTrexTestShell_h__ -#define _nsTrexTestShell_h__ - -#include "nsITrexTestShell.h" -#include "nsIFactory.h" -#include "nsRepository.h" -#include "nsIShellInstance.h" -#include "nsIWidget.h" -#include "nsGUIEvent.h" -#include "nsRect.h" -#include "nsApplicationManager.h" -#include "nsIContentViewer.h" -#include "nsCRT.h" -#include "plstr.h" -#include "nsIWidget.h" -#include "nsITextWidget.h" -#include "nsITextAreaWidget.h" -#include "nspr.h" -#include "jsapi.h" -#include "nsIStreamListener.h" - -#define TCP_MESG_SIZE 1024 -#define TCP_SERVER_PORT 666 -#define NUM_TCP_CLIENTS 10 -#define NUM_TCP_CONNECTIONS_PER_CLIENT 5 -#define NUM_TCP_MESGS_PER_CONNECTION 10 -#define SERVER_MAX_BIND_COUNT 100 - -typedef struct buffer { - char data[TCP_MESG_SIZE * 2]; -} buffer; - -class nsIURL; - -class nsTrexTestShell : public nsITrexTestShell, - public nsIStreamListener -{ -public: - nsTrexTestShell(); - ~nsTrexTestShell(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - // nsIAppShell interfaces - NS_IMETHOD Create(int* argc, char ** argv) ; - NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener) ; - NS_IMETHOD Exit(); - virtual nsresult Run(); - virtual void* GetNativeData(PRUint32 aDataType) ; - - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) ; - NS_IMETHOD GetWebViewerContainer(nsIWebViewerContainer ** aWebViewerContainer) ; - NS_IMETHOD StartCommandServer(); - - NS_IMETHOD ReceiveCallback(nsICollectedData& aReply); - NS_IMETHOD SendCommand(nsString& aCommand); - NS_IMETHOD ExecuteJS(); - -private: - NS_METHOD RegisterFactories(); - NS_IMETHOD SendJS(nsString& aCommand); - NS_IMETHOD LoadScript(nsString& aScript); - NS_IMETHOD ReceiveCommand(nsString& aCommand, nsString& aReply); - NS_METHOD ParseCommandLine(); - NS_IMETHOD LoadUI(); - NS_IMETHOD InitNetwork(); - -private: - nsIShellInstance * mShellInstance ; - nsITextAreaWidget * mDisplay; - nsITextWidget * mInput; - -public: - NS_IMETHOD RunThread(); - NS_IMETHOD ExitThread(); - -private: - PRMonitor * mExitMon; /* monitor to signal on exit */ - PRInt32 * mExitCounter; /* counter to decrement, before exit */ - PRInt32 mDatalen; /* bytes of data transfered in each read/write */ - PRInt32 mNumThreads; - PRMonitor * mClientMon; - PRNetAddr mClientAddr; - nsString mCommand; - JSRuntime * mJSRuntime ; - JSContext * mJSContext; - JSObject * mJSGlobal; - JSObject * mJSZuluObject; - nsString mScript; - nsIURL * mURL; - nsIStreamListener * mListener; - nsString mJSData; - PRBool mQuiet; - PRBool mVerbose; - PRBool mStdOut; - - // nsIStreamListener interfaces -public: - NS_IMETHOD GetBindInfo(nsIURL* aURL); - NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *aIStream, PRInt32 aLength) ; - NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType); - NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax); - NS_IMETHOD OnStatus(nsIURL* aURL, const nsString &aMsg); - NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString &aMsg); - - -}; - -#endif diff --git a/mozilla/calendar/modules/test/inc/nsTrexTestShellCIID.h b/mozilla/calendar/modules/test/inc/nsTrexTestShellCIID.h deleted file mode 100644 index fb1be5d705e..00000000000 --- a/mozilla/calendar/modules/test/inc/nsTrexTestShellCIID.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsTrexTestShellCIID_h__ -#define nsTrexTestSehllCIID_h__ - -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsRepository.h" - -//76a0a210-3794-11d2-9248-00805f8a7ab6 -#define NS_TREXTEST_SHELL_CID \ -{ 0x76a0a210, 0x3794, 0x11d2, \ -{ 0x92, 0x48, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - - - -#endif diff --git a/mozilla/calendar/modules/test/inc/nsTrexTestShellFactory.h b/mozilla/calendar/modules/test/inc/nsTrexTestShellFactory.h deleted file mode 100644 index 8780205af24..00000000000 --- a/mozilla/calendar/modules/test/inc/nsTrexTestShellFactory.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsIFactory.h" -#include "nsISupports.h" -#include "nsTrexTestShellCIID.h" - -#include "nsTrexTestShell.h" - -class nsTrexTestShellFactory : public nsIFactory -{ - public: - // nsISupports methods - NS_IMETHOD QueryInterface(const nsIID &aIID, - void **aResult); - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - // nsIFactory methods - NS_IMETHOD CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult); - - NS_IMETHOD LockFactory(PRBool aLock); - - nsTrexTestShellFactory(const nsCID &aClass); - ~nsTrexTestShellFactory(); - - private: - nsrefcnt mRefCnt; - nsCID mClassID; -}; - diff --git a/mozilla/calendar/modules/test/manifest.mn b/mozilla/calendar/modules/test/manifest.mn deleted file mode 100644 index 8e4420ee209..00000000000 --- a/mozilla/calendar/modules/test/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../.. -DEPTH = ../../.. - -DIRS_EXPORT = public inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/test/public/Makefile b/mozilla/calendar/modules/test/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/test/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/test/public/manifest.mn b/mozilla/calendar/modules/test/public/manifest.mn deleted file mode 100644 index 1099e7eee3c..00000000000 --- a/mozilla/calendar/modules/test/public/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -EXPORTS = \ - nsITrexTestShell.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor xpfc diff --git a/mozilla/calendar/modules/test/public/nsITrexTestShell.h b/mozilla/calendar/modules/test/public/nsITrexTestShell.h deleted file mode 100644 index 6791713619f..00000000000 --- a/mozilla/calendar/modules/test/public/nsITrexTestShell.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ -#ifndef nsITrexTestShell_h___ -#define nsITrexTestShell_h___ - -#include "nsISupports.h" -#include "nsIApplicationShell.h" -#include "nscore.h" -#include "nsIAppShell.h" - -//7d1768a0-3793-11d2-9248-00805f8a7ab6 -#define NS_ITREXTEST_SHELL_IID \ -{ 0x7d1768a0, 0x3793, 0x11d2, \ -{ 0x92, 0x48, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -// Interface to the application shell. -class nsITrexTestShell : public nsIApplicationShell, - public nsIAppShell -{ - -public: - - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) = 0 ; - -}; - -#endif /* nsITrexTestShell_h___ */ diff --git a/mozilla/calendar/modules/test/src/Makefile b/mozilla/calendar/modules/test/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/test/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/test/src/config.mk b/mozilla/calendar/modules/test/src/config.mk deleted file mode 100644 index 78b2cb632e4..00000000000 --- a/mozilla/calendar/modules/test/src/config.mk +++ /dev/null @@ -1,73 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_TREXTEST -DNSPR20 -I$(GDEPTH)/include - -PROGRAM = zulutest - -OS_LIBS += $(GUI_LIBS) - -LD_LIBS += \ - raptorbase \ - raptorhtmlpars \ - raptorhtml \ - png \ - abouturl \ - fileurl \ - ftpurl \ - gophurl \ - httpurl \ - $(XP_PREF_DLL) \ - img$(MOZ_BITS)$(VERSION_NUMBER) \ - jpeg$(MOZ_BITS)$(VERSION_NUMBER) \ - js$(MOZ_BITS)$(VERSION_NUMBER) \ - jsdom \ - mimetype \ - netlib \ - remoturl \ - netcache \ - netcnvts \ - netutil \ - network \ - netlib \ - xpfc10 \ - $(NATIVE_MSG_COMM_LIB) \ - $(NATIVE_SMTP_LIB) \ - $(NATIVE_MIME_LIB) \ - $(NATIVE_RAPTOR_WIDGET) \ - calui10 \ - calparser10 \ - calcapi10 \ - $(NATIVE_RAPTOR_GFX) \ - $(RAPTOR_GFX) \ - $(NATIVE_ZLIB_DLL) \ - $(NATIVE_XP_DLL) \ - $(NATIVE_LIBNLS_LIBS) \ - xpcom$(MOZ_BITS) \ - util10 \ - calcore10 \ - cal_core_ical10 \ - $(XP_REG_LIB) - -ifeq ($(OS_ARCH),Linux) -LD_LIBS += \ - secfree stubnj stubsj util xp pwcac dbm -endif - - -STATIC_LIBS += shell - -EXTRA_LIBS += \ - $(NSPR_LIBS) diff --git a/mozilla/calendar/modules/test/src/js/Makefile b/mozilla/calendar/modules/test/src/js/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/test/src/js/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/test/src/js/manifest.mn b/mozilla/calendar/modules/test/src/js/manifest.mn deleted file mode 100644 index 7282b6f51a6..00000000000 --- a/mozilla/calendar/modules/test/src/js/manifest.mn +++ /dev/null @@ -1,18 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -GDEPTH = ../../../../.. - -MODULE = trex - -REQUIRES = raptor - -libs:: - $(INSTALL) zulutest.js $(DIST)/bin/res/js diff --git a/mozilla/calendar/modules/test/src/js/zulutest.js b/mozilla/calendar/modules/test/src/js/zulutest.js deleted file mode 100644 index c5be92597f0..00000000000 --- a/mozilla/calendar/modules/test/src/js/zulutest.js +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- 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.1 (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. - * - * Contributor(s): - */ - -var colors = new Array(12); -colors[0] = "#FF0000"; -colors[1] = "#00FF00"; -colors[2] = "#0000FF"; -colors[3] = "#FF00FF"; -colors[4] = "#000000"; -colors[5] = "#00FFFF"; -colors[6] = "#FFFFFF"; -colors[7] = "#808000"; -colors[8] = "#B00080"; -colors[9] = "#00B080"; -colors[10] = "#B0B080"; -colors[11] = "#FFBB44"; - -var index = 0; - -function changeColor() -{ - while (index < 11) - { - zulucommand("panel","timebarscale","setbackgroundcolor",colors[index]); - zulucommand("panel","timebarscale","getbackgroundcolor"); - zulucommand("panel","timebarscale","setforegroundcolor",colors[index+1]); - zulucommand("panel","timebarscale","getforegroundcolor"); - zulucommand("panel","timebarscale","setbordercolor",colors[index+2]); - zulucommand("panel","timebarscale","getbordercolor"); - - zulucommand("panel","prevday","setforegroundcolor",colors[index+1]); - zulucommand("panel","prevday","getforegroundcolor"); - zulucommand("panel","nextday","setforegroundcolor",colors[index+1]); - zulucommand("panel","nextday","getforegroundcolor"); - zulucommand("panel","prevhour","setforegroundcolor",colors[index+1]); - zulucommand("panel","prevhour","getforegroundcolor"); - zulucommand("panel","nexthour","setforegroundcolor",colors[index+1]); - zulucommand("panel","nexthour","getforegroundcolor"); - - index++; - if (index >= 10) { - index = 0; - } - } -} - -changeColor(); diff --git a/mozilla/calendar/modules/test/src/manifest.mn b/mozilla/calendar/modules/test/src/manifest.mn deleted file mode 100644 index 260b73089a5..00000000000 --- a/mozilla/calendar/modules/test/src/manifest.mn +++ /dev/null @@ -1,29 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. - -DIRS_LIBS = js - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsTrexTestShell.cpp \ - nsTrexTestShellFactory.cpp \ - $(NULL) - - -REQUIRES = xpcom raptor julian nls netlib pref js xpfc trex - diff --git a/mozilla/calendar/modules/test/src/nsTrexTestShell.cpp b/mozilla/calendar/modules/test/src/nsTrexTestShell.cpp deleted file mode 100644 index a28600b657f..00000000000 --- a/mozilla/calendar/modules/test/src/nsTrexTestShell.cpp +++ /dev/null @@ -1,1147 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "jdefines.h" -#include "nsTrexTestShell.h" -#include "nsxpfcCIID.h" -#include "nsIAppShell.h" -#include "nsTrexTestShellCIID.h" -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsRepository.h" -#include "nsTrexTestShellFactory.h" -#include "nsFont.h" -#include "nsITextWidget.h" -#include "nsITextAreaWidget.h" -#include "nsWidgetsCID.h" -#include "nsIDeviceContext.h" -#include "nsIFontMetrics.h" -#include "nspr.h" -#include "plgetopt.h" -#include "nsIURL.h" -#include "nsIStreamListener.h" -#include "nsIInputStream.h" -#include "nsCRT.h" -#include "jsapi.h" - -#ifdef NS_UNIX -#include "Xm/Xm.h" -#include "Xm/MainW.h" -#include "Xm/Frame.h" -#include "Xm/XmStrDefs.h" -#include "Xm/DrawingA.h" -#endif - -/* - * Enums - */ - -enum Zulu_slots { - ZULU_ZULU = -1, - ZULU_ALIVE = -2 -}; - -/* - * Macros - */ - -#define HEIGHT 30 - -/* - * Local Consts - */ - -static NS_DEFINE_IID(kITextWidgetIID, NS_ITEXTWIDGET_IID); -static NS_DEFINE_IID(kCTextAreaCID, NS_TEXTAREA_CID); -static NS_DEFINE_IID(kCTextFieldCID, NS_TEXTFIELD_CID); -static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); -static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID); - -/* - * External refs - */ - -#ifdef NS_UNIX -extern XtAppContext app_context; -extern Widget topLevel; -#endif - -/* - * Local Globals - */ - -nsITrexTestShell * gShell = nsnull; -nsIID kIXPCOMApplicationShellCID = NS_TREXTEST_SHELL_CID ; -static PRFileDesc *output = nsnull; -static PRFileDesc *fd_stdout = nsnull; - -/* - * Forward Declarations - */ - -nsEventStatus PR_CALLBACK HandleEventTextField(nsGUIEvent *aEvent); -static void PR_CALLBACK TrexTestClientThread(void *arg); -static void PR_CALLBACK JSThread(void *arg); -void PR_CALLBACK ZuluErrorReporter(JSContext *cx, const char *message, JSErrorReport *report); -PR_STATIC_CALLBACK(JSBool) Zulu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); -PR_STATIC_CALLBACK(JSBool) ZuluCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); - - -/* - * Useage - */ - -static nsresult Usage(void) -{ - PR_fprintf(output, "\nzulutest [-q] [-d] [-o] [-v] [-s ]\n"); - PR_fprintf(output, " -d\t\tdebug mode\n"); - PR_fprintf(output, " -q\t\tquiet mode, no interactive UI\n"); - PR_fprintf(output, " -o\t\tredirect output to stdout\n"); - PR_fprintf(output, " -v\t\tverbose output\n"); - PR_fprintf(output, " -s \tlaunch command script \t(implies -c)\n"); - return 1; -} - - -/* - * GetZuluProperty - */ - -PR_STATIC_CALLBACK(JSBool) GetZuluProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) -{ - nsTrexTestShell * a = (nsTrexTestShell*)JS_GetPrivate(cx, obj); - - if (nsnull == a) { - return JS_TRUE; - } - - if (JSVAL_IS_INT(id)) { - switch(JSVAL_TO_INT(id)) { - case ZULU_ZULU: - { - *vp = PRIVATE_TO_JSVAL(a); - break; - } - case ZULU_ALIVE: - { - *vp = BOOLEAN_TO_JSVAL(PR_TRUE); - break; - } - - } - } - - return PR_TRUE; - -} - -/* - * SetZuluProperty - */ - -PR_STATIC_CALLBACK(JSBool) SetZuluProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) -{ - return PR_TRUE; -} - -/* - * FinalizeZulu - */ - -PR_STATIC_CALLBACK(void) FinalizeZulu(JSContext *cx, JSObject *obj) -{ -} - -/* - * EnumerateZulu - */ - -PR_STATIC_CALLBACK(JSBool) EnumerateZulu(JSContext *cx, JSObject *obj) -{ - return JS_TRUE; -} - -/* - * ResolveZulu - */ - -PR_STATIC_CALLBACK(JSBool) ResolveZulu(JSContext *cx, JSObject *obj, jsval id) -{ - return JS_TRUE; -} - -/* - * JS Zulu class prototype - */ - -JSClass ZuluClass = -{ - "Zulu", - JSCLASS_HAS_PRIVATE, - JS_PropertyStub, - JS_PropertyStub, - GetZuluProperty, - SetZuluProperty, - EnumerateZulu, - ResolveZulu, - JS_ConvertStub, - FinalizeZulu -}; - -static JSPropertySpec ZuluProperties[] = -{ - {"zulu", ZULU_ZULU, JSPROP_ENUMERATE}, - {"alive", ZULU_ALIVE, JSPROP_ENUMERATE | JSPROP_READONLY}, - {0} -}; - - -static JSFunctionSpec ZuluMethods[] = -{ - {"zulucommand", ZuluCommand, 1}, - {0} -}; - - -// All Application Must implement this function -nsresult NS_RegisterApplicationShellFactory() -{ - - nsresult res = nsRepository::RegisterFactory(kIXPCOMApplicationShellCID, - new nsTrexTestShellFactory(kIXPCOMApplicationShellCID), - PR_FALSE) ; - - return res; -} - - -/* - * nsTrexTestShell Definition - */ - -nsTrexTestShell::nsTrexTestShell() -{ - NS_INIT_REFCNT(); - mShellInstance = nsnull ; - mInput = nsnull; - mDisplay = nsnull; - - gShell = this; - - mExitMon = nsnull ; - mExitCounter = nsnull; - mDatalen = 0; - mNumThreads = 0; - mClientMon = nsnull; - nsCRT::memset(&mClientAddr, 0 , sizeof(mClientAddr)); - - mCommand = "JUNK"; - - mJSRuntime = nsnull; - mJSContext = nsnull; - mJSGlobal = nsnull; - mJSZuluObject = nsnull; - - Zulu(nsnull,nsnull,0,nsnull,nsnull); - - mScript = ""; - mURL = nsnull; - mListener = nsnull; - mJSData = ""; - - mQuiet = PR_FALSE; - mVerbose = PR_FALSE; - mStdOut = PR_FALSE; - -} - -/* - * nsTrexTestShell dtor - */ - -nsTrexTestShell::~nsTrexTestShell() -{ - - NS_IF_RELEASE(mInput); - NS_IF_RELEASE(mDisplay); - NS_IF_RELEASE(mURL); - NS_IF_RELEASE(mListener); -} - -/* - * nsISupports stuff - */ - -nsresult nsTrexTestShell::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - - if(aIID.Equals(kISupportsIID)) { //do IUnknown... - *aInstancePtr = (nsISupports*)(nsIApplicationShell *)(this); - } - else if(aIID.Equals(kIXPCOMApplicationShellCID)) { //do nsIContentSink base class... - *aInstancePtr = (nsITrexTestShell*)(this); - } - else if(aIID.Equals(kIAppShellIID)) { //do nsIContentSink base class... - *aInstancePtr = (nsIAppShell*)(this); - } - else if(aIID.Equals(kIStreamListenerIID)) { //do nsIContentSink base class... - *aInstancePtr = (nsIStreamListener*)(this); - } - else { - *aInstancePtr=0; - return NS_NOINTERFACE; - } - ((nsISupports*) *aInstancePtr)->AddRef(); - return NS_OK; -} - -NS_IMPL_ADDREF(nsTrexTestShell) -NS_IMPL_RELEASE(nsTrexTestShell) - -/* - * Init - */ - -nsresult nsTrexTestShell::Init() -{ - - /* - * Register class factrories needed for application - */ - - RegisterFactories() ; - - nsresult res = nsApplicationManager::GetShellInstance(this, &mShellInstance) ; - - if (NS_OK != res) - return res ; - - /* - * Parse the command line - */ - - res = ParseCommandLine(); - - if (NS_OK != res) - return res; - - /* - * Load UI if not in quiet mode - */ - - if (PR_FALSE == mQuiet) - LoadUI(); - - /* - * Get the basic networking stuff - */ - - InitNetwork(); - - /* - * Load a Script if it was specified on the command line - */ - - - LoadScript(mScript); - - return res ; -} - - -nsresult nsTrexTestShell::Create(int* argc, char ** argv) -{ - return NS_OK; -} - -nsresult nsTrexTestShell::InitNetwork() -{ - mClientMon = PR_NewMonitor(); - PR_EnterMonitor(mClientMon); - - PRFileDesc * sockfd = nsnull; - PRNetAddr netaddr; - PRInt32 i = 0; - - sockfd = PR_NewTCPSocket(); - - if (sockfd == nsnull) - return NS_OK; - - nsCRT::memset(&netaddr, 0 , sizeof(netaddr)); - - netaddr.inet.family = PR_AF_INET; - netaddr.inet.port = PR_htons(TCP_SERVER_PORT); - netaddr.inet.ip = PR_htonl(PR_INADDR_ANY); - - while (PR_Bind(sockfd, &netaddr) < 0) - { - if (PR_GetError() == PR_ADDRESS_IN_USE_ERROR) - { - netaddr.inet.port += 2; - if (i++ < SERVER_MAX_BIND_COUNT) - continue; - } - PR_Close(sockfd); - return NS_OK; - } - - if (PR_Listen(sockfd, 32) < 0) - { - PR_Close(sockfd); - return NS_OK; - } - - if (PR_GetSockName(sockfd, &netaddr) < 0) - { - PR_Close(sockfd); - return NS_OK; - } - - mClientAddr.inet.family = netaddr.inet.family; - mClientAddr.inet.port = netaddr.inet.port; - mClientAddr.inet.ip = netaddr.inet.ip; - - PR_Close(sockfd); - - PR_ExitMonitor(mClientMon); - - return NS_OK; -} - -nsresult nsTrexTestShell::LoadUI() -{ - nsresult res = NS_OK; - - nsRect aRect(100,100,800, 600) ; - - nsIAppShell * appshell ; - - res = QueryInterface(kIAppShellIID,(void**)&appshell); - - if (NS_OK != res) - return res ; - - mShellInstance->CreateApplicationWindow(appshell,aRect); - - /* - * create the 2 widgets - */ - - static NS_DEFINE_IID(kInsTextAreaWidgetIID, NS_ITEXTAREAWIDGET_IID); - - nsRepository::CreateInstance(kCTextAreaCID, - nsnull, - kInsTextAreaWidgetIID, - (void **)&mDisplay); - aRect.x = 0; - aRect.y = 0; - aRect.height-=HEIGHT; - aRect.width-=10; - - nsIWidget * dw = nsnull; - res = mDisplay->QueryInterface(kIWidgetIID, (void**)&dw); - - dw->Create(mShellInstance->GetApplicationWidget(), - aRect, - HandleEventTextField, - NULL); - - PRUint32 length; - mDisplay->SetText("TrexTest 0.1\r\n",length); - mDisplay->InsertText("-------------------\r\n",0x7fffffff,0x7fffffff,length); - dw->Show(PR_TRUE); - PRBool prev; - mDisplay->SetReadOnly(PR_TRUE,prev); - - - aRect.y = aRect.height - HEIGHT; - aRect.height = HEIGHT; - - nsRepository::CreateInstance(kCTextFieldCID, - nsnull, - kITextWidgetIID, - (void **)&mInput); - - nsIWidget * iw = nsnull; - res = mInput->QueryInterface(kIWidgetIID, (void**)&iw); - - iw->Create(mShellInstance->GetApplicationWidget(), - aRect, - HandleEventTextField, - NULL); - - iw->Show(PR_TRUE); - iw->SetFocus(); - - - nsIWidget * app = mShellInstance->GetApplicationWidget(); - - nsRect rect; - - app->GetBounds(rect); - - rect.x = 0; - rect.y = 0; - - dw->Resize(rect.x,rect.y,rect.width,rect.height-HEIGHT,PR_TRUE); - iw->Resize(rect.x,rect.height-HEIGHT,rect.width,HEIGHT,PR_TRUE); - - NS_RELEASE(dw); - NS_RELEASE(iw); - - mShellInstance->ShowApplicationWindow(PR_TRUE) ; - - return NS_OK; -} - -nsresult nsTrexTestShell::Exit() -{ - return NS_OK; -} - -nsresult nsTrexTestShell::Run() -{ - mShellInstance->Run(); - return NS_OK; -} - -nsresult nsTrexTestShell::SetDispatchListener(nsDispatchListener* aDispatchListener) -{ - return NS_OK; -} - -void* nsTrexTestShell::GetNativeData(PRUint32 aDataType) -{ -#ifdef XP_UNIX - if (aDataType == NS_NATIVE_SHELL) - return topLevel; - - return nsnull; -#else - return (mShellInstance->GetApplicationWidget()); -#endif - -} - -nsresult nsTrexTestShell::RegisterFactories() -{ -#ifdef NS_WIN32 - #define XPFC_DLL "xpfc10.dll" -#else - #define XPFC_DLL "libxpfc10.so" -#endif - - // register graphics classes - static NS_DEFINE_IID(kCXPFCCanvasCID, NS_XPFC_CANVAS_CID); - - nsRepository::RegisterFactory(kCXPFCCanvasCID, XPFC_DLL, PR_FALSE, PR_FALSE); - - static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID); - static NS_DEFINE_IID(kCVectorIteratorCID, NS_ARRAY_ITERATOR_CID); - - nsRepository::RegisterFactory(kCVectorCID, XPFC_DLL, PR_FALSE, PR_FALSE); - nsRepository::RegisterFactory(kCVectorIteratorCID, XPFC_DLL, PR_FALSE, PR_FALSE); - - static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); - nsRepository::RegisterFactory(kCXPFCObserverManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE); - - return NS_OK; -} - -nsresult nsTrexTestShell::GetWebViewerContainer(nsIWebViewerContainer ** aWebViewerContainer) -{ - return NS_OK; -} - -nsresult nsTrexTestShell::LoadScript(nsString& aScript) -{ - /* - * aScript represents a URL to load. Let's use Netlib to grab the - * script and pass the contents off to JS - */ - - if (mScript.Length() == 0) - return NS_OK; - - /* - * Create a URL - */ - - nsresult res = NS_OK; - - if (PR_TRUE == mStdOut) - { - char * c = mScript.ToNewCString(); - PR_fprintf(fd_stdout, "STATUS: Loading JS URL %s\n",c); - delete c; - } - - res = NS_NewURL(&mURL, mScript); - - if (NS_OK == res) - { - res = QueryInterface(kIStreamListenerIID, (void **) &mListener); - - if (NS_OK == res) - mURL->Open(mListener); - } - - return res; -} - -nsresult nsTrexTestShell::SendJS(nsString& aCommand) -{ - nsresult res = NS_OK; - - if (PR_FALSE == mQuiet) - { - nsIWidget * iw = nsnull; - res = mInput->QueryInterface(kIWidgetIID, (void**)&iw); - nsIWidget * dw = nsnull; - res = mDisplay->QueryInterface(kIWidgetIID, (void**)&dw); - - mInput->RemoveText(); - iw->Invalidate(PR_TRUE); - nsString string("COMMAND: "); - PRUint32 length; - mDisplay->InsertText(string,0x7fffffff,0x7fffffff,length); - NS_RELEASE(iw); - NS_RELEASE(dw); - } - - if (PR_TRUE == mStdOut) - PR_fprintf(fd_stdout, "STATUS: Creating JS Thread to Execute Code\n"); - - mCommand.Truncate(0); - aCommand.Copy(mCommand); - - mClientAddr.inet.ip = PR_htonl(PR_INADDR_LOOPBACK); - - /* - * Launch JS on a separate thread so the UI will be responsive - */ - - - PRThread *t; - - t = PR_CreateThread(PR_USER_THREAD, - JSThread, - (void *) this, - PR_PRIORITY_NORMAL, - PR_LOCAL_THREAD, - PR_UNJOINABLE_THREAD, - 0); - -#if 0 - mNumThreads++; - - PR_EnterMonitor(mClientMon); - - while (mNumThreads) { - PR_Wait(mClientMon, PR_INTERVAL_NO_TIMEOUT); - } - - PR_ExitMonitor(mClientMon); -#endif - - return NS_OK; -} - -nsresult nsTrexTestShell::ExecuteJS() -{ - jsval rval; - - // Kick off JS - Later on, we need to look at the DOM - mJSRuntime = JS_Init((uint32) 0xffffffffL); - - if (nsnull != mJSRuntime) - mJSContext = JS_NewContext(mJSRuntime, 8192); - - mJSGlobal = JS_NewObject(mJSContext, &ZuluClass, nsnull, nsnull); - - if (nsnull != mJSGlobal) - { - JS_SetPrivate(mJSContext, mJSGlobal, this); - - JS_DefineProperties(mJSContext, mJSGlobal, ZuluProperties); - JS_DefineFunctions(mJSContext, mJSGlobal, ZuluMethods); - - JS_InitStandardClasses(mJSContext, mJSGlobal); - JS_SetGlobalObject(mJSContext, mJSGlobal); - - // Init our Zulu object here! - //JS_DefineProperties(mJSContext, mJSGlobal, ZuluProperties); - //JS_DefineFunctions(mJSContext, mJSGlobal, ZuluMethods); - - JS_SetErrorReporter(mJSContext, ZuluErrorReporter); - - } - - - JS_EvaluateUCScriptForPrincipals(mJSContext, - JS_GetGlobalObject(mJSContext), - nsnull, - (jschar*)mCommand.GetUnicode(), - mCommand.Length(), - "", - 0, - &rval); - - - if (mJSContext) JS_DestroyContext(mJSContext); - if (mJSRuntime) JS_Finish(mJSRuntime); - - mJSContext = NULL; - mJSRuntime = NULL; - - if (PR_TRUE == mStdOut) - PR_fprintf(fd_stdout, "STATUS: Exiting JS Thread\n"); - - return NS_OK; -} - -nsresult nsTrexTestShell::ReceiveCommand(nsString& aCommand, nsString& aReply) -{ - if (PR_FALSE == mQuiet) - { - PRUint32 length; - mDisplay->InsertText(aReply,0x7fffffff,0x7fffffff,length); - mDisplay->InsertText("\r\n",0x7fffffff,0x7fffffff,length); - - nsIWidget * dw = nsnull; - - mDisplay->QueryInterface(kIWidgetIID,(void**)&dw); - - dw->Invalidate(PR_TRUE); - - NS_RELEASE(dw); - } - - if (PR_TRUE == mStdOut) - { - char * c = aReply.ToNewCString(); - PR_fprintf(fd_stdout, "ReceiveCommand: %s\n",c); - delete c; - } - - return NS_OK; -} - - -nsEventStatus nsTrexTestShell::HandleEvent(nsGUIEvent *aEvent) -{ - - nsIWidget * inputwidget = nsnull; - - if (mInput) - mInput->QueryInterface(kIWidgetIID,(void**)&inputwidget); - - /* - * the Input Widget - */ - - if (aEvent->widget == inputwidget) - { - switch (aEvent->message) - { - case NS_KEY_UP: - - if (NS_VK_RETURN == ((nsKeyEvent*)aEvent)->keyCode) - { - nsString text; - PRUint32 length; - mInput->GetText(text, 1000, length); - - SendJS(text); - - } - break; - } - - NS_IF_RELEASE(inputwidget); - return nsEventStatus_eIgnore; - - } - - /* - * the App and Display Widgets - */ - NS_IF_RELEASE(inputwidget); - - - nsEventStatus result = nsEventStatus_eConsumeNoDefault; - - switch(aEvent->message) { - - case NS_CREATE: - { - return nsEventStatus_eConsumeNoDefault; - } - break ; - - case NS_SIZE: - { - - if (PR_FALSE == mQuiet) - { - nsRect * rect = ((nsSizeEvent*)aEvent)->windowSize; - - rect->x = 0; - rect->y = 0; - - nsIWidget * iw = nsnull; - mInput->QueryInterface(kIWidgetIID, (void**)&iw); - nsIWidget * dw = nsnull; - mDisplay->QueryInterface(kIWidgetIID, (void**)&dw); - - dw->Resize(rect->x,rect->y,rect->width,rect->height-HEIGHT,PR_TRUE); - iw->Resize(rect->x,rect->height-HEIGHT,rect->width,HEIGHT,PR_TRUE); - - NS_RELEASE(iw); - NS_RELEASE(dw); - } - return nsEventStatus_eConsumeNoDefault; - } - break ; - - case NS_DESTROY: - { - mShellInstance->ExitApplication() ; - return nsEventStatus_eConsumeNoDefault; - } - break ; - } - - return nsEventStatus_eIgnore; -} - -nsEventStatus PR_CALLBACK HandleEventTextField(nsGUIEvent *aEvent) -{ - return (gShell->HandleEvent(aEvent)); -} - - - -static void PR_CALLBACK TrexTestClientThread(void *arg) -{ - nsTrexTestShell * app = (nsTrexTestShell *) arg; - - app->RunThread(); - - app->ExitThread(); - -} - -static void PR_CALLBACK JSThread(void *arg) -{ - nsTrexTestShell * app = (nsTrexTestShell *) arg; - - app->ExecuteJS(); - -} - - -nsresult nsTrexTestShell :: RunThread() -{ - PRFileDesc *sockfd; - buffer *in_buf; - union PRNetAddr netaddr; - PRInt32 bytes, bytes2, i, j; - - bytes = TCP_MESG_SIZE; - - in_buf = PR_NEW(buffer); - - if (!in_buf) - return NS_OK; - - - netaddr.inet.family = mClientAddr.inet.family; - netaddr.inet.port = mClientAddr.inet.port; - netaddr.inet.ip = mClientAddr.inet.ip; - - sockfd = PR_NewTCPSocket(); - - if (sockfd == nsnull) - return NS_OK; - - if (PR_Connect(sockfd, &netaddr,PR_INTERVAL_NO_TIMEOUT) < 0) - return NS_OK; - - char * string = mCommand.ToNewCString(); - - bytes2 = PR_Send(sockfd, string, bytes, 0, PR_INTERVAL_NO_TIMEOUT); - - if (bytes2 <= 0) - return NS_OK; - - bytes2 = PR_Recv(sockfd, in_buf->data, bytes, 0, PR_INTERVAL_NO_TIMEOUT); - - if (bytes2 <= 0) - return NS_OK; - - delete string; - - mCommand.SetString(in_buf->data, bytes2); - - PR_Shutdown(sockfd, PR_SHUTDOWN_BOTH); - PR_Close(sockfd); - - PR_DELETE(in_buf); - - return NS_OK; -} - - -nsresult nsTrexTestShell :: ExitThread() -{ - PR_EnterMonitor(mExitMon); - --(*mExitCounter); - PR_Notify(mExitMon); - PR_ExitMonitor(mExitMon); - return NS_OK; -} - - -nsresult nsTrexTestShell::StartCommandServer() -{ - return NS_OK; -} - -class nsICollectedData; -nsresult nsTrexTestShell::ReceiveCallback(nsICollectedData& aReply) -{ - return NS_OK; -} - - -PR_STATIC_CALLBACK(JSBool) Zulu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - return JS_FALSE; -} - - - - -void PR_CALLBACK ZuluErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) -{ - return ; -} - - -PR_STATIC_CALLBACK(JSBool) ZuluCommand(JSContext *cx, - JSObject *obj, - uintN argc, - jsval *argv, - jsval *rval) -{ - /* - * Start the client thread here - */ - - nsTrexTestShell * a = (nsTrexTestShell*) JS_GetPrivate(cx, obj); - - *rval = JSVAL_NULL; - - /* - * XXX: Extract the command & args from JS - */ - - nsString command = ""; - - if (argc >= 1) - { - - PRUint32 count = 0; - - while (count != argc) - { - JSString * jsstring0 = JS_ValueToString(cx, argv[count]); - if (nsnull != jsstring0) - { - - if (count != 0) - command += " "; - - command += JS_GetStringChars(jsstring0); - } - - *rval = JSVAL_VOID; - - count++; - } - } - else - { - JS_ReportError(cx, "Function zulucommand requires 1 parameter"); - return JS_FALSE; - } - - a->SendCommand(command); - - - return JS_TRUE; -} - -nsresult nsTrexTestShell::SendCommand(nsString& aCommand) -{ - /* - * We no longer launch a separate thread for dealing - * with Zulu Specific commands. The reason is simply that - * future commands may depend upon return paramaters on - * this command. Since the JS thread is what calls this - * API, the JS code being executed will wait until return - * of the calling function. - */ - - PRThread *t; - - mExitMon = mClientMon; - - mExitCounter = &(mNumThreads); - - mCommand = aCommand; - - if (PR_TRUE == mStdOut) - { - char * c = mCommand.ToNewCString(); - PR_fprintf(fd_stdout, "SendCommand: %s\n",c); - delete c; - } - - RunThread(); - -#if 0 - t = PR_CreateThread(PR_USER_THREAD, - TrexTestClientThread, - (void *) this, - PR_PRIORITY_NORMAL, - PR_LOCAL_THREAD, - PR_UNJOINABLE_THREAD, - 0); - - mNumThreads++; -#endif - - /* - * XXX: we've actually gotten the response back from SendCommand - */ - - ReceiveCommand(mCommand,mCommand); - - return NS_OK; -} - - - - - -nsresult nsTrexTestShell::ParseCommandLine() -{ - PLOptStatus os; - PLOptState *opt; - - output = PR_GetSpecialFD(PR_StandardError); - - mShellInstance->GetCommandLineOptions(&opt,"hoqvdl:s:"); - - while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) - { - if (PL_OPT_BAD == os) - continue; - - switch (opt->option) - { - case 'd': - break; - - case 'q': - mQuiet = PR_TRUE; - break; - - case 'o': - mStdOut = PR_TRUE; - fd_stdout = PR_GetSpecialFD(PR_StandardOutput); - break; - - case 'v': - mVerbose = PR_TRUE; - break; - - case 's': - { - mScript = opt->value; - } - break; - - case 'h': /* confused */ - default: - return Usage(); - } - } - return NS_OK; -} - - -nsresult nsTrexTestShell::GetBindInfo(nsIURL* aURL) -{ - return NS_OK; -} -nsresult nsTrexTestShell::OnDataAvailable(nsIURL* aURL, nsIInputStream *aIStream, PRInt32 aLength) -{ - PRInt32 count; - char * buffer = (char *)PR_Malloc(sizeof(char) * (aLength+1)); - - aIStream->Read(buffer, 0, aLength, &count); - - buffer[aLength] = '\0'; - - mJSData += buffer; - - PR_Free(buffer); - - return NS_OK; -} -nsresult nsTrexTestShell::OnStartBinding(nsIURL* aURL, const char *aContentType) -{ - mJSData = ""; - return NS_OK; -} -nsresult nsTrexTestShell::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax) -{ - return NS_OK; -} -nsresult nsTrexTestShell::OnStatus(nsIURL* aURL, const nsString &aMsg) -{ - return NS_OK; -} -nsresult nsTrexTestShell::OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString &aMsg) -{ - SendJS(mJSData); - return NS_OK; -} diff --git a/mozilla/calendar/modules/test/src/nsTrexTestShellFactory.cpp b/mozilla/calendar/modules/test/src/nsTrexTestShellFactory.cpp deleted file mode 100644 index e10673ab2be..00000000000 --- a/mozilla/calendar/modules/test/src/nsTrexTestShellFactory.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsIFactory.h" -#include "nsISupports.h" -#include "nsTrexTestShellCIID.h" - -#include "nsTrexTestShell.h" -#include "nsTrexTestShellFactory.h" - -static NS_DEFINE_IID(kCTrexTestShell, NS_TREXTEST_SHELL_CID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); - -nsTrexTestShellFactory::nsTrexTestShellFactory(const nsCID &aClass) -{ - mRefCnt = 0; - mClassID = aClass; -} - -nsTrexTestShellFactory::~nsTrexTestShellFactory() -{ - NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); -} - -nsresult nsTrexTestShellFactory::QueryInterface(const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - // Always NULL result, in case of failure - *aResult = NULL; - - 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; -} - -nsrefcnt nsTrexTestShellFactory::AddRef() -{ - return ++mRefCnt; -} - -nsrefcnt nsTrexTestShellFactory::Release() -{ - if (--mRefCnt == 0) { - delete this; - return 0; // Don't access mRefCnt after deleting! - } - return mRefCnt; -} - -nsresult nsTrexTestShellFactory::CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - *aResult = NULL; - - nsISupports *inst = nsnull; - - if (aIID.Equals(kCTrexTestShell)) { - inst = (nsISupports *)(nsIApplicationShell *)new nsTrexTestShell(); - } - - if (inst == NULL) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult res = inst->QueryInterface(aIID, aResult); - - if (res != NS_OK) { - // We didn't get the right interface, so clean up - delete inst; - } - - return res; -} - -nsresult nsTrexTestShellFactory::LockFactory(PRBool aLock) -{ - // Not implemented in simplest case. - return NS_OK; -} - diff --git a/mozilla/calendar/modules/test/tools/addnpl.pl b/mozilla/calendar/modules/test/tools/addnpl.pl deleted file mode 100644 index fd4d4dc1993..00000000000 --- a/mozilla/calendar/modules/test/tools/addnpl.pl +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/sbin/perl -# -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (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.org 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. -# -# Contributor(s): -# -# addnpl.pl -# -# This script adds the NPL header comment to every source file in the -# command line argument that ends in .c, .cpp, .h, .rc, .def, -# .script, .s, .mak, and .bat. -# If no extension, then adds Makefile like comments. -# NOTE: Don't use this script on perl script files since it won't correct for -# the first line path to perl executable. -# -# For example: -# > perl addnpl.pl test1.c test2.cpp test3.mak -# -# would add the C-style NPL License comment to test1.c and test2.cpp. and -# the makefile-style NPL License comment to test3.mak - -if (0 > $#ARGV) -{ - print STDERR "You need to supply a list of test files on the cmd line\n"; - die; -} - -sub licenseHeader -{ - $cFile = 0; - $startToken = "#"; - local($fileExtension) = @_; - if ($fileExtension =~ /(h|c|cpp|rc)/) { - $startToken = " *"; - $cFile = 1; - } - elsif ($fileExtension =~ /(mak|s|script)/) { - $startToken = "#"; - } - elsif ($fileExtension =~ /def/) { - $startToken = ";"; - } - elsif ($fileExtension =~ /bat/) { - $startToken = "rem"; - $cFile = 2; - } - else { - $startToken = "#"; - } - if ($cFile == 1) { - print OUT "/* -\*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset:2 -\*- \n"; - print OUT "$startToken \n"; - } - elsif ($cFile == 2) { - print OUT "@echo off \n"; - } - print OUT "$startToken The contents of this file are subject to the Netscape Public License \n"; - print OUT "$startToken Version 1.0 (the \"NPL\"); you may not use this file except in \n"; - print OUT "$startToken compliance with the NPL. You may obtain a copy of the NPL at \n"; - print OUT "$startToken http://www.mozilla.org/NPL/ \n"; - print OUT "$startToken \n"; - print OUT "$startToken Software distributed under the NPL is distributed on an \"AS IS\" basis, \n"; - print OUT "$startToken WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL \n"; - print OUT "$startToken for the specific language governing rights and limitations under the \n"; - print OUT "$startToken NPL. \n"; - print OUT "$startToken \n"; - print OUT "$startToken The Initial Developer of this code under the NPL is Netscape \n"; - print OUT "$startToken Communications Corporation. Portions created by Netscape are \n"; - print OUT "$startToken Copyright (C) 1998 Netscape Communications Corporation. All Rights \n"; - print OUT "$startToken Reserved. \n"; - if ($cFile == 1) - { - print OUT " */ \n"; - } - elsif ($cFile == 2) - { - print OUT "@echo on \n"; - } - print OUT "\n"; -} - -foreach $i (0..$#ARGV) -{ - $j = 0; - $size = 0; - - $filename = $ARGV[$i]; - if (!open(NPLFILE, "+<$filename")) - { - print STDERR "Can't open $filename \n"; - print STDERR "error: $!\n"; - die; - } - - $extension = substr($filename, 1+index($filename, ".")); - print STDERR "Adding NPL license header to $filename\n"; - - while ($line = ) - { - $buffer[$j++] = $line; - $size++; - } - - close NPLFILE; - - open(OUT, "+>$filename"); - - &licenseHeader($extension); - $j = 0; - while ($j < $size) - { - print OUT $buffer[$j]; - $j++; - } - close OUT; - -} - - - - - - - - - - diff --git a/mozilla/calendar/modules/test/tools/busytime.cgi b/mozilla/calendar/modules/test/tools/busytime.cgi deleted file mode 100755 index 33531f9c105..00000000000 --- a/mozilla/calendar/modules/test/tools/busytime.cgi +++ /dev/null @@ -1,184 +0,0 @@ -#! /tools/ns/bin/perl5.004 - -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (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.org 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. -# -# Contributor(s): - - -use Socket; - -$mailhost = 'localhost'; - -&process_args; - -print "Content-Type: text/html\n\n"; -print "\n"; - -# -# Build an indexed array. The index is the property name, -# the value is the property value. -# -@parms = split('&',$ENV{'QUERY_STRING'}); -printf("

\n"); -foreach $val (@parms) -{ - #printf("%s
\n", $val); - #printf("p = %s, v = %s
\n", $p, $v); - ($p, $v) = split('=',$val); - $v =~ s/(%40)/@/g; - $v =~ s/\+/ /g; - $v =~ s/%0D/\r/g; - $v =~ s/%0A/\n /g; - $vals{$p} = $v; -} - -printf("Busy time request sent:

\n"); -printf("Organizer: %s\n
\n", $vals{'organizer'} ); -printf("message sent to: %s\n
\n", $vals{'who'} ); -printf("start time: %s\n
\n", $vals{'DTSTART'} ); -printf("end time: %s\n
\n", $vals{'DTEND'} ); - -@mailto = split(' ',$vals{'who'}); -printf("sending the mail message now.\n"); - -print "\n"; - -if ($flag_debug ) -{ - print STDERR "----------------------------------------------\n"; - print STDERR "LOGINFO:\n"; - print STDERR " mailto: \@mailto\n"; - print STDERR "----------------------------------------------\n"; -} - - -&mail_the_message; -0; - -sub process_args -{ - while (@ARGV) { - $arg = shift @ARGV; - - if ($arg eq '-d') - { - $flag_debug = 1; - print STDERR "Debug turned on...\n"; - } - elsif ($arg eq '-h') - { - $mailhost = shift @ARGV; - } - else - { - push(@mailto, $arg); - } - } -} - - -sub get_response_code { - my ($expecting) = @_; -# if ($flag_debug) { -# print STDERR "SMTP: Waiting for code $expecting\n"; -# } - while (1) { - my $line = ; -# if ($flag_debug) { -# print STDERR "SMTP: $line"; -# } - if ($line =~ /^[0-9]*-/) { - next; - } - if ($line =~ /(^[0-9]*) /) { - my $code = $1; - if ($code == $expecting) { -# if ($flag_debug) { -# print STDERR "SMTP: got it.\n"; -# } - return; - } - die "Bad response from SMTP -- $line"; - } - } -} - - -sub mail_the_message { - chop(my $hostname = `hostname`); - - my ($remote,$port, $iaddr, $paddr, $proto, $line); - - $remote = $mailhost; - $port = 25; - if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') } - die "No port" unless $port; - $iaddr = inet_aton($remote) || die "no host: $remote"; - $paddr = sockaddr_in($port, $iaddr); - - $proto = getprotobyname('tcp'); - socket(S, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; - connect(S, $paddr) || die "connect: $!"; - select(S); $| = 1; select(STDOUT); - - get_response_code(220); - print S "HELO $hostname\n"; - get_response_code(250); - printf( S "MAIL FROM: %s\n", $vals{'organizer'} ); - get_response_code(250); - foreach $i (@mailto) { - print S "RCPT TO: $i\n"; - get_response_code(250); - } - print S "DATA\n"; - get_response_code(354); - - printf(S "Date: %s", `date`); - printf(S "From: %s\n", $vals{'organizer'}); - printf(S "Return-Path: <%s>\n", $vals{'organizer'} ); - printf(S "To: %s\n",$vals{'who'} ); - printf(S "Subject:Calendar Busy Time Request\n"); - printf(S "Mime-Version: 1.0\n"); - printf(S "Content-Type:text/calendar; method=REQUEST; charset=US-ASCII\n"); - printf(S "Content-Transfer-Encoding: 7bit\n"); - printf(S "\n"); - printf(S "BEGIN:VCALENDAR\n"); - printf(S "PRODID:-//seasnake/DesktopCalendar//EN\n"); - printf(S "METHOD:REQUEST\n"); - printf(S "VERSION:2.0\n"); - printf(S "BEGIN:VFREEBUSY\n"); - printf(S "ORGANIZER:Mailto:%s\n",$vals{'organizer'}); - printf(S "ATTENDEE:Mailto:%s\n",$vals{'who'}); - $ENV{'TZ'} = "GMT0"; - printf(S "DTSTAMP:%s",`date +19%y%m%dT%H%M%SZ`); - $ENV{'TZ'} = "PST8PDT"; - printf(S "DTSTART:%s\n",$vals{'DTSTART'}); - printf(S "DTEND:%s\n",$vals{'DTEND'}); - chop($h = `hostname`); - chop($dm = `domainname`); - chop($d = `date +%y%m%d%H%M%S`); - printf(S "UID:%s.%s-%s.%s\n",$h, $dm, $d, "$$" ); - printf(S "END:VFREEBUSY\n"); - printf(S "END:VCALENDAR\n"); - - print S ".\n"; - get_response_code(250); - print S "QUIT\n"; - - close(S); -} diff --git a/mozilla/calendar/modules/test/tools/fbreq.html b/mozilla/calendar/modules/test/tools/fbreq.html deleted file mode 100644 index 68e9f428828..00000000000 --- a/mozilla/calendar/modules/test/tools/fbreq.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - -

-Request Busy Time

- -It ain't pretty, but it works. - -
- - - - - - - - - - - - - - - - - - - - - -
-Organizer: - - -example: jsun@netscape.com -(typically your e-mail address) -
-Send request to: - - -
space delimited addresses, example: -sman@netscape.com eyork@netscape.com spider@netscape.com -
-Start time: - - -example: 19980522T070000Z -
-End time: - - -example: 19980523T070000Z -
- - -
- - - -
- - diff --git a/mozilla/calendar/modules/test/tools/freeBusyTestFolder.txt b/mozilla/calendar/modules/test/tools/freeBusyTestFolder.txt deleted file mode 100644 index 4b53ec5fe28..00000000000 --- a/mozilla/calendar/modules/test/tools/freeBusyTestFolder.txt +++ /dev/null @@ -1,269 +0,0 @@ ->From - Feb 07 00:00:00 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:PUBLISH -BEGIN:VFREEBUSY -DTSTAMP:19980610T183539Z -DTSTART:19980616T000000Z -FREEBUSY:19980616T000000Z/PT18H20M,19980707T172500Z/PT7H33M,19980712T135000Z/PT7H16M,19980803T094800Z/PT23H18M,19980901T020600Z/PT13H58M,19980918T094500Z/PT19H2M,19981015T081600Z/PT14H57M -DTEND:19981114T015100Z -REQUEST-STATUS: -ORGANIZER:mailto:user72@example.com -UID:seasnake.mcom.com9806101135392507258554 -END:VEVENT -END:VCALENDAR - ->From - Feb 07 00:00:01 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:PUBLISH -BEGIN:VFREEBUSY -COMMENT:You are a weasel -DTSTAMP:19980610T183628Z -DTSTART:19980525T000000Z -FREEBUSY:19980525T000000Z/PT9H14M,19980623T093800Z/PT7H33M,19980724T135600Z/PT0H30M,19980728T174900Z/PT22H10M -DTEND:19980824T173200Z -ORGANIZER;CN="Eric Smith";DIR="ldap://host.example.com:6666/o=eDABC%20Industries,c=3DUS??(cn=3DBJim%20Dolittle)":mailto:user92@example.com -UID:seasnake.mcom.com9806101136282512692532 -URL:http://cal.example.com/pub/calendar/jsmith/Simpson/freetime.ics -END:VEVENT -END:VCALENDAR - ->From - Feb 07 00:00:02 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:PUBLISH -BEGIN:VFREEBUSY -CONTACT:Jim Dolittle\, ABC Industries\, +1-919-555-1234 -DTSTAMP:19980610T183545Z -DTSTART:19981116T000000Z -FREEBUSY:19981116T000000Z/PT22H51M,19991204T235000Z/PT18H40M,20001219T123800Z/PT21H36M,20011223T164500Z/PT21H45M,20021323T101600Z/PT11H55M -DTEND:20031328T135800Z -ORGANIZER:mailto:user28@example.com -UID:seasnake.mcom.com9806101135452507863870 -END:VEVENT -END:VCALENDAR - ->From - Feb 07 00:00:03 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:REPLY -BEGIN:VFREEBUSY -ATTENDEE;CUTYPE=ROOM;DELEGATED-TO="mailto:user15@example.com";ROLE=REQ-PARTICIPANT;PARTSTAT=DECLINED;RSVP=TRUE;SENT-BY="mailto:user7@example.com":mailto:user0@example.com -DTSTAMP:19980610T183548Z -DTSTART:19981124T000000Z -FREEBUSY:19981124T000000Z/PT19H55M,19991209T162300Z/PT15H40M,20001307T143600Z/PT0H47M,20011320T022900Z/PT9H20M -DTEND:20021409T004800Z -ORGANIZER:mailto:user62@example.com -UID:seasnake.mcom.com9806101135492508468389 -END:VEVENT -END:VCALENDAR - ->From - Feb 07 00:00:04 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:REPLY -BEGIN:VFREEBUSY -ATTENDEE;CUTYPE=RESOURCE;DELEGATED-FROM="mailto:user19@example.com";ROLE=OPT-PARTICIPANT;PARTSTAT=DECLINED;RSVP=TRUE:mailto:user0@example.com -DTSTAMP:19980610T183553Z -DTSTART:19981026T000000Z -FREEBUSY:19981026T000000Z/PT5H6M,19981111T183200Z/PT17H50M,19981113T120400Z/PT12H41M,19981116T084500Z/PT9H5M,19981122T190000Z/PT6H5M,19981125T012200Z/PT3H34M,19991210T221800Z/PT21H28M,20001227T042500Z/PT1H44M,20011324T031300Z/PT20H12M -DTEND:20021403T224800Z -ORGANIZER;CN="Scott DuBois":mailto:user0@example.com -UID:seasnake.mcom.com9806101135532509072491 -URL:http://cal.example.com/pub/calendar/jsmith/Wells/freetime.ics -END:VEVENT -END:VCALENDAR - ->From - Feb 07 00:00:05 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:PUBLISH -BEGIN:VFREEBUSY -DTSTAMP:19980610T183601Z -DTSTART:19980812T000000Z -FREEBUSY:19980812T000000Z/PT9H57M,19980902T090800Z/PT22H55M,19980922T000400Z/PT11H0M,19981007T171000Z/PT10H11M,19981024T034600Z/PT4H45M -DTEND:19981108T090000Z -ORGANIZER;DIR="ldap://host.example.com:6666/o=eDABC%20Industries,c=3DUS??(cn=3DBJim%20Dolittle)":mailto:user53@example.com -UID:seasnake.mcom.com9806101136012509616540 -END:VEVENT -END:VCALENDAR - ->From - Feb 07 00:00:06 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:PUBLISH -BEGIN:VFREEBUSY -DTSTAMP:19980610T183608Z -DTSTART:19980423T000000Z -FREEBUSY:19980423T000000Z/PT12H43M,19980517T081500Z/PT13H2M,19980617T220400Z/PT5H4M,19980712T102500Z/PT23H45M -DTEND:19980726T031900Z -ORGANIZER:mailto:user62@example.com -UID:seasnake.mcom.com9806101136082510218719 -END:VEVENT -END:VCALENDAR - ->From - Feb 07 00:00:07 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:PUBLISH -BEGIN:VFREEBUSY -DTSTAMP:19980610T183612Z -DTSTART:19980601T000000Z -FREEBUSY:19980601T000000Z/PT2H57M,19980617T051500Z/PT17H32M,19980715T140500Z/PT13H35M,19980717T084800Z/PT21H1M,19980722T000300Z/PT18H6M -DTEND:19980806T122500Z -ORGANIZER:mailto:user15@example.com -UID:seasnake.mcom.com9806101136122510878167 -END:VEVENT -END:VCALENDAR - ->From - Feb 07 00:00:08 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:REPLY -BEGIN:VFREEBUSY -ATTENDEE;CUTYPE=UNKNOWN;DELEGATED-FROM="mailto:user24@example.com";ROLE=NON-PARTICIPANT;PARTSTAT=DECLINED;RSVP=TRUE:mailto:user0@example.com -DTSTAMP:19980610T183619Z -DTSTART:19980910T000000Z -FREEBUSY:19980910T000000Z/PT23H21M,19981004T130800Z/PT1H21M,19981009T105900Z/PT18H17M,19981019T183500Z/PT21H10M,19981120T053200Z/PT6H8M,19991207T231600Z/PT18H57M,20001305T222500Z/PT22H22M,20011314T180600Z/PT7H28M,20021405T224800Z/PT22H30M,20031409T113900Z/PT23H14M -DTEND:20041510T015600Z -ORGANIZER:mailto:user7@example.com -UID:seasnake.mcom.com9806101136192511487454 -END:VEVENT -END:VCALENDAR - ->From - Feb 07 00:00:09 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: test7.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:REPLY -BEGIN:VFREEBUSY -ATTENDEE;CUTYPE=RESOURCE;DELEGATED-FROM="mailto:user22@example.com";ROLE=REQ-PARTICIPANT;PARTSTAT=DECLINED;RSVP=TRUE:mailto:user0@example.com -DTSTAMP:19980610T183623Z -DTSTART:19980920T000000Z -FREEBUSY:19980920T000000Z/PT17H38M,19981014T135800Z/PT18H10M,19981028T150400Z/PT22H28M,19981119T232600Z/PT3H14M,19981121T154000Z/PT2H2M,19991203T050800Z/PT17H4M,20001219T182600Z/PT11H40M,20011319T153300Z/PT19H31M,20021326T232600Z/PT6H2M,20031418T065900Z/PT20H49M -DTEND:20041504T025800Z -ORGANIZER:mailto:user22@example.com -UID:seasnake.mcom.com9806101136232512032067 -END:VEVENT -END:VCALENDAR - diff --git a/mozilla/calendar/modules/test/tools/itip b/mozilla/calendar/modules/test/tools/itip deleted file mode 100644 index fe0764523e6..00000000000 --- a/mozilla/calendar/modules/test/tools/itip +++ /dev/null @@ -1,1695 +0,0 @@ -From - Sat Feb 7 14:00:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: Ball Game Schedule -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:PUBLISH -PRODID:-//ACME/DesktopCalendar//EN -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTART:19970701T200000Z -DTSTAMP:19970611T190000Z -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID:0981234-1234234-23@example.com -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:01:15 1998 -Sender: sman@netscape.com (Steve Mansour) -From: Steve Mansour -Return-Path: -To: terry@netscape.com -Subject: Phone Conference -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:mailto:sman@netscape.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:mailto:sman@netscape.com -ATTENDEE;RSVP=TRUE:MAILTO:stevesil@microsoft.com -DTSTAMP:19970611T190000Z -DTSTART:19970701T210000Z -DTEND:19970701T230000Z -SUMMARY:Phone Conference -DESCRIPTION:Please review the attached document. -UID:www.acme.com-873970198738777 -ATTACH:ftp://ftp.bar.com/pub/docs/foo.doc -SEQUENCE:0 -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:02:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: Ball Game Schedule (update) -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:PUBLISH -VERSION:2.0 -PRODID:-//ACME/DesktopCalendar//EN -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTAMP:19970612T190000Z -DTSTART:19970701T210000Z -DTEND:19970701T230000Z -SEQUENCE:1 -UID:0981234-1234234-23@example.com -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:03:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: Ball Game Schedule (big update) -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:PUBLISH -CALSCALE:GREGORIAN -SOURCE:http://www.midwaystadium.com/stadium-cal/1997-events.or4 -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:America-Chicago -TZURL:http://zones.stds_r_us.net/tz/America-Chicago -LAST-MODIFIED:19870101T000000Z -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0600 -TZNAME:CST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 -TZOFFSETFROM:-0600 -TZOFFSETTO:-0500 -TZNAME:CDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -ATTACH:http://www.midwaystadium.com -CATEGORIES:SPORTS EVENT,ENTERTAINMENT -CLASS:PRIVATE -CREATED:19970415T194319Z -DESCRIPTION:MIDWAY STADIUM\n - Big time game. MUST see.\n - Expected duration:2 hours\n -DTEND;TZID=America-Chicago:19970702T180000 -DTSTART;TZID=America-Chicago:19970702T160000 -DTSTAMP:19970614T190000Z -STATUS:CONFIRMED -LAST-MODIFIED:19970416T162421Z -LOCATION;VALUE=URL:http://www.midwaystadium.com/ -PRIORITY:2 -RESOURCES:SCOREBOARD -SEQUENCE:2 -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID:0981234-1234234-23@example.com -RELATED-TO:0981234-1234234-14@example.com -BEGIN:VALARM -TRIGGER:PT2H -ALARM-TYPE:DISPLAY -DESCRIPTION:It's almost game time -END:VALARM -BEGIN:VALARM -TRIGGER:PT30M -ALARM-TYPE:AUDIO -DESCRIPTION:You SHOULD leave now. Game starts in 30 minutes! -END:VALARM -END:VEVENT -END:VCALENDAR - - -From - Sat Feb 7 14:04:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: Ball Game Schedule (big update) -Mime-Version: 1.0 -Content-Type:text/calendar; method=CANCEL; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:CANCEL -VERSION:2.0 -PRODID:-//ACME/DesktopCalendar//EN -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -COMMENT:DUKES forfeit the game -SEQUENCE:3 -UID:0981234-1234234-23@example.com -DTSTAMP:19970613T190000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:05:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: Bastille Day -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:PUBLISH -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:a@example.com -DTSTAMP:19970614T190000Z -UID:0981234-1234234-23@example.com -DTSTART;VALUE=DATE:19970714 -RRULE:FREQ=YEARLY;INTERVAL=1 -SUMMARY: Bastille Day -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:06:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: (request) Group Phone Conference -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:C@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com -ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com -ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com -DTSTAMP:19970611T190000Z -DTSTART:19970701T200000Z -DTEND:19970701T203000Z -SUMMARY:Group Phone Conference -UID:www.acme.com-873970198738777@example.com -SEQUENCE:0 -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:07:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: (Reply) Group Phone Conference -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ATTENDEE;PARTSTAT=ACCEPTED:Mailto:B@example.com -ORGANIZER:MAILTO:A@example.com -UID:www.acme.com-873970198738777@example.com -SEQUENCE:0 -REQUEST-STATUS:2.0;Success -DTSTAMP:19970612T190000Z -END:VEVENT -END:VCALENDAR - - -From - Sat Feb 7 14:08:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request: update) Group Phone Conference -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:D@example.com -ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:Mailto:Conf@example.com -ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com -DTSTART:19970701T180000Z -DTEND:19970701T1200000Z -SUMMARY:Phone Conference -UID:www.acme.com-873970198738777@example.com -SEQUENCE:1 -DTSTAMP:19970613T190000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:09:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Discuss the Merits of the election results -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -DTSTART:19970701T190000Z -DTEND:19970701T200000Z -SUMMARY:Discuss the Merits of the election results -LOCATION:The Big Conference Room -UID:www.acme.com-873970198738777@example.com -SEQUENCE:0 -DTSTAMP:19970611T190000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:10:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(counter) Discuss the Merits of the election results -Mime-Version: 1.0 -Content-Type:text/calendar; method=COUNTER; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:COUNTER -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -DTSTART:19970701T160000Z -DTEND:19970701T190000Z -DTSTAMP:19970612T190000Z -SUMMARY:(counter) Discuss the Merits of the election results -LOCATION:The Small Conference Room -COMMENT:This time works much better and I think the big conference - room is too big -UID:www.acme.com-873970198738777@example.com -SEQUENCE:0 -DTSTAMP:19970611T190000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:11:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(declinecounter) Discuss the Merits of the election results -Mime-Version: 1.0 -Content-Type:text/calendar; method=DECLINECOUNTER; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:DECLINECOUNTER -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -COMMENT:Sorry, I cannot change this meeting time -UID:www.acme.com-873970198738777@example.com -SEQUENCE:1 -DTSTAMP:19970614T190000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:12:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(reply:delegate) Delegate presence --> message to Organizer -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:MAILTO:A@Example.com -ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="Mailto:E@example.com":Mailto:C@example.com -UID:www.acme.com-873970198738777@example.com -SEQUENCE:0 -REQUEST-STATUS:2.0;Success -DTSTAMP:19970611T190000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:13:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request:to-delegate) Delegate presence --> message to delegate -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="Mailto:E@example.com":Mailto:C@example.com -ATTENDEE;ROLE=DELEGATE;RSVP=TRUE;DELEGATED-FROM="Mailto:C@example.com":Mailto:E@example.com -DTSTART:19970701T180000Z -DTEND:19970701T200000Z -SUMMARY:Phone Conference -UID:www.acme.com-873970198738777@example.com -SEQUENCE:0 -STATUS:CONFIRMED -DTSTAMP:19970611T190000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:14:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(reply) Delegate accepts -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:MAILTO:A@Example.com -ATTENDEE;PARTSTAT=ACCEPTED;DELEGATED-FROM="Mailto:C@example.com":Mailto:E@example.com -ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="Mailto:E@example.com":Mailto:C@example.com -UID:www.acme.com-873970198738777@example.com -SEQUENCE:1 -REQUEST-STATUS:2.0;Success -DTSTAMP:19970614T190000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:15:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(reply) Delegate declines -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:MAILTO:A@Example.com -ATTENDEE;PARTSTAT=DECLINED;DELEGATED-FROM="Mailto:C@example.com":Mailto:E@example.com -UID:www.acme.com-873970198738777@example.com -ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="Mailto:E@example.com":Mailto:C@example.com -SEQUENCE:1 -REQUEST-STATUS:2.0;Success -DTSTAMP:19970614T190000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:16:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Organizer re-invites original attendee -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:MAILTO:A@Example.com -ATTENDEE;PARTSTAT=DECLINED;DELEGATED-FROM="Mailto:C@example.com":Mailto:E@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -UID:www.acme.com-873970198738777@example.com -SEQUENCE:2 -REQUEST-STATUS:2.0;Success -DTSTART:19970615T112233Z -DTSTAMP:19970614T200000Z -COMMENT:DELEGATE (ATTENDEE Mailto:E@example.com) DECLINED YOUR INVITATION -SUMMARY:DELEGATE (ATTENDEE Mailto:E@example.com) DECLINED YOUR INVITATION -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:17:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(cancel) Organizer cancels an event -Mime-Version: 1.0 -Content-Type:text/calendar; method=CANCEL; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:CANCEL -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:A@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:D@example.com -COMMENT:Mr. B cannot attend. It's raining. Lets cancel. -UID:www.acme.com-873970198738777@example.com -SEQUENCE:1 -STATUS:CANCELLED -DTSTAMP:19970613T190000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:18:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(cancel) Organizer removes an attendee -Mime-Version: 1.0 -Content-Type:text/calendar; method=CANCEL; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:CANCEL -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE:mailto:B@example.com -COMMENT:You're off the hook for this meeting -UID:www.acme.com-873970198738777@example.com -DTSTAMP:19970613T193000Z -SEQUENCE:1 -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:19:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(publish) Published freebusy info -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//ENVERSION:2.0 -METHOD:PUBLISH -BEGIN:VFREEBUSY -DTSTAMP:19980101T124100Z -ORGANIZER:MAILTO:A@Example.com -ATTENDEE:MAILTO:A@Example.com -DTSTART:19980101T124200Z -DTEND:19980107T124200Z -FREEBUSY:19980101T180000Z/19980101T190000Z -FREEBUSY:19980103T020000Z/19980103T050000Z -FREEBUSY:19980107T020000Z/19980107T050000Z -FREEBUSY:19980113T000000Z/19980113T010000Z -FREEBUSY:19980115T190000Z/19980115T200000Z -FREEBUSY:19980115T220000Z/19980115T230000Z -FREEBUSY:19980116T013000Z/19980116T043000Z -END:VFREEBUSY -END:VCALENDAR - -From - Sat Feb 7 14:20:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Request free-busy time -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VFREEBUSY -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -DTSTAMP:19970613T190000Z -DTSTART:19970701T080000Z -DTEND:19970701T200000 -UID:www.acme.com-873970198738777@example.com -END:VFREEBUSY -END:VCALENDAR - -From - Sat Feb 7 14:21:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(reply) free-busy time reply -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VFREEBUSY -ORGANIZER:MAILTO:A@example.com -ATTENDEE:Mailto:B@example.com -DTSTART:19970701T080000Z -DTEND:19970701T200000Z -UID:www.acme.com-873970198738777@example.com -FREEBUSY:19970701T090000Z/PT1H,19970701T140000Z/PT30H -DTSTAMP:19970613T190030Z -END:VFREEBUSY -END:VCALENDAR - -From - Sat Feb 7 14:22:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Recurring event with TZ, RRULE, RDATE, & EXDATE -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:America-SanJose -TZURL:http://zones.stds_r_us.net/tz/America-SanJose -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0700 -TZOFFSETTO:-0800 -TZNAME:PST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 -TZOFFSETFROM:-0800 -TZOFFSETTO:-0700 -TZNAME:PDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CUTYPE=INDIVIDUAL:Mailto:A@example.COM -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.fr -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:c@example.jp -DTSTAMP:19970613T190030Z -DTSTART;TZID=America-SanJose:19970701T140000 -DTEND;TZID=America-SanJose:19970701T150000 -RRULE:FREQ=WEEKLY;INTERVAL=20;WKST=SU;BYDAY=TU -RDATE;TZID=America-SanJose:19970910T140000 -EXDATE;TZID=America-SanJose:19970909T140000 -EXDATE;TZID=America-SanJose:19971028T140000 -SUMMARY:Weekly Phone Conference -UID:www.acme.com-873970198738777@example.com -SEQUENCE:0 -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:23:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Base Recurring -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -SEQUENCE:0 -RRULE:FREQ=MONTHLY;BYMONTHDAY=1;UNTIL=19980901T210000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970601T210000Z -DTEND:19970601T220000Z -LOCATION:Conference Call -DTSTAMP:19970526T083000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:24:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Base Recurring -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -SEQUENCE:0 -RRULE:FREQ=MONTHLY;BYMONTHDAY=1;UNTIL=19980901T210000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970601T210000Z -DTEND:19970601T220000Z -LOCATION:Conference Call -DTSTAMP:19970526T083000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:25:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Change 1st instance to july 3 -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1com -RECURRENCE-ID:19970701T210000Z -SEQUENCE:1 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970703T210000Z -DTEND:19970703T220000Z -LOCATION:Conference Call -DTSTAMP:19970626T093000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:26:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(cancel) Delete the Aug 1 instances -Mime-Version: 1.0 -Content-Type:text/calendar; method=CANCEL; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:CANCEL -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -RECURRENCE-ID:19970801T210000Z -SEQUENCE:2 -STATUS:CANCELLED -DTSTAMP:19970721T093000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:27:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(add) add a new instance -Mime-Version: 1.0 -Content-Type:text/calendar; method=ADD; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:ADD -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:3 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -ATTENDEE;RSVP=TRUE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970715T210000Z -DTEND:19970715T220000Z -LOCATION:Conference Call -DTSTAMP:19970629T093000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:28:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(cancel) cancel an new instance -Mime-Version: 1.0 -Content-Type:text/calendar; method=CANCEL; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:CANCEL -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -RECURRENCE-ID:19970801T210000Z -SEQUENCE:4 -STATUS:CANCELLED -DTSTAMP:19970721T093000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:29:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Change all future instances -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -RECURRENCE-ID;RANGE=THISANDFUTURE:19970901T210000Z -SEQUENCE:5 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -ATTENDEE;RSVP=TRUE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Discussion -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970901T210000Z -DTEND:19970901T220000Z -LOCATION:Building 32, Microsoft, Seattle, WA -DTSTAMP:19970526T083000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:30:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(cancel) Cancel the entire event (all instances) -Mime-Version: 1.0 -Content-Type:text/calendar; method=CANCEL; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:CANCEL -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -DTSTAMP:19970721T103000Z -SEQUENCE:3 -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:30:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(REQUEST) Add Series (original event) -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:0 -RRULE:WKST=SU;BYDAY=TU;FREQ=WEEKLY -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980303T210000Z -DTEND:19980303T220000Z -LOCATION:The White Room -DTSTAMP:19980301T093000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:31:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(ADD) Add Series (stuff to add) -Mime-Version: 1.0 -Content-Type:text/calendar; method=ADD; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:ADD -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:7 -RRULE:WKST=SU;BYDAY=TH;FREQ=WEEKLY -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980303T210000Z -DTEND:19980303T220000Z -DTSTAMP:19980303T193000Z -LOCATION:The Usual conference room -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:32:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(ADD) Add Series (alternative) -Mime-Version: 1.0 -Content-Type:text/calendar; method=ADD; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:ADD -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:7 -RRULE:WKST=SU;BYDAY=TU,TH;FREQ=WEEKLY -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980303T210000Z -DTEND:19980303T220000Z -DTSTAMP:19980303T193000Z -LOCATION:The White Room -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:33:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Instance Specific info (original event) -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:0 -RDATE:19980304T180000Z -RDATE:19980311T180000Z -RDATE:19980318T180000Z -RDATE:19980325T180000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980304T180000Z -DTEND:19980304T200000Z -DTSTAMP:19980303T193000Z -LOCATION:Conference Room A -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:34:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Instance Specific info (chg 2nd instance) -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:1 -RECURRENCE-ID:19980311T180000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980311T160000Z -DTEND:19980311T170000Z -DTSTAMP:19980306T193000Z -LOCATION:The Small conference room -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:35:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(add) Instance Specific info (add 4th instance) -Mime-Version: 1.0 -Content-Type:text/calendar; method=ADD; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:ADD -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:2 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980315T180000Z -DTEND:19980315T200000Z -DTSTAMP:19980307T193000Z -LOCATION:Conference Room A -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:36:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(request) Instance Specific info (response to a refresh) -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:3 -RDATE:19980304T180000Z -RDATE:19980318T180000Z -RDATE:19980315T180000Z -RDATE:19980325T180000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980304T180000Z -DTEND:19980304T200000Z -DTSTAMP:19980303T193000Z -LOCATION:Conference Room A -STATUS:CONFIRMED -END:VEVENT -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:3 -RECURRENCE-ID:19980311T160000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980311T160000Z -DTEND:19980304T180000Z -DTSTAMP:19980306T193000Z -LOCATION:The Small conference room -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:36:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(COUNTER) Counter an instance -Mime-Version: 1.0 -Content-Type:text/calendar; method=COUNTER; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:COUNTER -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -RECURRENCE-ID:19970715T210000Z -SEQUENCE:4 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;RSVP=TRUE:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -ATTENDEE;RSVP=TRUE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970715T220000Z -DTEND:19970715T230000Z -LOCATION:Conference Call -COMMENT:May we bump this by an hour? I have a conflict -DTSTAMP:19970629T094000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:37:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(REQUEST) Contains 2 errors (props: RRULE and FOO) -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -SEQUENCE:0 -RRULE:FREQ=BICENTINIALLY;BYMONTHDAY=1 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -ATTENDEE;RSVP=TRUE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970601T210000Z -DTEND:19970601T220000Z -DTSTAMP:19970602T094000Z -LOCATION:Conference Call -STATUS:CONFIRMED -FOO:BAR -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:38:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(REPLY) Reply With Error codes for prev msg -Mime-Version: 1.0 -Content-Type:text/calendar; method=REPLY; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//RDU Software//NONSGML HandCal//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -REQUEST-STATUS:2.8;Repeating event ignored. Scheduled as a single event;RRULE -REQUEST-STATUS:3.0;Invalid Property Name;FOO -UID:guid-1@host1.com -SEQUENCE:0 -DTSTAMP:19970603T094000Z -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:39:15 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject:(REFRESH) a request from a user for a refresh -Mime-Version: 1.0 -Content-Type:text/calendar; method=REFRESH; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//RDU Software//NONSGML HandCal//EN -METHOD:REFRESH -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -UID: guid-1-12345@host1.com -DTSTAMP:19970603T094000 -END:VEVENT -END:VCALENDAR - -From: jsun@netscape.com -To: sman@netscape.com -Subject:(Quoted-Printable) a quoted printable -Mime-Version: 1.0 -Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII -Content-Transfer-Encoding: quoted-printable - -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//ACME/DesktopCalendar//EN -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -ATTENDEE;RSVP=3DTRUE;CN=3DJohn Sun;PARTSTAT=3DACCEPTED:MAILTO:jsun@netscape.com -DTSTART:19980508T200000Z -DTEND:19980508T210000Z -DTSTAMP:19980611T190000Z -SUMMARY:A VEvent with TZID DTStart -UID:001jsun@netscape.com -CLASS:PUBLIC -COMMENT:A comment with no params quote is = equals is =3D -LOCATION:A location with no params quote is =60, equals is =3D. -SEQUENCE:0 -URL:http://www.ur12.com -END:VEVENT -END:VCALENDAR - - -From - Feb 07 00:00:00 1998 -Return-Path: -From: sman@netscape.com -To: terry@netscape.com -Subject: Test44.txt -Mime-Version: 1.0 -Content-Type:text/calendar; method=REQUEST ; charset=US-ASCII -Content-Transfer-Encoding: 7bit - -BEGIN:VCALENDAR -PRODID:-//seasnake/RandomICALgenerator//EN -VERSION:2.0 -METHOD:REQUEST -BEGIN:VEVENT -ATTENDEE:MAILTO:terry@netscape.com -CONTACT;ALTREP="http://ld.example.com/pdi/jdo.vcf":Jim Dolittle\, ABC Industries\, +1-919-555-1234 -DESCRIPTION:This is the description line 0 - This is the description line 1 - This is the description line 2 - This is the description line 3 - This is the description line 4 - This is the description line 5 - This is the description line 6 - This is the description line 7 - This is the description line 8 - This is the description line 9 - This is the description line 10 - This is the description line 11 - This is the description line 12 - This is the description line 13 - This is the description line 14 - This is the description line 15 - This is the description line 16 - This is the description line 17 - This is the description line 18 -DTSTART:20000605T152503Z -DURATION:P1W2DT15H48M21S -DTSTAMP:19980608T170933Z -LAST-MODIFIED:19981227T003822Z -LOCATION:Conference Room 3 -ORGANIZER:mailto:user19@example.com -SEQUENCE:0 -STATUS:CONFIRMED -SUMMARY:This is a really really really really stupid event -UID:seasnakemcom.com9806081009332644422042 -END:VEVENT -END:VCALENDAR - -From - Sat Feb 7 14:39:15 1998 -Return-Path: -Received: from netscape.com ([208.12.43.130]) by dredd.mcom.com - (Netscape Messaging Server 3.52) with ESMTP id AAA48F3 - for ; Thu, 30 Jul 1998 16:42:01 -0700 -Message-ID: <35C104A8.318850B0@netscape.com> -Date: Thu, 30 Jul 1998 16:41:28 -0700 -From: jsun@netscape.com (John Sun) -X-Mailer: Mozilla 4.5b1 [en] (WinNT; I) -X-Accept-Language: en -MIME-Version: 1.0 -To: jsun@netscape.com -Subject: text body attachment with iCal -Content-Type: multipart/mixed; - boundary="------------C799F0A7F88F9F3891B89EDF" -X-Mozilla-Status: 8001 -X-Mozilla-Status2: 00000000 -X-UIDL: 19980730234202.AAA.1ec3b658 - -This is a multi-part message in MIME format. ---------------C799F0A7F88F9F3891B89EDF -Content-Type: text/html; charset=us-ascii -Content-Transfer-Encoding: 7bit - - - -    I've scheduled a ball game St. Paul Saints vs Duluth-Superior -Dukes for July 7, 1997 -
You're invited to come. -

P.S.  Bring you glove! -
  -
  - ---------------C799F0A7F88F9F3891B89EDF -Content-Type: text/calendar; charset=us-ascii; - name="Test1.ics" -Content-Transfer-Encoding: 7bit -Content-Disposition: inline; - filename="Test1.ics" - -BEGIN:VCALENDAR -METHOD:PUBLISH -PRODID:-//ACME/DesktopCalendar//EN -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTART:19970701T200000Z -DTSTAMP:19970611T190000Z -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID:0981234-1234234-23@example.com -END:VEVENT -END:VCALENDAR - ---------------C799F0A7F88F9F3891B89EDF-- - -From - Sat Feb 7 14:39:15 1998 -Return-Path: -Received: from netscape.com ([208.12.43.130]) by dredd.mcom.com - (Netscape Messaging Server 3.52) with ESMTP id AAA4EA2 - for ; Thu, 30 Jul 1998 16:46:56 -0700 -Message-ID: <35C105CF.5BDF89BD@netscape.com> -Date: Thu, 30 Jul 1998 16:46:23 -0700 -From: jsun@netscape.com (John Sun) -X-Mailer: Mozilla 4.5b1 [en] (WinNT; I) -X-Accept-Language: en -MIME-Version: 1.0 -To: jsun@netscape.com -Subject: text body attachment with iCal and vCard -Content-Type: multipart/mixed; - boundary="------------FBA1D27FD38C7C21B9C61AFA" -X-Mozilla-Status: 8001 -X-Mozilla-Status2: 00000000 -X-UIDL: 19980730234658.AAA.1ec3b658 - -This is a multi-part message in MIME format. ---------------FBA1D27FD38C7C21B9C61AFA -Content-Type: text/html; charset=us-ascii -Content-Transfer-Encoding: 7bit - - - -I've scheduled a ball game St. Paul Saints vs Duluth-Superior Dukes for -July 7, 1997 -
You're invited to come. -

P.S.  Bring you glove! -
  -
  - ---------------FBA1D27FD38C7C21B9C61AFA -Content-Type: text/calendar; charset=us-ascii; - name="Test1.ics" -Content-Transfer-Encoding: 7bit -Content-Disposition: inline; - filename="Test1.ics" - -BEGIN:VCALENDAR -METHOD:PUBLISH -PRODID:-//ACME/DesktopCalendar//EN -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTART:19970701T200000Z -DTSTAMP:19970611T190000Z -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID:0981234-1234234-23@example.com -END:VEVENT -END:VCALENDAR - ---------------FBA1D27FD38C7C21B9C61AFA -Content-Type: text/x-vcard; charset=us-ascii; - name="jsun.vcf" -Content-Transfer-Encoding: 7bit -Content-Description: Card for John Sun -Content-Disposition: attachment; - filename="jsun.vcf" - -begin:vcard -n:Sun;John -tel;fax:650-937-2103 -tel;home:650-328-3888 -tel;work:650-937-4238 -x-mozilla-html:FALSE -org:Netscape Communications;Client Engineering -adr:;;501 E. Middlefield Road MV-041;Mountain View;CA;94043;USA -version:2.1 -email;internet:jsun@netscape.com -title:Client Engineer -fn:John Sun -end:vcard - - ---------------FBA1D27FD38C7C21B9C61AFA-- - -From - Sat Feb 7 14:39:15 1998 -Return-Path: -Received: from netscape.com ([208.12.43.130]) by dredd.mcom.com - (Netscape Messaging Server 3.52) with ESMTP id AAA538C - for ; Thu, 30 Jul 1998 16:51:00 -0700 -Message-ID: <35C106C3.58432909@netscape.com> -Date: Thu, 30 Jul 1998 16:50:27 -0700 -From: jsun@netscape.com (John Sun) -X-Mailer: Mozilla 4.5b1 [en] (WinNT; I) -X-Accept-Language: en -MIME-Version: 1.0 -To: jsun@netscape.com -Subject: iCal and HTML attachment -Content-Type: multipart/mixed; - boundary="------------C36B548200421B240F572EDD" -X-Mozilla-Status: 9001 -X-Mozilla-Status2: 00000000 -X-UIDL: 19980730235101.AAA.1ec3b658 - -This is a multi-part message in MIME format. ---------------C36B548200421B240F572EDD -Content-Type: text/html; charset=us-ascii -Content-Transfer-Encoding: 7bit - - - -  - ---------------C36B548200421B240F572EDD -Content-Type: text/calendar; charset=us-ascii; - name="Test1.ics" -Content-Transfer-Encoding: 7bit -Content-Disposition: inline; - filename="Test1.ics" - -BEGIN:VCALENDAR -METHOD:PUBLISH -PRODID:-//ACME/DesktopCalendar//EN -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTART:19970701T200000Z -DTSTAMP:19970611T190000Z -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID:0981234-1234234-23@example.com -END:VEVENT -END:VCALENDAR - ---------------C36B548200421B240F572EDD -Content-Type: text/html; charset=us-ascii; - name="engdocs.html" -Content-Transfer-Encoding: 7bit -Content-Disposition: inline; - filename="engdocs.html" - - - - - - Julian Engineering Documents - - - -

-

-Julian Engineering Documents

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Netscape
Calendar -Architecture
Julian -Design
Cross-Platform -Plan 
ITIP/IMIP -Handler for Communicator 
CAPI -(Calendar API)  -
    A -proposed CAPI URL
Date -/ Time / Calendar Obscure Facts  -
 
Calendar Standards 
ModelICalendar Model Specification  This informational draft -describes the calendar space.
ICALInternet Calendaring and Scheduling Core Object Specification -(iCalendar)  This draft describes the calendar data object.
ITIPiCalendar Transport-independent Interoperability Protocol  -This draft describes an application protocol for exchanging iCalendar objects.
IMIPiCalendar Message-based Interoperability Protocol  This -draft describes an email based transport binding for ITIP.  There -is short overview -available as well.
IRIPiCalendar Realtime Interoperability Protocol  This draft -describes a real time transport binding for ITIP
CAPCalendar Access Protocol   This draft describes a -calendar server access protocol.  - -
 
Mercury Plans 
PIM (Address Book) Ideas 
Calendar Architecture Proposed architecture for Mercury/Pisces
Timebar Calendar Design 
Prior Art
XAPIA Calendaring   -
and Scheduling -API  -
(zipped -Word Doc) 
This was a proposed standard API.  Prior to VCAL.
VCAL and VCARDVCAL was the predecessor of ICAL
-  - - - ---------------C36B548200421B240F572EDD -Content-Type: text/x-vcard; charset=us-ascii; - name="jsun.vcf" -Content-Transfer-Encoding: 7bit -Content-Description: Card for John Sun -Content-Disposition: attachment; - filename="jsun.vcf" - -begin:vcard -n:Sun;John -tel;fax:650-937-2103 -tel;home:650-328-3888 -tel;work:650-937-4238 -x-mozilla-html:FALSE -org:Netscape Communications;Client Engineering -adr:;;501 E. Middlefield Road MV-041;Mountain View;CA;94043;USA -version:2.1 -email;internet:jsun@netscape.com -title:Client Engineer -fn:John Sun -end:vcard - - ---------------C36B548200421B240F572EDD-- - - diff --git a/mozilla/calendar/modules/test/tools/meeting.cgi b/mozilla/calendar/modules/test/tools/meeting.cgi deleted file mode 100755 index 3ff2f466723..00000000000 --- a/mozilla/calendar/modules/test/tools/meeting.cgi +++ /dev/null @@ -1,285 +0,0 @@ -#! /tools/ns/bin/perl5.004 - -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (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.org 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. -# -# Contributor(s): - - -use Socket; - -$mailhost = 'localhost'; - -@MonthNames = (" ", "January", "February", "March", "April", "May", "June", - "July", "August", "September", "October", "November", "December"); -srand(); -&process_args; - -print "Content-Type: text/html\n\n"; -print "\n"; - -# -# Build an indexed array. The index is the property name, -# the value is the property value. -# -@parms = split('&',$ENV{'QUERY_STRING'}); -printf("

\n"); -foreach $val (@parms) -{ - #printf("%s
\n", $val); - #printf("p = %s, v = %s
\n", $p, $v); - ($p, $v) = split('=',$val); - $v =~ s/(%40)/@/g; - $v =~ s/\+/ /g; - $v =~ s/%0D/\r/g; - $v =~ s/%0A/\n/g; - $v =~ s/%2F/\//g; - $v =~ s/%28/(/g; - $v =~ s/%27/'/g; - $v =~ s/%29/)/g; - $v =~ s/%2C/,/g; - $v =~ s/%3D/=/g; - $v =~ s/%3B/;/g; - $vals{$p} = $v; -} - -printf("

Sent: Event REQUEST

\n"); -printf("message sent to: %s\n
\n", $vals{'who'} ); -printf("Organizer: %s\n
\n", $vals{'organizer'} ); -printf("Attendees: %s\n
\n", $vals{'ATTENDEE'} ); -printf("Subject: %s\n
\n", $vals{'SUBJECT'} ); -printf("Description: %s\n
\n", $vals{'DESCRIPTION'} ); -printf("Location: %s\n
\n", $vals{'LOCATION'} ); -printf("start time: %s\n
\n", $vals{'DTSTART'} ); -printf("end time: %s\n
\n", $vals{'DTEND'} ); - -@mailto = split(' ',$vals{'who'}); -@attendees = split(' ',$vals{'ATTENDEE'}); - -printf("sending the mail message now.\n"); -print "\n"; - -if ($flag_debug ) -{ - print STDERR "----------------------------------------------\n"; - print STDERR "LOGINFO:\n"; - print STDERR " mailto: @mailto\n"; - print STDERR "----------------------------------------------\n"; -} - -&mail_the_message; - -0; - - -sub process_args -{ - while (@ARGV) { - $arg = shift @ARGV; - - if ($arg eq '-d') - { - $flag_debug = 1; - print STDERR "Debug turned on...\n"; - } - elsif ($arg eq '-h') - { - $mailhost = shift @ARGV; - } - else - { - push(@mailto, $arg); - } - } -} - - -sub get_response_code { - my ($expecting) = @_; -# if ($flag_debug) { -# print STDERR "SMTP: Waiting for code $expecting\n"; -# } - while (1) { - my $line = ; -# if ($flag_debug) { -# print STDERR "SMTP: $line"; -# } - if ($line =~ /^[0-9]*-/) { - next; - } - if ($line =~ /(^[0-9]*) /) { - my $code = $1; - if ($code == $expecting) { -# if ($flag_debug) { -# print STDERR "SMTP: got it.\n"; -# } - return; - } - die "Bad response from SMTP -- $line"; - } - } -} - -sub unique_id -{ - local($d,$r); - if ($date_cmd =~ /date/) - { - chop($d = `$date_cmd +%y%m%d%H%M%S` ); - } - else - { - $d = rand(711771); - } - $r = int(rand(100000)); - $hostname.".".$domain.$d."$$"."$r"; -} - -sub fmtDate -{ - local($d,$year,$month,$day,$hour,$min,$sec) = @_; - - $year = substr($d,0,4); - $month = substr($d,4,2); - $day = substr($d,6,2); - $hour = substr($d,9,2); - $min = substr($d,11,2); - $sec = substr($d,13,2); - - $MonthNames[ int($month) ]." ".int($day).", ".$year." ".$hour.":".$min." Z"; -} - -sub mail_the_message { - chop(my $hostname = `hostname`); - - my ($remote,$port, $iaddr, $paddr, $proto, $line, $boundary, $rnum); - - $rnum = &unique_id(); - $boundary="MULTIPART-BOUNDARY--$rnum"; - - $remote = $mailhost; - $port = 25; - if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') } - die "No port" unless $port; - $iaddr = inet_aton($remote) || die "no host: $remote"; - $paddr = sockaddr_in($port, $iaddr); - - $proto = getprotobyname('tcp'); - socket(S, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; - connect(S, $paddr) || die "connect: $!"; - select(S); $| = 1; select(STDOUT); - - get_response_code(220); - print S "HELO $hostname\n"; - get_response_code(250); - printf( S "MAIL FROM: %s\n", $vals{'organizer'} ); - get_response_code(250); - foreach $i (@mailto) { - print S "RCPT TO: $i\n"; - if ($flag_debug ) - { - print STDERR "RCPT TO: $i\n"; - } - get_response_code(250); - } - print S "DATA\n"; - get_response_code(354); - - printf(S "Date: %s", `date`); - printf(S "From: %s\n", $vals{'organizer'}); - printf(S "Return-Path: <%s>\n", $vals{'organizer'} ); - printf(S "To: %s\n",$vals{'who'} ); - printf(S "Subject:Event Request - %s\n",$vals{'SUMMARY'}); - printf(S "Mime-Version: 1.0\n"); -# printf(S "Content-Type:multipart/mixed; boundary=\"$boundary\"\n"); -# printf(S "\n"); -# -# printf(S "--%s\n",$boundary); -# printf(S "Content-Type:text/plain; charset=US-ASCII\n"); -# printf(S "Content-Transfer-Encoding: 7bit\n"); -# printf(S "\n"); -# -# printf(S "%s has invited you to a meeting\n", $vals{'organizer'}); -# printf(S "\n"); -# printf(S " When: %s\n", &fmtDate($vals{'DTSTART'})); -# printf(S " With: "); -# foreach $i (@attendees) -# { -# if ( $i eq $vals{'organizer'}) -# { -# printf(S "$i (Organizer)\n"); -# } -# else -# { -# printf(S "$i\n"); -# } -# printf(S " "); -# } -# printf(S "\n\n"); -# printf(S "Description: %s",$vals{'DESCRIPTION'}); -# printf(S "\n\n"); -# -# -# printf(S "--%s\n",$boundary); - printf(S "Content-Type:text/calendar; method=REQUEST; component=VEVENT; charset=US-ASCII\n"); - printf(S "Content-Transfer-Encoding: 7bit\n"); - # printf(S "Content-Disposition: inline; filename=\"event.ics\"\n"); - printf(S "\n"); - printf(S "BEGIN:VCALENDAR\n"); - printf(S "METHOD:REQUEST\n"); - printf(S "PRODID:-//seasnake/Zulu//EN\n"); - printf(S "VERSION:2.0\n"); - printf(S "BEGIN:VEVENT\n"); - printf(S "ORGANIZER:mailto:%s\n",$vals{'organizer'}); - foreach $i (@attendees) - { - if ( $i eq $vals{'organizer'}) - { - printf(S "ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:mailto:$i\n"); - } - else - { - printf(S "ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION:mailto:$i\n"); - } - } - printf(S "DTSTART:%s\n",$vals{'DTSTART'}); - printf(S "DTEND:%s\n",$vals{'DTEND'}); - $ENV{'TZ'} = "GMT0"; - printf(S "DTSTAMP:%s",`date +19%y%m%dT%H%M%SZ`); - $ENV{'TZ'} = "PST8PDT"; - printf(S "SUMMARY:%s\n",$vals{'SUMMARY'}); - printf(S "DESCRIPTION:%s",$vals{'DESCRIPTION'}); - chop($h = `hostname`); - chop($dm = `domainname`); - chop($d = `date +%y%m%d%H%M%S`); - printf(S "UID:%s.%s-%s.%s\n",$h, $dm, $d, "$$" ); - printf(S "SEQUENCE:0\n"); - printf(S "LOCATION:%s\n",$vals{'LOCATION'}); - printf(S "RRULE:%s\n",$vals{'RRULE'}) if ('' ne $vals{'RRULE'}) ; - printf(S "EXDATE:%s\n",$vals{'EXDATE'}) if ('' ne $vals{'RRULE'}) ; - printf(S "STATUS:CONFIRMED\n"); - printf(S "END:VEVENT\n"); - printf(S "END:VCALENDAR\n"); -# printf(S "\n"); -# printf(S "--%s\n",$boundary); - - print S ".\n"; - get_response_code(250); - print S "QUIT\n"; - - close(S); -} diff --git a/mozilla/calendar/modules/test/tools/meeting.html b/mozilla/calendar/modules/test/tools/meeting.html deleted file mode 100644 index 27fa0698120..00000000000 --- a/mozilla/calendar/modules/test/tools/meeting.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - -
- -

IMIP Meeting Request

-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Organizer:  - - - - example: - jsun@netscape.com - - (typically your e-mail address)  -
- - Send request to: - - - -
space delimited addresses, example: - sman@netscape.com eyork@netscape.com spider@netscape.com -
- - Meeting Attendees: - - - -
space delimited addresses, usually the same as who - you're sending the request to, but not always. Example: - sman@netscape.com eyork@netscape.com spider@netscape.com -
- - Summary: - - - -
- - Start time: - - - - example: 19981006T180000Z -
- - End time: - - - - example: 19980523T190000Z -
- - Location: - - - -
- - RRULE: - - - - example:COUNT=10;FREQ=WEEKLY -
- - EXDATE: - - - - example:19981103T190000Z -
- - Description: - - - -
-
- -
-
- - diff --git a/mozilla/calendar/modules/test/tools/mkfolder b/mozilla/calendar/modules/test/tools/mkfolder deleted file mode 100644 index ce65372aa2b..00000000000 --- a/mozilla/calendar/modules/test/tools/mkfolder +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/sbin/perl - -# mkfolder -# -# This script converts a series of test files, each containing -# a single icalendar object into a single mail folder with messages -# for each iCalendar object. -# -# Currently the name of the folder produced is hardcoded as "newIMIP" -# -# To convert mail folders into a series of test files use mktest -# -# Usage: -# mkfolder test*.txt -# -# -sman - - -if (0 > $#ARGV) -{ - print STDERR "You need to supply a list of test files on the cmd line\n"; - die; -} - -# -# Hardcode some values to get things rolling... -# -$MailFolderName = "newIMIP"; -$TestCount = 0; -$Day = 7; -$Hour = 0; -$Min = 0; -$Sec = 0; - -sub mailHeader -{ - local($m) = pop(@_); - $fline = sprintf("From - Feb %02d %02d:%02d:%02d 1998\n", - $Day, $Hour, $Min, $Sec); - print MFOLDER "$fline"; - print MFOLDER "Return-Path: \n"; - print MFOLDER "From: sman\@netscape.com\n"; - print MFOLDER "To: terry\@netscape.com\n"; - print MFOLDER "Subject: $ARGV[$i]\n"; - print MFOLDER "Mime-Version: 1.0\n"; - print MFOLDER "Content-Type:text/calendar; method=".${m}."; charset=US-ASCII\n"; - print MFOLDER "Content-Transfer-Encoding: 7bit\n"; - print MFOLDER "\n"; - if ( (++$Sec) > 59 ) - { - $Sec = 0; - if ( (++$Min) > 59 ) - { - $Min = 0; - if ( (++$Hour) > 23 ) - { - $Hour = 0; - ++$Day; # this is enough for now - } - } - } - foreach $j (0 .. $i-1) - { - print MFOLDER $keep[$j]; - } -} - - -# -# Open the mail folder and get going. -# -if (!open(MFOLDER,">> $MailFolderName")) -{ - print STDERR "Can't create $MailFolderName \n"; - print STDERR "error: $!\n"; - die; -} - - -# -# Spin through the list of supplied folders, add them to MFOLDER -# -foreach $i (0..$#ARGV) -{ - if (!open(TESTFILE,$ARGV[$i])) - { - print STDERR "Can't open $filename \n"; - print STDERR "error: $!\n"; - die; - } - - ++$TestCount; - - # - # Save lines until we find the method... - # - $Looking = 1; - $i = 0; - while ($Looking == 1) - { - if ($line = ) - { - $keep[$i++] = $line; - if ($line =~ /METHOD:/) - { - $Looking = 0; - $method = substr( $line, 1+index($line,":") ); - chop($method); - &mailHeader($method); - } - } - } - - # - # Add the lines in the test folder... - # - while ($line = ) - { - print MFOLDER $line - } - print MFOLDER "\n"; - -} - -close MFOLDER; -print "new mail folder created: $MailFolderName\n"; -print "entries added: $TestCount \n"; - - diff --git a/mozilla/calendar/modules/test/tools/mktest b/mozilla/calendar/modules/test/tools/mktest deleted file mode 100644 index 9dd4a33fee1..00000000000 --- a/mozilla/calendar/modules/test/tools/mktest +++ /dev/null @@ -1,70 +0,0 @@ -#!c:/usr/local/bin/perl - -# mktest -# -# This script converts a mail folder containing IMIP attachments -# into a series of test files: test1.txt, test2.txt, ... -# Each test file contains a single iCalendar object. -# -# To convert a series of test files back into a mail folder, -# use mkfolder -# -# Usage: -# mktest mailFolderName -# -# -sman - -if (0 > $#ARGV) -{ - print STDERR "You need to supply a list of mail folders on the cmd line\n"; - die; -} - -foreach $i (0..$#ARGV) -{ - if (!open(FOLDER,$ARGV[$i])) - { - print STDERR "Can't open $filename \n"; - print STDERR "error: $!\n"; - die; - } - - $emitting = 0; - $TestNo = 1; - - # mail folders are provided on the command line - # spin through them, extract individual ical objects - # and store them into text files. - - while ($line = ) - { - chop $line; - if ( $line =~ /BEGIN:VCALENDAR/ ) - { - $emitting = 1; - $TestName = "Test"."$TestNo".".txt"; - # print ">>>>>>>>>>> CREATE: $TestName\n"; - if (!open(TSTFILE,"> $TestName")) - { - print STDERR "Can't create $TestName \n"; - print STDERR "error: $!\n"; - die; - } - - } - if ($emitting == 1) - { - print TSTFILE "$line\n" ; - } - if ( $line =~ /END:VCALENDAR/ ) - { - $emitting = 0; - # print "<<<<<<<<<<< CLOSE: $TestName\n"; - ++$TestNo; - close TSTFILE - } - } - - --$TestNo; - print "Created $TestNo test files\n" -} diff --git a/mozilla/calendar/modules/test/tools/pub.html b/mozilla/calendar/modules/test/tools/pub.html deleted file mode 100644 index 24da0d471bc..00000000000 --- a/mozilla/calendar/modules/test/tools/pub.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - -

-Publish an Event

-  -
 
- - - - - - - - - - - - - - - - - - - - - - - - - -
Organizer:  -example: -jsun@netscape.com -(typically your e-mail address) 
-Send request to: - - -
space delimited addresses, example: -sman@netscape.com eyork@netscape.com spider@netscape.com -
- Summary: - - -
-Start time: - - -example: 19980522T070000Z -
-End time: - - -example: 19980523T070000Z -
Description: - -
- -
- - diff --git a/mozilla/calendar/modules/test/tools/publish.cgi b/mozilla/calendar/modules/test/tools/publish.cgi deleted file mode 100755 index ad9b9e8ec7c..00000000000 --- a/mozilla/calendar/modules/test/tools/publish.cgi +++ /dev/null @@ -1,189 +0,0 @@ -#! /tools/ns/bin/perl5.004 - -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (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.org 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. -# -# Contributor(s): - - -use Socket; - -$mailhost = 'localhost'; - -&process_args; - -print "Content-Type: text/html\n\n"; -print "\n"; - -# -# Build an indexed array. The index is the property name, -# the value is the property value. -# -@parms = split('&',$ENV{'QUERY_STRING'}); -printf("

\n"); -foreach $val (@parms) -{ - #printf("%s
\n", $val); - #printf("p = %s, v = %s
\n", $p, $v); - ($p, $v) = split('=',$val); - $unfiltered_vals{$p} = $v; - $v =~ s/(%40)/@/g; - $v =~ s/\+/ /g; - $v =~ s/%0D/\r/g; - $v =~ s/%0A/\n /g; - $vals{$p} = $v; -} - -printf("

Published Event

\n"); -printf("Organizer: %s\n
\n", $unfiltered_vals{'organizer'} ); -printf("message sent to: %s\n
\n", $unfiltered_vals{'who'} ); -printf("Subject: %s\n
\n", $vals{'SUBJECT'} ); -printf("Description: %s\n
\n", $vals{'DESCRIPTION'} ); -printf("start time: %s\n
\n", $vals{'DTSTART'} ); -printf("end time: %s\n
\n", $vals{'DTEND'} ); - -@mailto = split(' ',$unfiltered_vals{'who'}); - -printf("sending the mail message now.\n"); -print "\n"; - -if ($flag_debug ) -{ - print STDERR "----------------------------------------------\n"; - print STDERR "LOGINFO:\n"; - print STDERR " mailto: \@mailto\n"; - print STDERR "----------------------------------------------\n"; -} - -&mail_the_message; - -0; - - -sub process_args -{ - while (@ARGV) { - $arg = shift @ARGV; - - if ($arg eq '-d') - { - $flag_debug = 1; - print STDERR "Debug turned on...\n"; - } - elsif ($arg eq '-h') - { - $mailhost = shift @ARGV; - } - else - { - push(@mailto, $arg); - } - } -} - - -sub get_response_code { - my ($expecting) = @_; -# if ($flag_debug) { -# print STDERR "SMTP: Waiting for code $expecting\n"; -# } - while (1) { - my $line = ; -# if ($flag_debug) { -# print STDERR "SMTP: $line"; -# } - if ($line =~ /^[0-9]*-/) { - next; - } - if ($line =~ /(^[0-9]*) /) { - my $code = $1; - if ($code == $expecting) { -# if ($flag_debug) { -# print STDERR "SMTP: got it.\n"; -# } - return; - } - die "Bad response from SMTP -- $line"; - } - } -} - - -sub mail_the_message { - chop(my $hostname = `hostname`); - - my ($remote,$port, $iaddr, $paddr, $proto, $line); - - $remote = $mailhost; - $port = 25; - if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') } - die "No port" unless $port; - $iaddr = inet_aton($remote) || die "no host: $remote"; - $paddr = sockaddr_in($port, $iaddr); - - $proto = getprotobyname('tcp'); - socket(S, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; - connect(S, $paddr) || die "connect: $!"; - select(S); $| = 1; select(STDOUT); - - get_response_code(220); - print S "HELO $hostname\n"; - get_response_code(250); - printf( S "MAIL FROM: %s\n", $unfiltered_vals{'organizer'} ); - get_response_code(250); - foreach $i (@mailto) { - print S "RCPT TO: $i\n"; - get_response_code(250); - } - print S "DATA\n"; - get_response_code(354); - - printf(S "Date: %s", `date`); - printf(S "From: %s\n", $unfiltered_vals{'organizer'}); - printf(S "Return-Path: <%s>\n", $unfiltered_vals{'organizer'} ); - printf(S "To: %s\n",$unfiltered_vals{'who'} ); - printf(S "Subject:Published Event\n"); - printf(S "Mime-Version: 1.0\n"); - printf(S "Content-Type:text/calendar; method=PUBLISH; charset=US-ASCII\n"); - printf(S "Content-Transfer-Encoding: 7bit\n"); - printf(S "\n"); - printf(S "BEGIN:VCALENDAR\n"); - printf(S "METHOD:PUBLISH\n"); - printf(S "PRODID:-//seasnake/DesktopCalendar//EN\n"); - printf(S "VERSION:2.0\n"); - printf(S "BEGIN:VEVENT\n"); - printf(S "ORGANIZER:mailto:%s\n",$unfiltered_vals{'organizer'}); - printf(S "DTSTART:%s\n",$vals{'DTSTART'}); - printf(S "DTEND:%s\n",$vals{'DTEND'}); - $ENV{'TZ'} = "GMT0"; - printf(S "DTSTAMP:%s",`date +19%y%m%dT%H%M%SZ`); - $ENV{'TZ'} = "PST8PDT"; - printf(S "SUMMARY:%s\n",$vals{'SUMMARY'}); - printf(S "DESCRIPTION:%s\n",$vals{'DESCRIPTION'}); - chop($h = `hostname`); - chop($dm = `domainname`); - chop($d = `date +%y%m%d%H%M%S`); - printf(S "UID:%s.%s-%s.%s\n",$h, $dm, $d, "$$" ); - printf(S "END:VEVENT\n"); - printf(S "END:VCALENDAR\n"); - - print S ".\n"; - get_response_code(250); - print S "QUIT\n"; - - close(S); -} diff --git a/mozilla/calendar/modules/test/tools/randical.cgi b/mozilla/calendar/modules/test/tools/randical.cgi deleted file mode 100755 index e650ec32478..00000000000 --- a/mozilla/calendar/modules/test/tools/randical.cgi +++ /dev/null @@ -1,922 +0,0 @@ -#! /tools/ns/bin/perl5.004 - - -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (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.org 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. -# -# Contributor(s): - -################################################################### - -# file: rical.pl - -# A random iCalendar file generator for testing the icalendar parser. -# Set the DATE_CMD environment variable if you are on Windows or Mac -# to point to the unix 'date' equivalent program. - -# I have arbitrarily defined 3 categories of randomness that determine -# whether or not a property or parameter appears in the output. These -# are: -# $MAY_prop_chances # defaults to 5% -# $SHOULD_prop_chances # defaults to 65% -# $MUST_prop_chances # defaults to 95% - -# You can vary these chances with command line options. - -# sman -# 29-May-1998 - -############################################################# -# Arrays for populating properties and parameters -############################################################# -@categories = ('SPORTS','THEATER','CONVENTION','MEAL','VACATION', - 'BIRTHDAY'); -@class = ("PUBLIC", "PRIVATE", "CONFIDENTIAL", "X-VALUE"); -@cnFirst = ("Steve", "Joe", "Eric", "John", "Greg", "Terry", - "Dave", "Scott", "Kevin", "Poindexter" ); -@cnLast = ("Smith", "Jones", "Washington", "DuBois", "Wells", - "Vaughn", "Flintstone", "Simpson", "Smithers", "Gumble"); -@cutypeparm = ("INDIVIDUAL", "GROUP", "RESOURCE", "ROOM", "UNKNOWN", - "X-TOKEN" ); -@fbtypeparm = ("FREE","BUSY","BUSY-UNAVAILABLE", "BUSY-TENTATIVE"); -@method = ("PUBLISH", "REQUEST", "REFRESH", "CANCEL", "ADD", "REPLY", - "COUNTER", "DECLINECOUNTER" ); -@partstatparm =("NEEDS-ACTION", "ACCEPTED", "DECLINED", "TENTATIVE", - "DELEGATED", "x-name" ); -@resources = ("CAR", "TRUCK", "THEATER", "COUNTRY", "MILITARY", - "PROJECTOR", "STEREO", "CDPLAYER" ); -@roleparm = ("CHAIR", "REQ-PARTICIPANT", "OPT-PARTICIPANT", - "NON-PARTICIPANT", "X-NAME" ); -@status = ("TENTATIVE", "CONFIRMED", "CANCELLED" ); -@transparm = ("OPAQUE","TRANSPARENT"); - -@rrules = ( - "FREQ=DAILY;COUNT=10", - "FREQ=DAILY;UNTIL=19981224T000000Z", - "FREQ=DAILY;INTERVAL=2", - "FREQ=DAILY;INTERVAL=10;COUNT=5", - "FREQ=DAILY;UNTIL=20000131T090000Z;BYMONTH=1", - "FREQ=YEARLY;UNTIL=20000131T090000Z;BYMONTH=1;BYDAY=SU,MO,TU,WE,TH,FR,SA", - "FREQ=WEEKLY;COUNT=10", - "FREQ=WEEKLY;UNTIL=19981224T000000Z", - "FREQ=WEEKLY;INTERVAL=2;WKST=SU", - "FREQ=WEEKLY;COUNT=10;WKST=SU;BYDAY=TU,TH", - "FREQ=WEEKLY;COUNT=10;INTERVAL=2;WKST=SU;BYDAY=TU,TH", - "FREQ=MONTHLY;COUNT=10;INTERVAL=2;BYDAY=1FR", - "FREQ=MONTHLY;COUNT=10;INTERVAL=2;BYDAY=1SU,-1SU", - "FREQ=MONTHLY;COUNT=6;BYDAY=-2MO", - "FREQ=MONTHLY;BYMONTHDAY=-3", - "FREQ=MONTHLY;BYMONTHDAY=2,15", - "FREQ=MONTHLY;COUNT=10;BYMONTHDAY=1,-1", - "FREQ=MONTHLY;INTERVAL=18;COUNT=10;BYMONTHDAY=10,11,12,13,14,15", - "FREQ=MONTHLY;INTERVAL=2;BYDAY=TU", - "FREQ=YEARLY;COUNT=10;BYMONTH=6,7", - "FREQ=YEARLY;INTERVAL=2;COUNT=10;BYMONTH=1,2,3", - "FREQ=YEARLY;INTERVAL=3;COUNT=10;BYYEARDAY=1,100,200", - "FREQ=YEARLY;BYDAY=20MO", - "FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO", - "FREQ=YEARLY;BYMONTH=3;BYDAY=TH", - "FREQ=YEARLY;BYDAY=TH;BYMONTH=6,7,8", - "FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13", - "FREQ=MONTHLY;BYDAY=SA;BYMONTHDAY=7,8,9,10,11,12,13", - "FREQ=YEARLY;INTERVAL=4;BYMONTH=11;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8", - "FREQ=MONTHLY;COUNT=3;BYDAY=TU,WE,TH;BYSETPOS=3", - "FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2", - "FREQ=HOURLY;INTERVAL=3;UNTIL19981224T080000Z", - "FREQ=MINUTELY;INTERVAL=15;COUNT=6", - "FREQ=MINUTELY;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16", - "FREQ=MINUTELY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40", - "FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=MO" - ); - -@exrules = ( - "FREQ=WEEKLY;COUNT=4;INTERVAL=2;BYDAY=TU,TH", - "FREQ=DAILY;COUNT=10", - "FREQ=YEARLY;COUNT=8;BYMONTH=6,7" - ); - -@return_codes = ( - "2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", - "2.7", "2.8", "2.9", "2.10", "2.11", - "3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7", - "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", - "4.0", - "5.0", "5.1", "5.2", "5.3" - ); - -############################################################# -# Varios buttons and nobs that can tweek the output... -############################################################# -$recur = 0; # flag: allow recurring params -$rand_component_count = 0; # flag: allow random number of components per ical obj -$date_cmd = "date"; # the date command -$hostname = "host"; -$domain = "example.com"; -$bad_key_words = 0; # 0 = no bad keywords, 1 = may generate bad keywords -$component_type = 1; # component type to generate -$max_comp_type = 2; # 1-Events,2-Freebusy -$SHOULD_prop_chances = 65; # 0 - 100, % chance that SHOULD properties will appear -$MUST_prop_chances = 95; # 0 - 100, % chance that MUST properties will appear -$MAY_prop_chances = 10; # 0 - 100, % chance that MAY properties will appear -$RUIN_prop_chances = 10; # 0 - 100, only valid when $bad_key_words is 1. - # it is the % chance that a keword will be bad -$max_fb_dur_hrs = 4; # maximum number of hours that a busy time can be - # the larger this number, the less the chances - # of multiple busy times per day. - -############################################################# -# ICALENDAR WRAPPER -############################################################# -&process_args(); -&init(); -&check_for_cgi_buttons(); - -if ($component_type == 2) -{ - # 0 = Publish, 5 = Reply - $itip_method = $method[ ((int(rand(2)) == 0) ? 0 : 5) ]; -} -else -{ - $itip_method = $method[int(rand(1 + $#method))]; -} - -printf("Content-Type:text/calendar; method=%s; charset=US-ASCII\n",$itip_method); -printf("Content-Transfer-Encoding: 7bit\n"); -printf("\n"); -printf("%s:%s\n", &ruin_keyword("BEGIN"), &ruin_keyword("VCALENDAR") ); -printf("%s:-//seasnake/RandomICALgenerator//EN\n", &ruin_keyword("PRODID") ); -printf("%s:2.0\n",&ruin_keyword("VERSION")); -printf("%s:%s\n",&ruin_keyword("METHOD"),$itip_method); - -if ($component_type == 1) -{ - $numevents = 1; - $numevents += int(rand(7)) if (1 == $rand_component_count); - - for ($iouter = 0; $iouter < $numevents; $iouter++) - { - &add_event(); - } -} -elsif ($component_type == 2) -{ - &add_freebusy(); -} - -printf("%s:%s\n", &ruin_keyword("END"), &ruin_keyword("VCALENDAR")); - -0; - - -sub process_args -{ - while (@ARGV) { - $arg = shift @ARGV; - - if ($arg eq '-d') - { - $debug = 1; - print STDERR "Debug turned on...\n"; - } - elsif ($arg eq '-r') - { - $recur = 1; - print STDERR "Recur turned on...\n" if ($debug == 1); - } - elsif ($arg eq '-rcc') - { - $rand_component_count = 1; - print STDERR "Random component count turned on...\n" if ($debug == 1); - - } - elsif ($arg eq '-bkw') - { - $bad_key_words = 1; - print STDERR "component_type = 2, freebusy...\n" if ($debug == 1); - } - elsif( $arg eq '-may') - { - $arg = shift @ARGV; - $MAY_prop_chances = $arg; - $MAY_prop_chances = 0 if ($MAY_prop_chances < 0); - $MAY_prop_chances = 100 if ($MAY_prop_chances > 100); - printf( STDERR "MAY_prop_chances = %d\n",$MAY_prop_chances) - if ($debug == 1); - } - elsif( $arg eq '-must') - { - $arg = shift @ARGV; - $MUST_prop_chances = $arg; - $MUST_prop_chances = 0 if ($MUST_prop_chances < 0); - $MUST_prop_chances = 100 if ($MUST_prop_chances > 100); - printf( STDERR "MUST_prop_chances = %d\n",$MUST_prop_chances) - if ($debug == 1); - } - elsif( $arg eq '-ruin') - { - $arg = shift @ARGV; - $RUIN_prop_chances = $arg; - $RUIN_prop_chances = 0 if ($RUIN_prop_chances < 0); - $RUIN_prop_chances = 100 if ($RUIN_prop_chances > 100); - printf( STDERR "RUIN_prop_chances = %d\n",$RUIN_prop_chances) - if ($debug == 1); - } - elsif( $arg eq '-should') - { - $arg = shift @ARGV; - $SHOULD_prop_chances = $arg; - $SHOULD_prop_chances = 0 if ($SHOULD_prop_chances < 0); - $SHOULD_prop_chances = 100 if ($SHOULD_prop_chances > 100); - printf( STDERR "SHOULD_prop_chances = %d\n",$SHOULD_prop_chances) - if ($debug == 1); - } - elsif ($arg eq '-fb') - { - $component_type = 2; - print STDERR "component_type = 2, freebusy...\n" if ($debug == 1); - } - elsif ($arg eq '-fbdh') - { - $arg = shift @ARGV; - $max_fb_dur_hrs = $arg; - $max_fb_dur_hrs = 4 if ($max_fb_dur_hrs < 1); - printf(STDERR "max_fb_dur_hrs = %d\n",$max_fb_dur_hrs) - if ($debug == 1); - } - else - { - push(@mailto, $arg); - } - } -} - -sub init -{ - srand(); - $uname = `uname -a`; - if ($uname =~ /Windows/) - { - local($h); - $date_cmd = ""; - $date_cmd = $ENV{'DATE_CMD'} if ($ENV{'DATE_CMD'} =~ /date/); - $hostname = $ENV{'COMPUTERNAME'} unless !($ENV{'COMPUTERNAME'}); - } - else - { - chop($hostname = `hostname`); - chop($domain = `domainname`); - } -} - -############################################################# -# Build an indexed array. The index is the property name, -# the value is the property value. -############################################################# -sub check_for_cgi_buttons -{ - @parms = split('&',$ENV{'QUERY_STRING'}); - # printf("

\n"); - foreach $val (@parms) - { - ($p, $v) = split('=',$val); - - #printf("%s
\n", $val); - #printf("p = %s, v = %s
\n", $p, $v); - - # this filtering is a very cheap hack - $v =~ s/(%40)/@/g; - $v =~ s/\+/ /g; - $v =~ s/%0D/\r/g; - $v =~ s/%0A/\n /g; - $vals{$p} = $v; - } - - # - # Now treat the button name just like the command line options... - # - $component_type = 2 if ( $vals{'btnFreeBusy'} eq "Random Freebusy" ) -} - -############################################################# -# Event -# The SUMMARY may exceed 80 characters. -# The end time may come before the start time. -############################################################# -sub add_event -{ - printf("%s:%s\n",&ruin_keyword("BEGIN"), &ruin_keyword("VEVENT")); - - &attach(); - &attendee(rand(10)); - &categories(); - &class(); - &comment(); - &contact(); - &created(); - &description(); - &dtstart_dtend_duration(); - &dtstamp(); - &geo(); - &last_modified(); - &location(); - &organizer(); - &priority(); - &relatedto(); - &resources(); - &recurrence(); - &sequence(); - &status(); - &summary("event"); - &transp(); - &uid(); - &url(); - &xprop(); - - printf("%s:%s\n", &ruin_keyword("END"), &ruin_keyword("VEVENT")); -} - -sub add_freebusy -{ - printf("%s:%s\n", &ruin_keyword("BEGIN"), &ruin_keyword("VFREEBUSY")); - &attendee(1) if ($itip_method eq "REPLY"); - &comment(); - &contact(); - &dtstamp(); - &freebusy(); - &request_status(); - &organizer(); - &uid(); - &url(); - printf("%s:%s\n", &ruin_keyword("END"), &ruin_keyword("VFREEBUSY")); -} - -sub attendee -{ - ($n) = @_; - local($i); - for ($i = 0; $i < $n; $i++) - { - printf( "%s", &ruin_keyword("ATTENDEE") ); - &cutype(); - &delegate(); - &member(); - &role(); - &partstat(); - &rsvp(); - &sentby(); - &common_name(); - &dir(); - &language(); - &xparam(); - printf( ":mailto:user$i\@example.com\n" ); - } -} - -sub attach -{ - printf("%s:http://www.example%d.com/",&ruin_keyword("ATTACH"),int(rand(100)) ) - if ( int(rand(100)) < $SHOULD_prop_chances); -} - -sub categories -{ - printf("%s:%s\n", &ruin_keyword("CATEGORIES"), $categories[int(rand(1 + $#categories))] ) - if ( int(rand(100)) < $SHOULD_prop_chances); -} - -sub class -{ - printf("%s:%s\n", &ruin_keyword("CLASS"), $class[int(rand(1 + $#class))] ) - if ( int(rand(100)) < $SHOULD_prop_chances); -} - -sub comment -{ - printf("%s:You are a weasel\n",&ruin_keyword("COMMENT") ) - if ( int(rand(100)) < $SHOULD_prop_chances); -} - -sub common_name -{ - if ( int(rand(100)) < $MAY_prop_chances ) - { - printf(";%s=\"%s\"", &ruin_keyword("CN"), &common_person_name()); - } -} - -sub common_person_name -{ - $cnFirst[int(rand(1 + $#cnFirst))]." ".$cnLast[int(rand(1 + $#cnLast))]; -} - -sub contact -{ - local($r) = 1 + int(rand(100)); - if ( int(rand(100)) < 5 ) - { - printf("%s",&ruin_keyword("CONTACT")); - if ( 1 <= $r && $r < 33) - { - printf(":Jim Dolittle\\, ABC Industries\\, +1-919-555-1234\n"); - } - elsif (33 <= $r && $r < 67) - { - printf(";ALTREP=\"CID=\":Jim Dolittle\\, ABC Industries\\, +1-919-555-1234\n"); - } - else - { - printf(";ALTREP=\"http://ld.example.com/pdi/jdo.vcf\":Jim Dolittle\\, ABC Industries\\, +1-919-555-1234\n"); - } - } -} - - -sub created -{ - &rand_date(&ruin_keyword("CREATED")) if ( int(rand(100)) < $SHOULD_prop_chances ); -} - -sub cutype -{ - printf( ";%s=%s",&ruin_keyword("CUTYPE"),$cutypeparm[int(rand(1 + $#cutypeparm))] ) - if (int(rand(100)) < $MAY_prop_chances); -} - -sub delegate -{ - if ( int(rand(100)) < $MAY_prop_chances ) - { - printf( ";%s=\"mailto:user%d\@example.com\"", - &ruin_keyword("DELEGATED-FROM"), int(rand(25)) ); - } - else - { - printf( ";%s=\"mailto:user%d\@example.com\"", - &ruin_keyword("DELEGATED-TO"), int(rand(25)) ); - } -} - -sub description -{ - if ( int(rand(100)) < $SHOULD_prop_chances ) - { - printf("DESCRIPTION:"); - $roll = int(rand(20)); - for ($i = 0 ; $i < $roll; $i++) - { - printf("%sThis is the description line %d\n", ($i != 0) ? " " : "", $i); - } - if (0 == $roll) - { - printf("\n"); - } - } -} - -sub dir -{ - if ( int(rand(100)) < $MAY_prop_chances ) - { - printf(";%s=\"%s\"", &ruin_keyword("DIR"), &dir_name()); - } -} - -sub dir_name -{ - "ldap://host.example.com:6666/o=eDABC%20Industries,c=3DUS??(cn=3DBJim%20Dolittle)" -} - -sub dtstamp -{ - if ($date_cmd =~ /date/) - { - $ENV{'TZ'} = "GMT0"; - printf("%s:%s", &ruin_keyword("DTSTAMP"), `$date_cmd +19%y%m%dT%H%M%SZ`); - $ENV{'TZ'} = "PST8PDT"; - } - else - { - &rand_date(&ruin_keyword("DTSTAMP")); - } -} - -sub dtstart_dtend_duration -{ - &rand_date(&ruin_keyword("DTSTART")); - - # - # 30% chance of a duration, otherwise it's dtend - # - if ( int(rand(100)) < 30 ) - { - &rand_date(&ruin_keyword("DTEND")); - } - else - { - printf("%s",&ruin_keyword("DURATION")); - printf(":P"); - local($d) = int(rand(2)); -# if ($w > 0) -# { -# printf("%dW",$d); -# } - $d = int(rand(3)); - if ($d > 0) - { - printf("%dD",$d); - } - printf("T%dH%dM%dS\n", - int(rand(40)), # hours - int(rand(70)), # minutes - int(rand(72)) - ); - } -} - -sub fbtypeparam -{ - local($fbtype,$r); - - if ( int(rand(100)) < $MAY_prop_chances ) - { - if ( int(rand(100)) < 30 ) - { - $fbtype = $fbtypeparm[int(rand(1 + $#fbtypeparm))]; - } - else - { - $r = int(rand(1000)); - $fbtype = "X-" . "$r"; - } - printf(";%s=%s", &ruin_keyword("FBTYPE"), $fbtype ); - } -} - -sub freebusy -{ - local($year,$month,$day,$hour,$min,$dur_wk,$dur_day,$dur_hr,$dur_min, - $i,$j,$count,$daycount); - #--------------------------------------------------- - # first compute DTSTART - #--------------------------------------------------- - $year = 1998; - $month = 1 + int(rand(12)); - $day = 1 + int(rand(28)); - - $dur_wk = 0; - $dur_day = 0; - $dur_hr = int(rand(24)); - $dur_min = int(rand(60)); - - printf("%s:%04d%02d%02dT%02d%02d00Z\n", - &ruin_keyword("DTSTART"), - $year, $month, $day, - $hour, $min - ); - --$hour if ($hour > 1); - - #--------------------------------------------------- - # The first busy time need not fall on DTSTART... - #--------------------------------------------------- - if ($SHOULD_prop_chances > 10) - { - # - # yea, the stuff below is a real hack... - # - $min += $dur_min + int(rand(60)); - $hour += int($min / 60); - $min %= 60; - $hour += dur_hr + int(rand(24)); - $day += int($hour / 24); - $hour %= 24; - $day += dur_day + int(rand(29)); - $month += int($day/28); - $day %= 28; - $day++; - $year += int($month / 12); - $month %= 12; - ++$month; - } - - print &ruin_keyword("FREEBUSY"); - print &fbtypeparam(); - print ":"; - # printf("%s%s:", &ruin_keyword("FREEBUSY"), &fbtypeparam() ); - $count = 1 + int(rand(10)); - $j = 0; - for ( $i= 0; $i < $count; $i++) - { - $daycount = 0; - - while ($daycount == 0 || $hour < 23) - { - $dur_hr = int(rand(8)); - $dur_min = int(rand(60)); - # printf("%s%04d%02d%02dT%02d%02d00Z/P%dW%dDT%dH%dM", - printf("%s%04d%02d%02dT%02d%02d00Z/P%dDT%dH%dM\n", - ($j == 0) ? "" : " ,", - $year, $month, $day, - $hour, $min, - # $dur_wk, - $dur_day, - $dur_hr, $dur_min - ); - ++$daycount; - $hour += int(rand(3)) + $dur_hr; - $min += int(rand(45)) + $dur_min; - $hour += int($min/60); - $min = $min % 60; - ++$j; # the number of periods printed - } - - # - # yea, the stuff below is a real hack... - # - $min += $dur_min + int(rand(60)); - $hour += int($min / 60); - $min %= 60; - $hour += dur_hr + int(rand(24)); - $hour += dur_hr + int(rand(24)); - $day += int($hour / 24); - $hour %= 24; - $day += dur_day + int(rand(29)); - --$month; - $month += int($day/28); - $day %= 28; - $day++; - $year += int($month / 12); - $month %= 12; - ++$month; - } - # printf("\n"); - printf("%s:%04d%02d%02dT%02d%02d00Z\n", - &ruin_keyword("DTEND"), - $year, $month, $day, - $hour, $min - ); -} - -sub geo -{ - printf("%s:%f,%f\n", &ruin_keyword("GEO"), rand(360), rand(360)) - if ( int(rand(100)) < $MAY_prop_chances ); -} - -sub language -{ - printf( ";%s=en",&ruin_keyword("LANGUAGE") ) - if ( int(rand(100)) < $MAY_prop_chances ); -} - -sub last_modified -{ - &rand_date(&ruin_keyword("LAST-MODIFIED")) - if ( int(rand(100)) < $MAY_prop_chances ); -} - -sub location -{ - printf("%s:Conference Room %d\n", &ruin_keyword("LOCATION"), rand(10)+1 ) - if ( int(rand(100)) < $SHOULD_prop_chances ); -} - -sub member -{ - printf( ";%s=\"mailto:group%d\@example.com\"", - &ruin_keyword("MEMBER"),int(rand(25)) ) - if ( int(rand(100)) < $MAY_prop_chances ); -} - -sub organizer -{ - if ( int(rand(100)) < $MUST_prop_chances ) - { - printf( &ruin_keyword("ORGANIZER")); - &sentby() if ( int(rand(100)) < $MAY_prop_chances ); - printf("%s", &common_name()) - if ( int(rand(100)) < $MAY_prop_chances ); - printf(";DIR=\"%s\"", &dir_name()) - if ( int(rand(100)) < $MAY_prop_chances ); - printf("%s", &language()) if ( int(rand(100)) < $MAY_prop_chances ); - printf("%s", &x_param()) if ( int(rand(100)) < $MAY_prop_chances ); - printf( ":mailto:user%d\@example.com\n",int(rand(100)) ); - } -} - -sub partstat -{ - printf( ";%s=%s",&ruin_keyword("PARTSTAT"),$partstatparm[int(rand(1 + $#partstatparm))] ) - if (int(rand(100)) < $SHOULD_prop_chances); -} - -sub priority -{ - printf("%s:%d\n", &ruin_keyword("PRIORITY"), 1 + int(rand(12))) - if (int(rand(100)) < $MAY_prop_chances); -} - -sub rand_date -{ - printf("%s:%4d%02d%02dT%02d%02d%02dZ\n", - @_, - 1998 + int(rand(3)), # yr: 1998 - 2001 - 1 + int(rand(12)), # mon: 1 - 12 - 1 + int(rand(28)), # day: 1 - 28 - int(rand(24)), # hr: 0 - 23 - int(rand(60)), # min: 0 - 59 - int(rand(60)) # sec: 0 - 59 - ); -} - -sub recurrence -{ - if ($recur != 0) - { - local($i,$roll); - if ( int(rand(100)) < 50 ) - { - printf("%s:%s\n",&ruin_keyword("RRULE"),$rrules[int(rand(1 + $#rrules))]); - } - if ( int(rand(100)) < 50 ) - { - printf("%s:%s\n",&ruin_keyword("EXRULE"),$exrules[int(rand(1 + $#exrules))]); - } - if ( int(rand(100)) < 50 ) - { - $roll = int(rand(20)); - for ($i = 0 ; $i < $roll; $i++) - { - &rand_date(&ruin_keyword("RDATE")); - } - } - if ( int(rand(100)) < 50 ) - { - $roll = int(rand(20)); - for ($i = 0 ; $i < $roll; $i++) - { - &rand_date(&ruin_keyword("EXDATE")); - } - } - } -} - -sub relatedto -{ - printf("%s:%s\n", &ruin_keyword("RELATED-TO"), &unique_id()) - if (int(rand(100)) < $MAY_prop_chances); -} - -sub request_status -{ - printf("%s:%s\n", - &ruin_keyword("REQUEST-STATUS"), - $request_codes[int(rand(1 + $#request_codes))]) - if (int(rand(100)) < $MAY_prop_chances ); -} - -sub resources -{ - printf("%s:%s\n", &ruin_keyword("RESOURCES"), $resources[int(rand($#resources))] ) - if (int(rand(100)) < $MAY_prop_chances ); -} - -sub role -{ - printf( ";%s=%s",&ruin_keyword("ROLE"), $roleparm[int(rand(1 + $#roleparm))] ) - if (int(rand(100)) < $SHOULD_prop_chances); -} - -sub rsvp -{ - printf( ";RSVP=%s", (int(rand(100)) < 50) ? "TRUE" : "FALSE") - if (int(rand(100)) < $MUST_prop_chances); -} - -sub sentby -{ - printf( ";%s=\"mailto:user%d\@example.com\"", - &ruin_keyword("SENT-BY"), int(rand(25)) ) - if ( int(rand(100)) < $MAY_prop_chances ); -} - -sub sequence -{ - printf( "%s:0\n",&ruin_keyword("SEQUENCE")); -} - -sub status -{ - printf("%s:%s\n", &ruin_keyword("STATUS"),$status[int(rand(1 + $#status))] ) - if (int(rand(100)) < $SHOULD_prop_chances ); -} - -sub summary -{ - printf("%s:This is a ",&ruin_keyword("SUMMARY")); - $roll = int(rand(15)); - for ($i = 0 ; $i < $roll; $i++) - { - printf("really "); - } - printf("stupid %s\n",@_); -} - -sub transp -{ - printf("%s:%s\n", &ruin_keyword("TRANSP"),$transparm[int(rand(1 + $#transparm))] ) - if (int(rand(100)) < $MAY_prop_chances ); -} - -sub uid -{ - printf( "%s:%s\n", &ruin_keyword("UID"),&unique_id() ) - if ( int(rand(100)) < $MUST_prop_chances ); -} - -sub unique_id -{ - local($d,$r); - if ($date_cmd =~ /date/) - { - chop($d = `$date_cmd +%y%m%d%H%M%S` ); - } - else - { - $d = rand(711771); - } - $r = int(rand(100000)); - $hostname.".".$domain.$d."$$"."$r"; -} - -sub url -{ - printf( "%s:http://cal.example.com/pub/calendar/jsmith/%s/freetime.vcs\n", - &ruin_keyword("URL"), - $cnLast[int(rand(1 + $#cnLast))] ) - if (int(rand(100)) < $MAY_prop_chances ); -} - -sub x_param -{ - $r = int(rand(1000)); - ";".&ruin_keyword("X-PARAM").$r; -} - -sub xparam -{ - printf(";%s%d=%d", &ruin_keyword("X-PARAM"), int(rand(100)), int(rand(100))) - if ( int(rand(100)) < $MAY_prop_chances ); -} - -sub xprop -{ - local($i,$n); - if (int(rand(100)) < 5 ) - { - printf("%s%d:",&ruin_keyword("X-PROP"),int(rand(100))); - $n = 1 +int(rand(20)); - for ($i = 0; $i < $n; $i++) - { - printf("blah "); - } - printf("\n"); - } -} - -sub ruin_keyword -{ - local($k) = @_; - if (1 == $bad_key_words) - { - local($i) = int(rand(100)); - $r = "QQ"; - if (int(rand(100)) < $RUIN_prop_chances) - { - if ( $i < 50 ) - { - $k .= $r; - } - else - { - $k = $r . $k; - } - } - } - - $k; -} diff --git a/mozilla/calendar/modules/test/tools/randical.html b/mozilla/calendar/modules/test/tools/randical.html deleted file mode 100644 index 7bd16efd299..00000000000 --- a/mozilla/calendar/modules/test/tools/randical.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - -

-Create A Random iCalendar Object

-You will need an M8 compile of Nova (or later) for this to work. -
-
- - -
-

-Name

- -
randical.cgi  -  a perl script to generate random -iCalendar objects
- -

-Synopsis

- -
randical.cgi [options]
- -

-Description

- -
This perl script generates random iCalendar objects. It can -be run from the command line or as a CGI script. Properties are either -required or have a certain probability of appearing in the output. - -

Command Line Options are: -
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bkwBad Key Words. Causes random characters to be inserted into keywords.
-ddebug mode. Prints a bunch of messages.
-fbGenerate random freebusy information
-fbdh hoursThe maximum number of full hours that a freebusy period can be. The -larger hours becomes, the less likely it is that there will be multiple -freebusy periods per day. The default value is 4 hours.
-may nSet probability of MAY components and properties to n, -a number from 0 to 100. The default value is 5.
-must nSet probability of MUST components and properties to n, -a number from 0 to 100. The default value is 95.
-rrandomly add recurrence properties (RRULE, EXRULE, RDATE, EXDATE). -By default, no recurrence properties are added.
-ruin nSet probability of ruining a keyword (adding some randomness to the -spelling) to n, -a number from 0 to 100. The default value is 10.
-rccadd a random number of components to the iCalendar object. By -default, only one component is added.
-should nSet probability of SHOULD components and properties to n, -a number from 0 to 100. The default value is 65.

- -Send comments and suggestions to sman. - -

-Examples

- - - - - - - - - - - - - -
Run it by hand:perl randical.cgi -r
Try it as a CGI script: -
- - -
-  -
  - - diff --git a/mozilla/calendar/modules/test/tools/rename.pl b/mozilla/calendar/modules/test/tools/rename.pl deleted file mode 100644 index 573808dca4f..00000000000 --- a/mozilla/calendar/modules/test/tools/rename.pl +++ /dev/null @@ -1,35 +0,0 @@ -#!C:/usr/local/bin/perl - -# Usage: reanme perlexpr [files] - -foreach $filename (@ARGV) -{ - $indexOfPeriod = 0; - $i = 0; - $temp = $filename; - while ($i != -1) - { - $indexOfPeriod = $i; - $i = index($temp, "."); - $temp = substr($temp, 1+index($temp, ".")); - } - - $prefix = substr($filename, 0, $indexOfPeriod); - $extension = substr($filename, 1 + $indexOfPeriod); - - $newName = "$prefix.hout"; - - rename($filename, $newName); -} - -#($op = shift) || die "Usage: rename perlexpr [filenames]\n"; -#if (!@ARGV) { -# @ARGV = ; -# chop(@ARGV); -#} -#for (@ARGV) { -# $was = $_; -# eval $op; -# die $@ if $@; -# rename($was,$_) unless $was eq $_; -#} diff --git a/mozilla/calendar/modules/test/tools/stresstest1.pl b/mozilla/calendar/modules/test/tools/stresstest1.pl deleted file mode 100644 index 0edfd9f8bf5..00000000000 --- a/mozilla/calendar/modules/test/tools/stresstest1.pl +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/sbin/perl -# -# stresstest1.pl -# -# Usage: > stresstest1.pl [-r] -# -# -r Turn on recurrence option. -# -# Calls the randical.cgi to generate a random iCal file -# Then call the itiprig to run the itiprig/stressTest.script that -# loads this file. -# -# The itiprig/stressTest.script output is put in itiprig/stressTest.tmp. -# Then this perl scripts examines itiprig/stressTest.tmp. -# It checks for a line "Loaded [0-9]+ events" in the tmp file. -# If the number in that line is 0, (the event did not load properly) -# then the script writes to a file stressTest.log noting what event caused -# the failure. Otherwise it writes OK and the number of events loaded in -# stressTest.log. -# -# This scripts makes sure the iCal Parser never breaks. -# - -if ($#ARGV + 1 > 0) { - if ($ARGV[0] eq "-r") - { - print STDOUT "Turning on recurrence option\n"; - $recurrenceOption = $ARGV[0]; - } -} - -print STDOUT "Removing old ../itiprig/stressTest.log\n"; -`rm -f ../itiprig/stressTest.log`; -while (1) -{ - #if WINDOWS - # Remove old stressTestFile.txt - `rm -f ../itiprig/stressTestFile.txt`; - - # Run the randical.cgi script and write the output to stressTestFile.txt - open(OUT, "perl randical.cgi $recurrenceOption |") || die "Can't run perl randical.cgi\n"; - open(STTSTFILE, ">>../itiprig/stressTestFile.txt") || die "Can't write to ../itiprig/stressFile.txt\n"; - $eventBuf = ""; - while($line = ) - { - print STTSTFILE $line; - $eventBuf .= $line; - } - close(OUT); - close(STTSTFILE); - - # Call the itiprig to run the stressTest.script which will try to - # load stressTestFile.txt and print out the event. - # The script output is written to stressTest.tmp. - chdir("../itiprig/winfe"); - `Debug/itiprig.exe ../stressTest.script`; - print STDOUT "Checking if event loaded correctly ..."; - - # Print the event to the log file if it failed to load properly - # Hardcoded to look for events for now. Do for looking for todos, journals - # later. - open(STTSTMPFILE, "../stressTest.tmp") || die "Can't open itiprig/stressTest.tmp\n"; - open(LOG, ">> ../stressTest.log") || die "Can't open itiprig/stressTest.log\n"; - - $loadedEvents = -1; - $events = -1; - while($line = ) - { - $loadedEvents = index($line, ": Loaded "); - $events = index($line, " events,"); - if ($loadedEvents > 0 && $events > 0) - { - $startIndex = $loadedEvents + length(": Loaded "); - $lengthNum = $events - $startIndex; - $num = substr($line, $startIndex, $lengthNum); - - if ($num eq "0") - { - print LOG "> ($num) FAILED TO LOAD EVENT\n$eventBuf\n ---------------------------\n"; - break; - print STDOUT " FAILED.\n"; - } - else - { - print LOG "> ($num) OK\n"; - print STDOUT " passed.\n"; - } - } - } - - chdir("../../tools"); - #endif #if WINDOWS -} - - diff --git a/mozilla/calendar/modules/test/tools/v2i.pl b/mozilla/calendar/modules/test/tools/v2i.pl deleted file mode 100755 index 6003c74de4e..00000000000 --- a/mozilla/calendar/modules/test/tools/v2i.pl +++ /dev/null @@ -1,115 +0,0 @@ -#! /tools/ns/bin/perl5.004 - - -# A simple VCAL to ICAL converter -# There are a few variables you can tweek. -# -# Aug 8, 1998 -# sman@netscape.com -# -# Aug 18 1998 -# jsun@netscape.com -# Converts = continue lines to folded lines -# Converts =OD=OA to \\n -# Also, had to set DTSTAMP to fixed value for Windows -# -# The DTSTAMP value is going to default to *now* -# if you want to change it, this is the place... -# -$uname = `uname -a`; -if ($uname =~ /Windows/) -{ - $DTStamp = "DTSTAMP:19980818T112233Z\n"; -} -else -{ - $DTStamp = "DTSTAMP:" . `date +19%y%m%dT%H%M%SZ`; -} - - -$ENV{'TZ'} = "GMT0"; -$ENV{'TZ'} = "PST8PDT"; - -# -# The attendees are assumed to be in first name - last name format. -# Here at netscape, we can turn this into an e-mail address by simply -# replacing the spaces with underscores and adding "@netscape.com". -# The code below assumes the naming trick. However you can change -# the mailing domain by just setting the value below. -# -$domain = "\@netscape.com"; - -$foldedLine = 0; -while (<>) -{ - #print STDERR "foldedLine = $foldedLine\n"; - - s/=0D=0A/\\n/; - if ($foldedLine == 1) - { - # insert space to fold lines - s/(.*)/ \1/; - #print $_; - } - - if (/=$/) - { - $foldedLine = 1; - s/(.*)=$/\1/; - } - else - { - $foldedLine = 0; - } - - if (/^VERSION:1.0$/) - { - print "VERSION:2.0\n"; - } - elsif (/^PRODID:/) - { - print "PRODID:-//Netscape/Julian/whizbang-VCAL2ICAL/EN\n"; - } - elsif (/^DTSTART:/) - { - print $DTStamp; - print $_; - } - elsif (/^ATTENDEE/) - { - if (/ROLE=OWNER/) - { - $temp = $_; - s/ROLE=OWNER/ROLE=REQ-PARTICIPANT/; - $temp =~ s/ATTENDEE/ORGANIZER/; - $temp =~ s/;ROLE=OWNER//; - $temp =~ s/;STATUS=CONFIRMED//; - $temp =~ s/:([^ ]+) (.*)/:mailto:\1_\2$domain/; - print $temp; - } - s/ROLE=ATTENDEE/ROLE=REQ-PARTICIPANT/ ; - s/ROLE=OWNER/ROLE=REQ-PARTICIPANT/ ; - s/NEEDS ACTION/NEEDS-ACTION/ ; - s/STATUS/PARTSTAT/ ; - s/CONFIRMED/ACCEPTED/ ; - s/:([^ ]+) (.*)/:mailto:\1_\2$domain/; - print $_; - } - else - { - print $_; - } - -} - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/test/tools/wwwget.pl b/mozilla/calendar/modules/test/tools/wwwget.pl deleted file mode 100755 index 1177588d279..00000000000 --- a/mozilla/calendar/modules/test/tools/wwwget.pl +++ /dev/null @@ -1,86 +0,0 @@ -#! /tools/ns/bin/perl5.004 - -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (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.org 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. -# -# Contributor(s): - -###################################################################### -# -# This is a simple HTTP command-line getter program. You simply give -# it the URL where you want it to get things, and it goes off and -# reads the information. There are several flags that can be used to -# control what is done with the output. -# -# Usage: -# wwwget -# -# Example: -# wwwget www.infoseek.com /index.html - - -# Steve Mansour -# sman@netscape.com -# Aug 27, 1998 - -use Socket; - -die "Usage:\n$0 host page\n" if $#ARGV <1; - - -print "Content-type: text/html\n\n"; -print &GetHTTP($ARGV[0],$ARGV[1]); -exit 0; - -sub GetHTTP -{ - my($remote,$doc) = @_; - - my ($port, $iaddr, $paddr, $proto, $line); - - $port = 80; - if ($port =~ /\D/) - { $port = getservbyname($port, 'tcp') } - die "No port" unless $port; - $iaddr = inet_aton($remote) || die "no host: $remote"; - $paddr = sockaddr_in($port, $iaddr); - - $proto = getprotobyname('tcp'); - socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; - connect(SOCK, $paddr) || die "connect: $!"; - - select(SOCK); $| = 1; select(STDOUT); - - ########################### - # Ask for the data... - ########################### - print SOCK "GET $doc HTTP/1.0\n\n"; - - ############################## - # skip over the meta data... - ############################## - do { - $line = - } until ($line =~ /^\r\n/); - - ############################## - # gobble up the output... - ############################## - @output = ; - close (SOCK) || die "close: $!"; - @output; -} diff --git a/mozilla/calendar/modules/ui/Makefile b/mozilla/calendar/modules/ui/Makefile deleted file mode 100644 index 30edd04901f..00000000000 --- a/mozilla/calendar/modules/ui/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - - diff --git a/mozilla/calendar/modules/ui/canvas/Makefile b/mozilla/calendar/modules/ui/canvas/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/canvas/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/canvas/inc/Makefile b/mozilla/calendar/modules/ui/canvas/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/canvas/inc/events.h b/mozilla/calendar/modules/ui/canvas/inc/events.h deleted file mode 100644 index f8b92d950a3..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/events.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _CMINICAL_EVENTS -#define _CMINICAL_EVENTS - -class CMouseEvent -{ -public: - enum Type { MOUSEMOVE, MOUSEDOWN, MOUSEUP, MOUSECLICK, MOUSEDRAG }; - enum Modifiers { SHIFT, CTRL, ALT, META }; - -protected: - int m_iX; - int m_iY; - int m_iModifiers; // a logical or of all applicable Modifiers - Type m_eType; - int m_iButton; // 0 = n/a, 1 = left, 2 = middle, 3 = right, ... - -public: - CMouseEvent( int iX, int iY, Type t, int iBtn, int iMod ); - virtual ~CMouseEvent(); - inline int GetX() { return m_iX; } - inline int GetY() { return m_iY; } - inline void SetButton(int i) { m_iButton = i; } - inline void SetModifiers(int i) { m_iModifiers = i; } - inline int GetButton() { return m_iButton; } - inline int GetModifiers() { return m_iModifiers; } - inline Type GetType() { return m_eType; } - inline void SetShift() { m_iModifiers |= (1 << (int)SHIFT); } - inline int GetShift() { return m_iModifiers & (1 << (int)SHIFT); } - inline void SetCtrl() { m_iModifiers |= (1 << (int)CTRL); } - inline int GetCtrl() { return m_iModifiers & (1 << (int)CTRL); } - -}; - - -#include -class CMiniCalEvent : public CMouseEvent -{ - -public: - enum Action { MNOTHING, MDATE, MDOW, MWEEK, MLEFTARROW, MRIGHTARROW }; - CMiniCalEvent(int iX, int iY, Type t, int iBtn, int iMod); - virtual ~CMiniCalEvent(); - inline CMiniCalEvent::Action GetAction() {return m_eAction;} - inline void SetAction(CMiniCalEvent::Action e) {m_eAction = e;} - inline int GetDOW() {return m_iDOW;} - inline void SetDOW(int i) {m_iDOW = i;} - inline DateTime GetDate() {return m_DT;} - inline void SetDate(DateTime d) {m_DT = d;} - inline int GetWeekOffset() {return m_iWeekOffset;} - inline void SetWeekOffset(int i) {m_iWeekOffset = i;} - - -protected: - Action m_eAction; - int m_iDOW; // valid when eAction is MDOW - int m_iWeekOffset; // valid when eAction is MWEEK - DateTime m_DT; // valid when eAction is DATE -}; - -#endif /* _CMINICAL_EVENTS */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/manifest.mn b/mozilla/calendar/modules/ui/canvas/inc/manifest.mn deleted file mode 100644 index e825a851dcb..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/manifest.mn +++ /dev/null @@ -1,36 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsCalTimebarCanvas.h \ - nsCalStatusCanvas.h \ - nsCalCommandCanvas.h \ - nsCalTimebarComponentCanvas.h \ - nsCalTodoComponentCanvas.h \ - nsCalTimebarHeading.h \ - nsCalTimebarUserHeading.h \ - nsCalTimebarTimeHeading.h \ - nsCalTimebarScale.h \ - nsCalMultiDayViewCanvas.h \ - nsCalMultiViewCanvas.h \ - nsCalMultiUserViewCanvas.h \ - nsCalCanvas.h \ - nsCalDayViewCanvas.h \ - nsCalMonthViewCanvas.h \ - events.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalCanvas.h deleted file mode 100644 index 3a09d23e62e..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalCanvas.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalCanvas_h___ -#define nsCalCanvas_h___ - -#include "nsXPFCCanvas.h" -#include "nsICalendarUser.h" - -class nsCalCanvas : public nsXPFCCanvas - -{ -public: - nsCalCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - NS_IMETHOD GetUser(nsICalendarUser *& aUser); - NS_IMETHOD SetUser(nsICalendarUser * aUser); - - NS_IMETHOD_(nsIModel *) GetModel(); - NS_IMETHOD GetModelInterface(const nsIID &aModelIID, nsISupports * aInterface) ; - NS_IMETHOD SetModel(nsIModel * aModel); - NS_IMETHOD_(nsEventStatus) Action(nsIXPFCCommand * aCommand); - -protected: - ~nsCalCanvas(); - -protected: - nsICalendarUser * mUser; - -}; - -#endif /* nsCalCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalCommandCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalCommandCanvas.h deleted file mode 100644 index f7dc3f01edc..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalCommandCanvas.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalCommandCanvas_h___ -#define nsCalCommandCanvas_h___ - -#include "nsXPFCCanvas.h" - -#include "nsIView.h" -#include "nsIWidget.h" -#include "nsITextWidget.h" -#include "nsIXPFCSubject.h" - -class nsCalCommandCanvas : public nsXPFCCanvas, - public nsIXPFCSubject - -{ -public: - nsCalCommandCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD SetBounds(const nsRect& aBounds); - - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent); - NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD_(nsEventStatus) OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight); - - NS_IMETHOD GetClassPreferredSize(nsSize& aSize); - - // nsIXPFCSubject methods - NS_IMETHOD Attach(nsIXPFCObserver * aObserver); - NS_IMETHOD Detach(nsIXPFCObserver * aObserver); - NS_IMETHOD Notify(nsIXPFCCommand * aCommand); - -protected: - ~nsCalCommandCanvas(); - -public: - NS_IMETHOD SendCommand(nsString& aCommand, nsString& aReply); - - -private: - nsIView * mTextField; - nsIView * mStaticTextField; - - -}; - -#endif /* nsCalCommandCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalDayViewCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalDayViewCanvas.h deleted file mode 100644 index f9ac7f725b7..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalDayViewCanvas.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalDayViewCanvas_h___ -#define nsCalDayViewCanvas_h___ - -#include "nsCalTimebarComponentCanvas.h" - -class nsCalDayViewCanvas : public nsCalTimebarComponentCanvas -{ - -public: - nsCalDayViewCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD_(nsEventStatus) PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD_(nsEventStatus) PaintBorder(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - - -protected: - ~nsCalDayViewCanvas(); - - NS_IMETHOD PaintInterval(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - PRUint32 aIndex, - PRUint32 aStart, - PRUint32 aSpace, - PRUint32 aMinorInterval); - - -}; - -#endif /* nsCalDayViewCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalMonthViewCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalMonthViewCanvas.h deleted file mode 100644 index 6cd75ffbe94..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalMonthViewCanvas.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalMonthViewCanvas_h___ -#define nsCalMonthViewCanvas_h___ - -#include "nsCalTimebarComponentCanvas.h" -#include "nsVoidArray.h" - -class nsCalMonthViewCanvas : public nsCalTimebarComponentCanvas -{ - -public: - nsCalMonthViewCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - NS_IMETHOD_(nsEventStatus) PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD_(nsEventStatus) PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD_(nsEventStatus) PaintBorder(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - - -protected: - ~nsCalMonthViewCanvas(); - -private: - NS_IMETHOD_(nsEventStatus) PaintCellBackground( PRUint32& aCellRow, PRUint32& aCellColumn, - PRUint32& aCellDate, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - - NS_IMETHOD CacheCellData(PRUint32& aCellRow, PRUint32& aCellColumn, PRUint32& aCellDate); - NS_IMETHOD CellFromDate(PRUint32& aCellDate, PRUint32& aCellRow, PRUint32& aCellColumn); - NS_IMETHOD GetCellBounds(PRUint32& aCellRow, PRUint32& aCellColumn, nsRect& aBounds); - -private: - PRUint32 mNumColumns; - PRUint32 mNumRows; - nsVoidArray * mArrayRows; - nsVoidArray * mArrayColumns; - - -}; - -#endif /* nsCalMonthViewCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiDayViewCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiDayViewCanvas.h deleted file mode 100644 index 89c1d578438..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiDayViewCanvas.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalMultiDayViewCanvas_h___ -#define nsCalMultiDayViewCanvas_h___ - -#include "nsCalMultiViewCanvas.h" -#include "nsCalTimebarComponentCanvas.h" -#include "nsCalTimebarCanvas.h" -#include "nsDateTime.h" -#include "nsBoxLayout.h" - -class nsCalMultiDayViewCanvas : public nsCalMultiViewCanvas -{ - -public: - nsCalMultiDayViewCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD_(nsEventStatus) PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - - NS_IMETHOD_(nsIXPFCCanvas*) AddDayViewCanvas(); - NS_IMETHOD_(PRUint32) GetNumberViewableDays(); - NS_IMETHOD SetNumberViewableDays(PRUint32 aNumberViewableDays); - - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - NS_IMETHOD SetTimeContext(nsICalTimeContext * aContext); - - // nsIXPFCCommandReceiver methods - NS_IMETHOD_(nsEventStatus) Action(nsIXPFCCommand * aCommand); - - NS_IMETHOD SetMultiDayLayout(nsLayoutAlignment aLayoutAlignment); - -protected: - ~nsCalMultiDayViewCanvas(); - -private: - PRUint32 mNumberViewableDays; - PRUint32 mMaxRepeat; - PRUint32 mMinRepeat; - -}; - -#endif /* nsCalMultiDayViewCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiUserViewCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiUserViewCanvas.h deleted file mode 100644 index 6f43f643029..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiUserViewCanvas.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalMultiUserViewCanvas_h___ -#define nsCalMultiUserViewCanvas_h___ - -#include "nsCalMultiViewCanvas.h" -#include "nsCalTimebarCanvas.h" -#include "nsDateTime.h" -#include "nsIModel.h" -#include "nsBoxLayout.h" - -class nsCalMultiUserViewCanvas : public nsCalMultiViewCanvas -{ - -public: - nsCalMultiUserViewCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - NS_IMETHOD SetTimeContext(nsICalTimeContext * aContext); - - // nsIXPFCCommandReceiver methods - NS_IMETHOD_(nsEventStatus) Action(nsIXPFCCommand * aCommand); - -protected: - ~nsCalMultiUserViewCanvas(); - -private: - NS_IMETHOD AddMultiDayView(nsIModel * aModel); - NS_IMETHOD SetMultiUserLayout(nsLayoutAlignment aLayoutAlignment); - - -}; - -#endif /* nsCalMultiUserViewCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiViewCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiViewCanvas.h deleted file mode 100644 index 66e99d23400..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiViewCanvas.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalMultiViewCanvas_h___ -#define nsCalMultiViewCanvas_h___ - -#include "nsCalTimebarComponentCanvas.h" -#include "nsCalTimebarCanvas.h" -#include "nsDateTime.h" - -class nsCalMultiViewCanvas : public nsCalTimebarComponentCanvas -{ - -public: - nsCalMultiViewCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - NS_IMETHOD SetShowHeaders(PRBool aShowHeaders); - NS_IMETHOD_(PRBool) GetShowHeaders(); - - NS_IMETHOD SetShowStatus(PRBool aShowHeaders); - NS_IMETHOD_(PRBool) GetShowStatus(); - - NS_IMETHOD SetShowTimeScale(PRBool aShowTimeScale); - NS_IMETHOD_(PRBool) GetShowTimeScale(); - - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - NS_IMETHOD_(nsEventStatus) Action(nsIXPFCCommand * aCommand); - - NS_IMETHOD_(nsEventStatus) PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - -protected: - ~nsCalMultiViewCanvas(); - -private: - PRBool mShowHeaders; - PRBool mShowStatus; - PRBool mShowTimeScale; - -}; - -#endif /* nsCalMultiViewCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalStatusCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalStatusCanvas.h deleted file mode 100644 index 59ff46fbc0c..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalStatusCanvas.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalStatusCanvas_h___ -#define nsCalStatusCanvas_h___ - -#include "nsXPFCCanvas.h" - -class nsCalStatusCanvas : public nsXPFCCanvas - -{ -public: - nsCalStatusCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - -protected: - ~nsCalStatusCanvas(); - -}; - -#endif /* nsCalStatusCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarCanvas.h deleted file mode 100644 index 7e346d189a9..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarCanvas.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTimebarCanvas_h___ -#define nsCalTimebarCanvas_h___ - -#define INSET 2 - -#include "nsXPFCCanvas.h" -#include "nsICalTimeContext.h" -#include "nsCalCanvas.h" -#include "nsDateTime.h" - -class nsCalTimebarCanvas : public nsCalCanvas - -{ -public: - nsCalTimebarCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - NS_IMETHOD_(nsICalTimeContext *) GetTimeContext(); - NS_IMETHOD SetTimeContext(nsICalTimeContext * aContext); - NS_IMETHOD_(PRUint32) GetVisibleMajorIntervals(); - NS_IMETHOD_(PRUint32) GetVisibleMinorIntervals(); - - NS_IMETHOD_(nsEventStatus) PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - - NS_IMETHOD SetChildTimeContext(nsCalTimebarCanvas * aCanvas, - nsICalTimeContext * aContext, - PRUint32 increment); - NS_IMETHOD ChangeChildDateTime(nsCalTimebarCanvas * aCanvas, - nsDateTime * aDateTime); - NS_IMETHOD ChangeChildDateTime(PRUint32 aIndex, nsDateTime * aDateTime); - - -protected: - - NS_IMETHOD PaintInterval(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - PRUint32 aIndex, - PRUint32 aStart, - PRUint32 aSpace, - PRUint32 aMinorInterval); - -protected: - ~nsCalTimebarCanvas(); - -// XXX: This needs to be multiply aggregated, I think. -private: - nsICalTimeContext * mTimeContext; - - -}; - -#endif /* nsCalTimebarCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarComponentCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarComponentCanvas.h deleted file mode 100644 index d0eb2bbf97c..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarComponentCanvas.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTimebarComponentCanvas_h___ -#define nsCalTimebarComponentCanvas_h___ - -#include "nsCalTimebarCanvas.h" - -class nsCalTimebarComponentCanvas : public nsCalTimebarCanvas - -{ -public: - nsCalTimebarComponentCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - -protected: - ~nsCalTimebarComponentCanvas(); - -protected: - nscolor mComponentColor; - -}; - -#endif /* nsCalTimebarComponentCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarHeading.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarHeading.h deleted file mode 100644 index 01b80af8ea0..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarHeading.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTimebarHeading_h___ -#define nsCalTimebarHeading_h___ - -#include "nsCalTimebarCanvas.h" - -class nsCalTimebarHeading : public nsCalTimebarCanvas - -{ -public: - nsCalTimebarHeading(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD_(nsEventStatus) PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - NS_IMETHOD GetClassPreferredSize(nsSize& aSize); - -protected: - ~nsCalTimebarHeading(); - -}; - -#endif /* nsCalTimebarHeading_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarScale.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarScale.h deleted file mode 100644 index 0ed5935911c..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarScale.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTimebarScale_h___ -#define nsCalTimebarScale_h___ - -#include "nsCalTimebarCanvas.h" - -class nsCalTimebarScale : public nsCalTimebarCanvas - -{ -public: - nsCalTimebarScale(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD_(nsEventStatus) PaintBorder(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - NS_IMETHOD GetClassPreferredSize(nsSize& aSize); - -protected: - - NS_IMETHOD PaintInterval(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - PRUint32 aIndex, - PRUint32 aStart, - PRUint32 aSpace, - PRUint32 aMinorInterval); - - NS_IMETHOD DrawTime(nsIRenderingContext& aContext, - nsRect& aRect, - PRUint32 aIndex); - - -protected: - ~nsCalTimebarScale(); - -}; - -#endif /* nsCalTimebarScale_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarTimeHeading.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarTimeHeading.h deleted file mode 100644 index cee69896045..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarTimeHeading.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTimebarTimeHeading_h___ -#define nsCalTimebarTimeHeading_h___ - -#include "nsCalTimebarHeading.h" - -class nsCalTimebarTimeHeading : public nsCalTimebarHeading - -{ -public: - nsCalTimebarTimeHeading(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD_(nsEventStatus) PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD_(nsEventStatus) PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - -protected: - ~nsCalTimebarTimeHeading(); - -}; - -#endif /* nsCalTimebarTimeHeading_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarUserHeading.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarUserHeading.h deleted file mode 100644 index 84feeae8a21..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalTimebarUserHeading.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTimebarUserHeading_h___ -#define nsCalTimebarUserHeading_h___ - -#include "nsCalTimebarHeading.h" -#include "nsString.h" - -class nsCalTimebarUserHeading : public nsCalTimebarHeading - -{ -public: - nsCalTimebarUserHeading(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD_(nsEventStatus) PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - - NS_IMETHOD_(nsString&) GetUserName(); - NS_IMETHOD SetUserName(nsString& aString); - NS_IMETHOD GetClassPreferredSize(nsSize& aSize); - - -protected: - ~nsCalTimebarUserHeading(); - -private: - nsString mUserName; - -}; - -#endif /* nsCalTimebarUserHeading_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalTodoComponentCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalTodoComponentCanvas.h deleted file mode 100644 index 60ef6474a50..00000000000 --- a/mozilla/calendar/modules/ui/canvas/inc/nsCalTodoComponentCanvas.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTodoComponentCanvas_h___ -#define nsCalTodoComponentCanvas_h___ - -#include "nsCalTimebarComponentCanvas.h" -#include "nsIWidget.h" -#include "nsIListWidget.h" - -class nsCalTodoComponentCanvas : public nsCalTimebarComponentCanvas -{ - -public: - nsCalTodoComponentCanvas(nsISupports* outer); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - NS_IMETHOD SetBounds(const nsRect& aBounds); - NS_IMETHOD_(void) SetBackgroundColor(const nscolor &aColor) ; - NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent); - -protected: - ~nsCalTodoComponentCanvas(); - -}; - -#endif /* nsCalTodoComponentCanvas_h___ */ diff --git a/mozilla/calendar/modules/ui/canvas/manifest.mn b/mozilla/calendar/modules/ui/canvas/manifest.mn deleted file mode 100644 index 364aaa1bd7f..00000000000 --- a/mozilla/calendar/modules/ui/canvas/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/ui/canvas/src/Makefile b/mozilla/calendar/modules/ui/canvas/src/Makefile deleted file mode 100644 index ea3f7f6ed86..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - diff --git a/mozilla/calendar/modules/ui/canvas/src/config.mk b/mozilla/calendar/modules/ui/canvas/src/config.mk deleted file mode 100644 index 4808aa54560..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/config.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include - -LIBRARY_NAME = canvas -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) diff --git a/mozilla/calendar/modules/ui/canvas/src/events.cpp b/mozilla/calendar/modules/ui/canvas/src/events.cpp deleted file mode 100644 index eaf7bf48b44..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/events.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "jdefines.h" -#include "events.h" - -/* - * TODO: Get rid of this class! Use the standars nsGUIEvent for GUI events - * and create a separate event class for calendaring and controllers - */ - -CMouseEvent::CMouseEvent( int iX, int iY, CMouseEvent::Type t, int iBtn, int iMod ) -{ - m_iX = iX; - m_iY = iY; - m_iModifiers = iMod; - m_iButton = iBtn; - m_eType = t; -} - -CMouseEvent::~CMouseEvent() -{ -} - -CMiniCalEvent::CMiniCalEvent( int iX, int iY, CMouseEvent::Type t, int iBtn, int iMod ) : CMouseEvent( iX,iY,t, iBtn, iMod ) -{ - m_eAction = MNOTHING; - m_iDOW = 0; - m_iWeekOffset = 0; -} - -CMiniCalEvent::~CMiniCalEvent() -{ -} diff --git a/mozilla/calendar/modules/ui/canvas/src/manifest.mn b/mozilla/calendar/modules/ui/canvas/src/manifest.mn deleted file mode 100644 index f85bad7339b..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/manifest.mn +++ /dev/null @@ -1,40 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalTimebarCanvas.cpp \ - nsCalStatusCanvas.cpp \ - nsCalCommandCanvas.cpp \ - nsCalTimebarComponentCanvas.cpp \ - nsCalTodoComponentCanvas.cpp \ - nsCalTimebarHeading.cpp \ - nsCalTimebarUserHeading.cpp \ - nsCalTimebarTimeHeading.cpp \ - nsCalTimebarScale.cpp \ - nsCalMultiDayViewCanvas.cpp \ - nsCalMultiUserViewCanvas.cpp \ - nsCalMultiViewCanvas.cpp \ - nsCalDayViewCanvas.cpp \ - nsCalMonthViewCanvas.cpp \ - nsCalCanvas.cpp \ - events.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls shell xpfc - diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalCanvas.cpp deleted file mode 100644 index 6b239b90edb..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalCanvas.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalCanvas.h" -#include "nsCalUICIID.h" -#include "nsXPFCModelUpdateCommand.h" -#include "nsXPFCToolkit.h" -#include "nsIXPFCObserverManager.h" -#include "nsIServiceManager.h" -#include "nsIXPFCObserver.h" -#include "nsIXPFCSubject.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalCanvasCID, NS_CAL_CANVAS_CID); -static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); -static NS_DEFINE_IID(kIXPFCObserverManagerIID, NS_IXPFC_OBSERVERMANAGER_IID); -static NS_DEFINE_IID(kCXPFCObserverIID, NS_IXPFC_OBSERVER_IID); -static NS_DEFINE_IID(kCXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); - -nsCalCanvas :: nsCalCanvas(nsISupports* outer) : nsXPFCCanvas(outer) -{ - NS_INIT_REFCNT(); - mUser = nsnull; -} - -nsCalCanvas :: ~nsCalCanvas() -{ - nsIXPFCObserverManager* om; - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - - nsIXPFCObserver * observer = (nsIXPFCObserver *) this; - - om->UnregisterObserver(observer); - - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - NS_IF_RELEASE(mUser); -} - -nsresult nsCalCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) (nsCalCanvas *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalCanvas) -NS_IMPL_RELEASE(nsCalCanvas) - -nsresult nsCalCanvas :: Init() -{ - return (nsXPFCCanvas::Init()); -} - -nsresult nsCalCanvas :: GetUser(nsICalendarUser *& aUser) -{ - aUser = mUser; - return NS_OK; -} - -nsresult nsCalCanvas :: SetUser(nsICalendarUser * aUser) -{ - mUser = aUser; - return NS_OK; -} - - -nsIModel * nsCalCanvas :: GetModel() -{ - return (nsXPFCCanvas::GetModel()); -} - -nsresult nsCalCanvas :: GetModelInterface(const nsIID &aModelIID, nsISupports * aInterface) -{ - return (nsXPFCCanvas::GetModelInterface(aModelIID,aInterface)); -} - - -nsresult nsCalCanvas :: SetModel(nsIModel * aModel) -{ - return (nsXPFCCanvas::SetModel(aModel)); -} - -nsEventStatus nsCalCanvas::Action(nsIXPFCCommand * aCommand) -{ - nsresult res; - - nsXPFCModelUpdateCommand * command = nsnull; - static NS_DEFINE_IID(kModelUpdateCommandCID, NS_XPFC_MODELUPDATE_COMMAND_CID); - - res = aCommand->QueryInterface(kModelUpdateCommandCID,(void**)&command); - - /* - * On a ModelUpdate Command, just repaint ourselves.... - */ - - if ((NS_OK == res) && (GetView() != nsnull)) - { - nsRect bounds; - - GetView()->GetBounds(bounds); - - gXPFCToolkit->GetViewManager()->UpdateView(GetView(), - bounds, - NS_VMREFRESH_AUTO_DOUBLE_BUFFER | NS_VMREFRESH_NO_SYNC); - - NS_RELEASE(command); - } - - return (nsXPFCCanvas::Action(aCommand)); -} - diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalCommandCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalCommandCanvas.cpp deleted file mode 100644 index 1d90a4ff268..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalCommandCanvas.cpp +++ /dev/null @@ -1,410 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalCommandCanvas.h" -#include "nsCalUICIID.h" -#include "nsITextWidget.h" -#include "nsWidgetsCID.h" -#include "nsCalToolkit.h" -#include "nsXPFCMethodInvokerCommand.h" -#include "nsIXPFCObserver.h" - -#include "nsIDeviceContext.h" -#include "nsFont.h" -#include "nsIFontMetrics.h" -#include "nsViewsCID.h" -#include "nsIViewManager.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalCommandCanvasCID, NS_CAL_COMMANDCANVAS_CID); -static NS_DEFINE_IID(kITextWidgetIID, NS_ITEXTWIDGET_IID); -static NS_DEFINE_IID(kCTextFieldCID, NS_TEXTFIELD_CID); -static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); - -#define kNotFound -1 - -#define DEFAULT_WIDTH 25 -#define DEFAULT_HEIGHT 25 - -nsCalCommandCanvas :: nsCalCommandCanvas(nsISupports* outer) : nsXPFCCanvas(outer) -{ - NS_INIT_REFCNT(); - mStaticTextField = nsnull; - mTextField = nsnull; -} - -nsCalCommandCanvas :: ~nsCalCommandCanvas() -{ - - gXPFCToolkit->GetCanvasManager()->Unregister(this); - - if (mStaticTextField != nsnull) - mStaticTextField->Destroy(); - - if (mTextField != nsnull) - mTextField->Destroy(); -} - -nsresult nsCalCommandCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); - static NS_DEFINE_IID(kClassIID, kCalCommandCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) (nsCalCommandCanvas *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kXPFCSubjectIID)) { - *aInstancePtr = (void*) (nsIXPFCSubject *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalCommandCanvas) -NS_IMPL_RELEASE(nsCalCommandCanvas) - -nsresult nsCalCommandCanvas :: Init() -{ - nsRect rect; - nsresult res = NS_OK; - - GetBounds(rect); - - /* - * Static Field with read-only string - */ - - nsString text("COMMAND: "); - - static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID); - static NS_DEFINE_IID(kViewCID, NS_VIEW_CID); - - res = nsRepository::CreateInstance(kViewCID, - nsnull, - kIViewIID, - (void**)&mStaticTextField); - - if (NS_OK != res) - return res; - - gXPFCToolkit->GetCanvasManager()->RegisterView((nsIXPFCCanvas*)this,mStaticTextField); - - mStaticTextField->Init(gXPFCToolkit->GetViewManager(), - rect, - GetParent()->GetView(), - &kCTextFieldCID); - - - nsIWidget * widget = nsnull; - - mStaticTextField->GetWidget(widget); - - PRBool old; - - nsITextWidget * text_widget = nsnull; - - res = widget->QueryInterface(kITextWidgetIID,(void**)&text_widget); - - text_widget->SetReadOnly(PR_TRUE,old); - - PRUint32 length; - - text_widget->SetText(text,length); - - NS_RELEASE(widget); - NS_RELEASE(text_widget); - - /* - * Writeable Command field - */ - - res = nsRepository::CreateInstance(kViewCID, - nsnull, - kIViewIID, - (void**)&mTextField); - - if (NS_OK != res) - return res; - - gXPFCToolkit->GetCanvasManager()->RegisterView((nsIXPFCCanvas*)this,mTextField); - - widget = nsnull; - - mTextField->GetWidget(widget); - - mTextField->Init(gXPFCToolkit->GetViewManager(), - rect, - GetParent()->GetView(), - &kCTextFieldCID); - - text = "TimebarScale setbackgroundcolor #FF0000"; - mTextField->GetWidget(widget); - res = widget->QueryInterface(kITextWidgetIID,(void**)&text_widget); - text_widget->SetText(text,length); - NS_RELEASE(widget); - NS_RELEASE(text_widget); - - return NS_OK; -} - -nsEventStatus nsCalCommandCanvas :: OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) -{ - nsRect rect(aX, aY, aWidth, aHeight); - SetBounds(rect); - return (nsXPFCCanvas::OnResize(aX, aY, aWidth, aHeight)); -} - -nsresult nsCalCommandCanvas :: SetBounds(const nsRect &aBounds) -{ - nsXPFCCanvas::SetBounds(aBounds); - - nsRect rect = aBounds; - nscoord width = 0; - - if (mStaticTextField) { - - nsString text("COMMAND: "); - - nsFont font("Times", NS_FONT_STYLE_NORMAL, - NS_FONT_VARIANT_NORMAL, - NS_FONT_WEIGHT_BOLD, - 0, - 8); - - nsIFontMetrics * fm ; - nsIDeviceContext * ctx; - - gXPFCToolkit->GetViewManager()->GetDeviceContext(ctx); - - ctx->GetMetricsFor(font,fm); - - nsIRenderingContext * aRC; - - ctx->CreateRenderingContext(mStaticTextField, aRC); - - aRC->SetFont(font); - - aRC->GetWidth(text,width); - - NS_RELEASE(aRC); - NS_RELEASE(ctx); - - rect.width = width ; - - gXPFCToolkit->GetViewManager()->MoveViewTo(mStaticTextField, rect.x, rect.y); - gXPFCToolkit->GetViewManager()->ResizeView(mStaticTextField, rect.width, rect.height); - gXPFCToolkit->GetViewManager()->UpdateView(mStaticTextField, rect, NS_VMREFRESH_AUTO_DOUBLE_BUFFER | NS_VMREFRESH_NO_SYNC) ; - - } - - if (mTextField) { - - rect = aBounds; - - rect.x += (width); - rect.width = aBounds.width - (width); - - gXPFCToolkit->GetViewManager()->MoveViewTo(mTextField, rect.x, rect.y); - gXPFCToolkit->GetViewManager()->ResizeView(mTextField, rect.width, rect.height); - gXPFCToolkit->GetViewManager()->UpdateView(mTextField, rect, NS_VMREFRESH_AUTO_DOUBLE_BUFFER | NS_VMREFRESH_NO_SYNC) ; - - } - - return NS_OK; -} - - -nsEventStatus nsCalCommandCanvas :: OnPaint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - return nsEventStatus_eConsumeNoDefault; -} - -nsEventStatus nsCalCommandCanvas :: HandleEvent(nsGUIEvent *aEvent) -{ - switch (aEvent->message) - { - case NS_KEY_UP: - - if (NS_VK_RETURN == ((nsKeyEvent*)aEvent)->keyCode) - { - nsString text,reply; - nsITextWidget * text_widget = nsnull; - - nsresult res = aEvent->widget->QueryInterface(kITextWidgetIID,(void**)&text_widget); - - if (res != NS_OK) - return nsEventStatus_eIgnore; - - PRUint32 length; - - text_widget->GetText(text, 1000, length); - - SendCommand(text,reply); - - NS_RELEASE(text_widget); - } - break; - } - return (nsEventStatus_eIgnore); -} - -/* - * The format of the string is: - * - * "CanvasName MethodName [Parameter1 Parameter2 .... ParameterN]" - */ - -nsresult nsCalCommandCanvas :: SendCommand(nsString& aCommand, nsString& aReply) -{ - - /* - * Extract the CanvasName, method and params out - */ - - nsString name, method, param; - - aCommand.Trim(" \r\n\t"); - - PRInt32 offset = aCommand.Find(' '); - - if (offset == kNotFound) - return NS_OK; - - aCommand.Left(name,offset); - aCommand.Cut(0,offset); - aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE); - - offset = aCommand.Find(' '); - - if (offset == kNotFound) - { - method = aCommand; - param = ""; - } else - { - aCommand.Left(method,offset); - aCommand.Cut(0,offset); - aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE); - - param = aCommand; - } - - /* - * Fint the canvas by this name - */ - - nsIXPFCCanvas * root = nsnull; - nsIXPFCCanvas * canvas = nsnull; - - gXPFCToolkit->GetRootCanvas(&root); - - canvas = root->CanvasFromName(name); - - NS_RELEASE(root); - - if (canvas == nsnull) - return NS_OK; - - /* - * Send this command directly to the the canvas. - */ - - static NS_DEFINE_IID(kCXPFCMethodInvokerCommandCID, NS_XPFC_METHODINVOKER_COMMAND_CID); - static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); - static NS_DEFINE_IID(kCXPFCObserverIID, NS_IXPFC_OBSERVER_IID); - static NS_DEFINE_IID(kCXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); - - nsXPFCMethodInvokerCommand * command; - - nsresult res = nsRepository::CreateInstance(kCXPFCMethodInvokerCommandCID, - nsnull, - kXPFCCommandIID, - (void **)&command); - - if (NS_OK != res) - return res ; - - command->Init(); - - command->mMethod = method; - command->mParams = param; - - /* - * Pass this Command onto the Observer interface of the target canvas directly. - * There is no need to go through the ObserverManager since we have the - * necessary info - */ - - nsIXPFCObserver * observer = nsnull; - nsIXPFCSubject * subject = nsnull; - - res = canvas->QueryInterface(kCXPFCObserverIID, (void **)&observer); - if (res == NS_OK) - res = QueryInterface(kCXPFCSubjectIID, (void **)&subject); - - if (res == NS_OK) - observer->Update(subject,command); - - aReply = command->mReply; - - NS_IF_RELEASE(command); - NS_IF_RELEASE(observer); - NS_IF_RELEASE(subject); - - return NS_OK; -} - -nsresult nsCalCommandCanvas::Attach(nsIXPFCObserver * aObserver) -{ - return NS_OK; -} - -nsresult nsCalCommandCanvas::Detach(nsIXPFCObserver * aObserver) -{ - return NS_OK; -} - -nsresult nsCalCommandCanvas::Notify(nsIXPFCCommand * aCommand) -{ - return NS_OK; -} - -nsresult nsCalCommandCanvas :: GetClassPreferredSize(nsSize& aSize) -{ - aSize.width = DEFAULT_WIDTH; - aSize.height = DEFAULT_HEIGHT; - return (NS_OK); -} - diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalDayViewCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalDayViewCanvas.cpp deleted file mode 100644 index 4fc6da39703..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalDayViewCanvas.cpp +++ /dev/null @@ -1,423 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsCalDayViewCanvas.h" -#include "nsCalUICIID.h" -#include "nsDateTime.h" -#include "nsCalToolkit.h" -#include "nsCRT.h" -#include "nsIRenderingContext.h" -#include "nsIFontMetrics.h" -#include "nsIDeviceContext.h" -#include "nsICalendarUser.h" -#include "nsICalendarModel.h" -#include "nsBoxLayout.h" - -#include "datetime.h" -#include "ptrarray.h" -#include "vevent.h" - -typedef struct -{ - char *p; - size_t iSize; - nsIXPFCCanvas * canvas; -} CAPICTX; - -#include "capi.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalDayViewCanvasCID, NS_CAL_DAYVIEWCANVAS_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); -static NS_DEFINE_IID(kICalendarUserIID, NS_ICALENDAR_USER_IID); -static NS_DEFINE_IID(kICalendarModelIID, NS_ICALENDAR_MODEL_IID); - -nsCalDayViewCanvas :: nsCalDayViewCanvas(nsISupports* outer) : nsCalTimebarComponentCanvas(outer) -{ - NS_INIT_REFCNT(); -} - -nsCalDayViewCanvas :: ~nsCalDayViewCanvas() -{ -} - -nsresult nsCalDayViewCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalDayViewCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalTimebarComponentCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalDayViewCanvas) -NS_IMPL_RELEASE(nsCalDayViewCanvas) - -nsresult nsCalDayViewCanvas :: Init() -{ - return (nsCalTimebarComponentCanvas::Init()); -} - -static nscolor nsLighter(nscolor c) -{ - PRUint8 r = NS_GET_R(c); - PRUint8 g = NS_GET_G(c); - PRUint8 b = NS_GET_B(c); - return NS_RGB( r + ((255-r)>>1), g + ((255-g)>>1), b + ((255-b)>>1) ); -} -static nscolor nsDarker(nscolor c) -{ - PRUint8 r = NS_GET_R(c); - PRUint8 g = NS_GET_G(c); - PRUint8 b = NS_GET_B(c); - return NS_RGB( r - (r>>1), g - (g>>1), b - (b>>1) ); -} - -/** - * Paint some light gray lines behind the events... - * @param aIndex - * @param aStart - * @param aSpace - * @param aMinorInterval how many minor ticks - * @return NX_OK on success - */ -nsresult nsCalDayViewCanvas::PaintInterval(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - PRUint32 aIndex, - PRUint32 aStart, - PRUint32 aSpace, - PRUint32 aMinorInterval) -{ - PRUint32 i; - - /* - * Paint this interval in it's entirety - */ - nsCalTimebarCanvas::PaintInterval(aRenderingContext, aDirtyRect, aIndex, aStart, aSpace, aMinorInterval); - nsRect rect; - GetBounds(rect); - - aRenderingContext.SetColor(nsLighter(nsLighter(nsDarker(GetBackgroundColor())))); - - aMinorInterval = 4; // XXX: this is a hack, we should specify this in the XML -sman - - if (((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment() == eLayoutAlignment_horizontal) - { - rect.x = aStart; - rect.width = aSpace; - - /* - * draw the minor ticks... - */ - PRUint32 iYStart = rect.y + INSET; - PRUint32 iYStop = rect.y + rect.height - INSET; - PRUint32 iXSpace = rect.width / aMinorInterval; - PRUint32 iX = rect.x + INSET + iXSpace; - for (i = 1; i < (PRUint32) aMinorInterval; i++) - { - aRenderingContext.DrawLine(iX,iYStart, iX,iYStop); - iX += iXSpace; - } - } - else - { - /* - * Vertical version - */ - rect.y = aStart; - rect.height = aSpace; - - /* - * draw the minor ticks... - */ - PRUint32 iXStart = rect.x + INSET; - PRUint32 iXStop = rect.x + rect.width - INSET; - PRUint32 iYSpace = rect.height/ aMinorInterval; - PRUint32 iY = rect.y + INSET + iYSpace; - for (i = 1; i < (PRUint32) aMinorInterval; i++) - { - aRenderingContext.DrawLine(iXStart,iY, iXStop,iY); - iY += iYSpace; - } - } - - //DrawTime(rndctx, rect, aIndex); - - return NS_OK ; -} - -nsEventStatus nsCalDayViewCanvas :: PaintBorder(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - nsRect rect; - - GetBounds(rect); - - rect.x++; rect.y++; rect.width-=2; rect.height-=2; - aRenderingContext.SetColor(GetForegroundColor()); - aRenderingContext.DrawRect(rect); - - return nsEventStatus_eConsumeNoDefault; -} - -/** - * Paint the foreground of the canvas and the events that overlap it. - * - * XXX the logic here is not really correct. It should probably be - * a more generic canvas capable of displaying any time-based - * event. There should probably be a separate mechanism that - * connects it to VEVENTS. - */ -nsEventStatus nsCalDayViewCanvas :: PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - JulianPtrArray * evtVctr = 0; - VEvent *pEvent = 0; - nsRect rect; - char *psBuf; - char sBuf[256]; - nscoord fm_height ; - UnicodeString usFmt("%(hh:mma)B-%(hh:mma)e"); // XXX this needs to be put in a resource, then a variable that can be switched - UnicodeString usTemp; - - evtVctr = new JulianPtrArray(); - - DateTime * dStart = ((nsDateTime *)GetTimeContext()->GetDTStart())->GetDateTime(); - DateTime * dEnd = ((nsDateTime *)GetTimeContext()->GetDTEnd())->GetDateTime(); - - nsIModel * model = GetModel(); - nsICalendarModel * calmodel = nsnull; - - if (nsnull == model) - return nsEventStatus_eConsumeNoDefault; - - nsICalendarUser * user = nsnull; - - nsresult res = model->QueryInterface(kICalendarModelIID, (void**)&calmodel); - if (NS_OK != res) - return nsEventStatus_eConsumeNoDefault; - - calmodel->GetCalendarUser(user); - - if (NS_OK != res) - return nsEventStatus_eConsumeNoDefault; - - nsILayer * layer; - - user->GetLayer(layer); - - layer->FetchEventsByRange(dStart, dEnd, evtVctr); - - PRUint32 vis_start_min = GetTimeContext()->GetFirstVisibleTime(nsCalPeriodFormat_kHour) * 60 + GetTimeContext()->GetFirstVisibleTime(nsCalPeriodFormat_kMinute); - PRUint32 vis_end_min = GetTimeContext()->GetLastVisibleTime(nsCalPeriodFormat_kHour) * 60 + GetTimeContext()->GetLastVisibleTime(nsCalPeriodFormat_kMinute); - PRFloat64 div_ratio = ((PRFloat64)(1)) / (PRFloat64)(vis_end_min - vis_start_min) ; - - /* - * set the font... - */ - aRenderingContext.PushState(); - nsFont font(/* m_sFontName*/ "Arial", NS_FONT_STYLE_NORMAL, - NS_FONT_VARIANT_NORMAL, - NS_FONT_WEIGHT_BOLD, - 0, - 10); - aRenderingContext.SetFont(font) ; - - /* - * XXX. This whole algorithm must be changed. We need to grab all - * the events first, determine how many overlap. Then determine - * how big we can make each box, then render... - */ - for (int j = 0; j < evtVctr->GetSize(); j++) - { - pEvent = (VEvent *) evtVctr->GetAt(j); - - DateTime dstart = pEvent->getDTStart(); - DateTime dsend = pEvent->getDTEnd(); - - if ( (PRUint32) dstart.getHour() < (PRUint32) GetTimeContext()->GetLastVisibleTime() - && (PRUint32) dsend.getHour() > (PRUint32) GetTimeContext()->GetFirstVisibleTime()) - { - /* - * compute rect for this event - * - * x,width are ok. y and height must be computed - */ - nsRect bounds; - GetBounds(rect); - GetBounds(bounds); - - PRUint32 vis_event_start_min = dstart.getHour() * 60 + dstart.getMinute(); - PRUint32 vis_event_end_min = dsend.getHour() * 60 + dsend.getMinute(); - - PRFloat64 sratio = ((PRFloat64)(vis_event_start_min - vis_start_min)) * (div_ratio); - PRFloat64 eratio = ((PRFloat64)(vis_event_end_min - vis_start_min)) * (div_ratio); - - aRenderingContext.SetColor(mComponentColor); - - if (((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment() == eLayoutAlignment_vertical) - { - /* - * XXX: Subtract off the modulus of the area. This should not be so hardcoded! - */ - rect.height = rect.height - ((rect.height-2)%GetVisibleMajorIntervals()); - - rect.y += (int)(rect.height * sratio); - rect.height = (int)((rect.height * eratio) - (rect.y - bounds.y)); - - rect.x = rect.x + 2 * INSET ; - rect.width = rect.width - 4*INSET ; - rect.y = rect.y + INSET ; - rect.height = rect.height - 2 * INSET; - - - if (rect.y < bounds.y) - rect.y = bounds.y+1; - - if ((rect.y+rect.height) > (bounds.y+bounds.height)) - rect.height = (bounds.y+bounds.height)-1; - - aRenderingContext.FillRect(rect); - - /* - * Render the highlights - */ - aRenderingContext.SetColor(nsLighter(mComponentColor)); - aRenderingContext.DrawLine(rect.x,rect.y,rect.x+rect.width,rect.y); - aRenderingContext.DrawLine(rect.x,rect.y,rect.x,rect.y+rect.height); - aRenderingContext.SetColor(nsDarker(mComponentColor)); - aRenderingContext.DrawLine(rect.x+rect.width,rect.y,rect.x+rect.width,rect.y+rect.height); - aRenderingContext.DrawLine(rect.x,rect.y+rect.height,rect.x+rect.width,rect.y+rect.height); - - aRenderingContext.GetFontMetrics()->GetHeight(fm_height); - - if (rect.height > fm_height) - { - // rndctx->SetColor(GetForegroundColor()); - aRenderingContext.SetColor(NS_RGB(255,255,255)); /* XXX: This color should come from someplace else... */ - - /* - * XXX. we need to handle '\n' in a format string... - * This should not require two separate coding calls - * we need to generalize this. - */ - psBuf = pEvent->toStringFmt(usFmt).toCString(""); - nsString string = psBuf; - aRenderingContext.DrawString(string,rect.x+1,rect.y,0); - delete psBuf; - - if (rect.height > (2 * fm_height)) - { - psBuf = pEvent->getSummary().toCString(""); - string = psBuf; - aRenderingContext.DrawString(string,rect.x+1,rect.y+fm_height,0); - delete psBuf; - } - } - } else { - - /* - * XXX: Subtract off the modulus of the area. This should not be so hardcoded! - */ - rect.width = rect.width - ((rect.width-2)%GetVisibleMajorIntervals()); - - rect.x += (int)(rect.width * sratio); - rect.width = (int)((rect.width * eratio) - (rect.x - bounds.x)); - - rect.y = rect.y + 2 * INSET ; - rect.height = rect.height - 4*INSET ; - rect.x = rect.x + INSET ; - rect.width = rect.width - 2 * INSET; - - - if (rect.x < bounds.x) - rect.x = bounds.x+1; - - if ((rect.x+rect.width) > (bounds.x+bounds.width)) - rect.width = (bounds.x+bounds.width)-1; - - aRenderingContext.FillRect(rect); - - /* - * Render the highlights - */ - aRenderingContext.SetColor(nsLighter(mComponentColor)); - aRenderingContext.DrawLine(rect.x,rect.y,rect.x,rect.y+rect.height); - aRenderingContext.DrawLine(rect.x,rect.y,rect.x+rect.width,rect.y); - aRenderingContext.SetColor(nsDarker(mComponentColor)); - aRenderingContext.DrawLine(rect.x,rect.y+rect.height,rect.x+rect.width,rect.y+rect.height); - aRenderingContext.DrawLine(rect.x+rect.width,rect.y,rect.x+rect.width,rect.y+rect.height); - - aRenderingContext.GetFontMetrics()->GetHeight(fm_height); - - if (rect.height > fm_height) - { - // rndctx->SetColor(GetForegroundColor()); - aRenderingContext.SetColor(NS_RGB(255,255,255)); /* XXX: This color should come from someplace else... */ - - /* - * XXX. we need to handle '\n' in a format string... - * This should not require two separate coding calls - * we need to generalize this. - */ - psBuf = pEvent->toStringFmt(usFmt).toCString(""); - nsString string = psBuf; - aRenderingContext.DrawString(string,rect.x+1,rect.y,0); - delete psBuf; - - if (rect.height > (2 * fm_height)) - { - psBuf = pEvent->getSummary().toCString(""); - string = psBuf; - aRenderingContext.DrawString(string,rect.x+1,rect.y+fm_height,0); - delete psBuf; - } - } - - } - } - } - aRenderingContext.PopState(); - - delete evtVctr; - - NS_RELEASE(calmodel); - - return nsEventStatus_eConsumeNoDefault; -} diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp deleted file mode 100644 index 6f27fd6c0f5..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsCalMonthViewCanvas.h" -#include "nsCalUICIID.h" -#include "nsDateTime.h" -#include "nsCalToolkit.h" -#include "nsCRT.h" -#include "nsIRenderingContext.h" -#include "nsIFontMetrics.h" -#include "nsIDeviceContext.h" -#include "nsICalendarUser.h" -#include "nsICalendarModel.h" -#include "nsDateTime.h" -#include "nsIFontMetrics.h" -#include "nsIDeviceContext.h" -#include "prprf.h" -#include "nsString.h" - -#include "datetime.h" -#include "ptrarray.h" -#include "vevent.h" -#include "icalcomp.h" - -#include "capi.h" - -#define NUM_INTERVALS 5 - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalMonthViewCanvasCID, NS_CAL_MONTHVIEWCANVAS_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); -static NS_DEFINE_IID(kICalendarUserIID, NS_ICALENDAR_USER_IID); -static NS_DEFINE_IID(kICalendarModelIID, NS_ICALENDAR_MODEL_IID); - -nsCalMonthViewCanvas :: nsCalMonthViewCanvas(nsISupports* outer) : nsCalTimebarComponentCanvas(outer) -{ - NS_INIT_REFCNT(); - - mNumRows = 0; - mNumColumns = 0; - - mArrayRows = nsnull; - mArrayColumns = nsnull; - -} - -nsCalMonthViewCanvas :: ~nsCalMonthViewCanvas() -{ - if (mArrayRows != nsnull) - delete mArrayRows; - if (mArrayColumns != nsnull) - delete mArrayColumns; -} - -nsresult nsCalMonthViewCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalMonthViewCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalTimebarComponentCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalMonthViewCanvas) -NS_IMPL_RELEASE(nsCalMonthViewCanvas) - -nsresult nsCalMonthViewCanvas :: Init() -{ - - // XXX: May need to init to some value here - - mArrayRows = new nsVoidArray(31); - mArrayColumns = new nsVoidArray(31); - - return (nsCalTimebarComponentCanvas::Init()); -} - - -nsEventStatus nsCalMonthViewCanvas :: PaintBorder(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - return (nsCalTimebarComponentCanvas::PaintBorder(aRenderingContext,aDirtyRect)); -} - -nsEventStatus nsCalMonthViewCanvas :: PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - nsICalTimeContext * tc = GetTimeContext(); - nsIDateTime * dts = nsnull; - nsIDateTime * dtmonth1 = nsnull; - nsIDateTime * dtmonth2 = nsnull; - nsresult res = NS_OK; - DateTime * dStart = nsnull ; - DateTime * dEnd = nsnull ; - PRUint32 i,j; - PRUint32 row, column; - PRUint32 currDate = 0; - PRUint32 indexOnDate = 0; - - - if (nsnull == tc) - return nsEventStatus_eConsumeNoDefault; - - dts = tc->GetDTStart(); // XXX: Deal with TimeContext correctly here - dtmonth1 = dts->Copy(); - dtmonth2 = dts->Copy(); - dStart = ((nsDateTime *)dtmonth1)->GetDateTime(); - dEnd = ((nsDateTime *)dtmonth2)->GetDateTime(); - - /* - * Compute number of weeks - */ - - dStart->setDayOfMonth(1); - dEnd->findLastDayOfMonth(); - - - JulianPtrArray * evtVctr = 0; - VEvent *pEvent = 0; - nsRect rect; - char *psBuf; - char sBuf[256]; - nscoord fm_height ; - UnicodeString usFmt("%(hh:mma)B-%(hh:mma)e"); // XXX this needs to be put in a resource, then a variable that can be switched - UnicodeString usTemp; - - evtVctr = new JulianPtrArray(); - - nsIModel * model = GetModel(); - nsICalendarModel * calmodel = nsnull; - - if (nsnull == model) - return nsEventStatus_eConsumeNoDefault; - - nsICalendarUser * user = nsnull; - - res = model->QueryInterface(kICalendarModelIID, (void**)&calmodel); - if (NS_OK != res) - return nsEventStatus_eConsumeNoDefault; - - calmodel->GetCalendarUser(user); - - if (NS_OK != res) - return nsEventStatus_eConsumeNoDefault; - - nsILayer * layer; - - user->GetLayer(layer); - -#if 0 - NSCalendar * nscal; - - layer->GetCal(nscal); - - nscal->sortComponentsByDTStart(ICalComponent::ICAL_COMPONENT::ICAL_COMPONENT_VEVENT); - - nscal->getEventsByRange(evtVctr, *dStart, *dEnd); -#endif - - layer->FetchEventsByRange(dStart, dEnd, evtVctr); - - for (j = 0; j < evtVctr->GetSize(); j++) - { - pEvent = (VEvent *) evtVctr->GetAt(j); - - DateTime dstart = pEvent->getDTStart(); - DateTime dsend = pEvent->getDTEnd(); - - /* - * Let's find out which grid we belong to, then plop ourselves appropriately - * within that grid - */ - - PRUint32 ii = dstart.getDate(); - - CellFromDate(ii, row, column); - - // Multiple events on one day? - if (currDate != dstart.getDate()) - { - currDate = dstart.getDate(); - indexOnDate = 0; - } else { - indexOnDate++; - } - - - /* - * Now, let's compute the bounds for our event - */ - - nsRect bounds; - - GetCellBounds(row, column, bounds); - - /* - * Scale down to the size of our interval - */ - - bounds.height /= NUM_INTERVALS; - bounds.width--; - - bounds.y += (bounds.height * indexOnDate); - - bounds.x+=2; bounds.y+=2; - bounds.width-=4;bounds.height-=4; - - // Set the color - aRenderingContext.SetColor(GetForegroundColor()); - - aRenderingContext.GetFontMetrics()->GetHeight(fm_height); - - if (bounds.height > fm_height) - { - - aRenderingContext.SetColor(mComponentColor); - aRenderingContext.FillRect(bounds); - aRenderingContext.SetColor(NS_BrightenColor(mComponentColor)); - aRenderingContext.DrawLine(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y); - aRenderingContext.DrawLine(bounds.x,bounds.y,bounds.x,bounds.y+bounds.height); - aRenderingContext.SetColor(NS_DarkenColor(mComponentColor)); - aRenderingContext.DrawLine(bounds.x+bounds.width,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height); - aRenderingContext.DrawLine(bounds.x,bounds.y+bounds.height,bounds.x+bounds.width,bounds.y+bounds.height); - - psBuf = pEvent->toStringFmt(usFmt).toCString(""); - - aRenderingContext.SetColor(NS_RGB(255,255,255)); - nsString string = psBuf; - aRenderingContext.DrawString(string,bounds.x+1,bounds.y,0); - - delete psBuf; - - if (bounds.height > (2 * fm_height)) - { - psBuf = pEvent->getSummary().toCString(""); - string = psBuf; - aRenderingContext.DrawString(string,bounds.x+1,bounds.y+fm_height,0); - delete psBuf; - } - } - } - - delete evtVctr; - - NS_RELEASE(calmodel); - - NS_RELEASE(dtmonth1); - NS_RELEASE(dtmonth2); - - return nsEventStatus_eConsumeNoDefault; -} - -nsEventStatus nsCalMonthViewCanvas :: PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - /* - * First, we need to find out how many rows/columns we want/need. - */ - - nsICalTimeContext * tc = GetTimeContext(); - nsIDateTime * dts = nsnull; - nsIDateTime * dtmonth = nsnull; - nsresult res = NS_OK; - DateTime * datetime = nsnull ; - PRUint32 i,j; - PRInt32 iDate = 1; - PRInt32 iLastDate ; - - if (nsnull == tc) - return nsEventStatus_eConsumeNoDefault; - - dts = tc->GetDTStart(); // XXX: Deal with TimeContext correctly here - dtmonth = dts->Copy(); - datetime = ((nsDateTime *)dtmonth)->GetDateTime(); - - /* - * Compute number of weeks - */ - - datetime->setDayOfMonth(1); - i = datetime->get(Calendar::WEEK_OF_YEAR); - datetime->findLastDayOfMonth(); - j = datetime->get(Calendar::WEEK_OF_YEAR); - datetime->setDayOfMonth(1); - mNumRows = j-i+1; - mNumColumns = 7; // XXX: Need a query for max number days in a week - - /* - * compute last day of month ... - */ - - iLastDate = datetime->getMonthLength(datetime->getMonth(),datetime->getYear()); - - /* - * compute what the day of week the first cell is on. This may be - * negative, up to -7 - */ - - iDate -= (datetime->get(Calendar::DAY_OF_WEEK) -1); - - /* - * Now, let's render the background - * - * XXX: As an optimization we may want to combine cell back/fore painting - */ - - nsCalCanvas::PaintBackground(aRenderingContext, aDirtyRect); - - for (i=0; i<=mNumRows; i++) - { - for (j=0; j 0 && iDate <= iLastDate) - thisDate = iDate; - else - thisDate = 0; - - PaintCellBackground(i,j,thisDate,aRenderingContext,aDirtyRect); - - CacheCellData(i,j,thisDate); - - iDate++; - } - } - - - NS_RELEASE(dtmonth); - - return nsEventStatus_eConsumeNoDefault; -} - -nsEventStatus nsCalMonthViewCanvas :: PaintCellBackground( PRUint32& aCellRow, PRUint32& aCellColumn, - PRUint32& aCellDate, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - /* - * Draw a box using the foreground color - */ - - nscoord x,y,w,h; - nscoord cell_width; - nscoord cell_height; - nsRect bounds; - PRUint32 cell_width_remainder,cell_height_remainder; - nsRect rect; - - GetCellBounds(aCellRow, aCellColumn, rect); - - x = rect.x; - y = rect.y; - w = rect.width; - h = rect.height; - - rect.width--; rect.height--; - - aRenderingContext.SetColor(GetForegroundColor()); - aRenderingContext.DrawLine(rect.x,rect.y,rect.x+rect.width,rect.y); - aRenderingContext.DrawLine(rect.x,rect.y,rect.x,rect.y+rect.height); - - aRenderingContext.DrawLine(rect.x+rect.width,rect.y,rect.x+rect.width,rect.y+rect.height); - aRenderingContext.DrawLine(rect.x,rect.y+rect.height,rect.x+rect.width,rect.y+rect.height); - - /* - * Now render intervals - * - * XXX: Hardcoded til fix TimeContext - */ - - aRenderingContext.SetColor(Dim(GetBorderColor())); - aRenderingContext.SetLineStyle(nsLineStyle_kDotted); - - rect.x++; - rect.width--; - - nscoord interval = rect.height / NUM_INTERVALS; - - PRInt32 i ; - - for (i=0; i<4; i++) - { - rect.y += interval; - aRenderingContext.DrawLine(rect.x,rect.y,rect.x+rect.width,rect.y); - } - - /* - * Now put the number of the day in lower right hand corner - */ - - aRenderingContext.SetLineStyle(nsLineStyle_kSolid); - - nsString strDate; - - if (aCellDate > 0) - { - char buf[5]; - - PR_snprintf(buf, 5, "%d", aCellDate); - - strDate = buf; - - - nscoord text_height ; - nscoord text_width ; - - aRenderingContext.GetFontMetrics()->GetHeight(text_height); - aRenderingContext.GetWidth(strDate, text_width); - - x = x + w - text_width; - y = y + h - text_height; - - aRenderingContext.SetColor(GetForegroundColor()); - - nsString string = strDate; - aRenderingContext.DrawString(string,x,y,0); - - } - - return nsEventStatus_eConsumeNoDefault; -} - -nsresult nsCalMonthViewCanvas :: CacheCellData(PRUint32& aCellRow, PRUint32& aCellColumn, PRUint32& aCellDate) -{ - if (aCellDate > 0 && aCellDate < 32) - { - mArrayRows->ReplaceElementAt((void *)aCellRow, aCellDate); - mArrayColumns->ReplaceElementAt((void *)aCellRow, aCellDate); - } - - return NS_OK; -} - -nsresult nsCalMonthViewCanvas :: CellFromDate(PRUint32& aCellDate, PRUint32& aCellRow, PRUint32& aCellColumn) -{ - aCellRow = -1; - aCellColumn = -1; - - if (aCellDate > 0 && aCellDate < 32) - { - aCellRow = (PRUint32) mArrayRows->ElementAt(aCellDate); - aCellColumn = (PRUint32) mArrayColumns->ElementAt(aCellDate); - } - - return NS_OK; -} - -nsresult nsCalMonthViewCanvas :: GetCellBounds(PRUint32& aCellRow, PRUint32& aCellColumn, nsRect& aBounds) -{ - nscoord cell_width; - nscoord cell_height; - nsRect bounds; - PRUint32 cell_width_remainder,cell_height_remainder; - - GetBounds(bounds); - - cell_width = bounds.width / mNumColumns; - cell_height = bounds.height / mNumRows; - - aBounds.x = cell_width * aCellColumn + bounds.x; - aBounds.y = cell_height * aCellRow + bounds.y; - aBounds.width = cell_width; - aBounds.height = cell_height; - - /* - * If there is a modulus, disperse that across the cells - * beginning from front. - */ - - cell_width_remainder = bounds.width % mNumColumns; - cell_height_remainder = bounds.height % mNumRows; - - if (aCellColumn >= cell_width_remainder) - aBounds.x += cell_width_remainder; - else - aBounds.x += aCellColumn; - - if (cell_width_remainder > aCellColumn) - aBounds.width++; - - if (aCellRow >= cell_height_remainder) - aBounds.y += cell_height_remainder; - else - aBounds.y += aCellRow; - - if (cell_height_remainder > aCellRow) - aBounds.height++; - - return NS_OK; -} diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalMultiDayViewCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalMultiDayViewCanvas.cpp deleted file mode 100644 index 07ccad5727e..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalMultiDayViewCanvas.cpp +++ /dev/null @@ -1,662 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalMultiDayViewCanvas.h" -#include "nsCalDayViewCanvas.h" -#include "nsCalTimebarTimeHeading.h" -#include "nsBoxLayout.h" -#include "nsCalUICIID.h" - -#include "nsIArray.h" -#include "nsIIterator.h" - -#include "nsCalToolkit.h" -#include "nsCalDayListCommand.h" -#include "nsCalNewModelCommand.h" - -#include "nscalstrings.h" -#include "nsxpfcstrings.h" - - -#define DEFAULT_NUMBER_VIEWABLE_DAYS 5 - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalMultiDayViewCanvasCID, NS_CAL_MULTIDAYVIEWCANVAS_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); -static NS_DEFINE_IID(kCalTimebarCanvasCID, NS_CAL_TIMEBARCANVAS_CID); -static NS_DEFINE_IID(kCCalDayViewCID, NS_CAL_DAYVIEWCANVAS_CID); - -nsCalMultiDayViewCanvas :: nsCalMultiDayViewCanvas(nsISupports* outer) : nsCalMultiViewCanvas(outer) -{ - NS_INIT_REFCNT(); - mNumberViewableDays = 0; - mMinRepeat = 1; - mMaxRepeat = 1000; -} - -nsCalMultiDayViewCanvas :: ~nsCalMultiDayViewCanvas() -{ -} - -nsresult nsCalMultiDayViewCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalMultiDayViewCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalMultiViewCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalMultiDayViewCanvas) -NS_IMPL_RELEASE(nsCalMultiDayViewCanvas) - -/* - * - */ - -nsresult nsCalMultiDayViewCanvas :: Init() -{ - - /* - * We also need a context. Maybe this should be specifically - * done rather than a part of Init. - */ - - nsCalMultiViewCanvas::Init(); - - /* - * Create the default number of viewable day canvas's as children - */ - - SetNumberViewableDays(DEFAULT_NUMBER_VIEWABLE_DAYS); - - return NS_OK; -} - -/* - * Since our Day View's will do the painting, just ignore - */ - -nsEventStatus nsCalMultiDayViewCanvas :: PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - return (nsCalMultiViewCanvas :: PaintBackground(aRenderingContext,aDirtyRect)); -} - -nsresult nsCalMultiDayViewCanvas :: SetNumberViewableDays(PRUint32 aNumberViewableDays) -{ - - if (aNumberViewableDays < mMinRepeat) - aNumberViewableDays = mMinRepeat; - if (aNumberViewableDays > mMaxRepeat) - aNumberViewableDays = mMaxRepeat; - - if (mNumberViewableDays != aNumberViewableDays) { - - PRUint32 i; - - mNumberViewableDays = aNumberViewableDays; - - /* - * Do the creation/deleteion process here - */ - - DeleteChildren(); - - for (i=0; iInit(); - - AddChildCanvas(canvas); - - canvas->SetBackgroundColor(GetBackgroundColor()); - - nsLayoutAlignment la = ((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment(); - - if (eLayoutAlignment_horizontal == la) - ((nsBoxLayout *)(canvas->GetLayout()))->SetLayoutAlignment(eLayoutAlignment_vertical); - else - ((nsBoxLayout *)(canvas->GetLayout()))->SetLayoutAlignment(eLayoutAlignment_horizontal); - - parent = canvas; - - NS_RELEASE(canvas); - - /* - * Add the Header Time Canvas - */ - - if (GetShowHeaders()) { - - static NS_DEFINE_IID(kCalTimebarTimeHeadingCID, NS_CAL_TIMEBARTIMEHEADING_CID); - - res = nsRepository::CreateInstance(kCalTimebarTimeHeadingCID, - nsnull, - kIXPFCCanvasIID, - (void **)&canvas); - - if (NS_OK != res) - return nsnull ; - - canvas->Init(); - - parent->AddChildCanvas(canvas); - - //canvas->SetBackgroundColor(GetBackgroundColor()); - canvas->SetPreferredSize(nsSize(25,25)); - canvas->SetMinimumSize(nsSize(25,25)); - canvas->SetMaximumSize(nsSize(25,25)); - - NS_RELEASE(canvas); - - } - - /* - * Add the Day View Canvas - */ - - res = nsRepository::CreateInstance(kCCalDayViewCID, - nsnull, - kIXPFCCanvasIID, - (void **)&canvas); - - if (NS_OK != res) - return nsnull ; - - canvas->Init(); - - parent->AddChildCanvas(canvas); - - canvas->SetBackgroundColor(GetBackgroundColor()); - - canvas->SetMinimumSize(nsSize(100,100)); - - if (eLayoutAlignment_horizontal == la) - ((nsBoxLayout *)(canvas->GetLayout()))->SetLayoutAlignment(eLayoutAlignment_vertical); - else - ((nsBoxLayout *)(canvas->GetLayout()))->SetLayoutAlignment(eLayoutAlignment_horizontal); - - NS_RELEASE(canvas); - - /* - * Add the status View Canvas - */ - - if (GetShowStatus()) { - - res = nsRepository::CreateInstance(kCXPFCCanvasCID, - nsnull, - kIXPFCCanvasIID, - (void **)&canvas); - - if (NS_OK != res) - return nsnull ; - - canvas->Init(); - - parent->AddChildCanvas(canvas); - - canvas->SetBackgroundColor(GetBackgroundColor()); - canvas->SetPreferredSize(nsSize(25,25)); - canvas->SetMinimumSize(nsSize(25,25)); - canvas->SetMaximumSize(nsSize(25,25)); - - NS_RELEASE(canvas); - - } - - return (parent); -} - - -nsEventStatus nsCalMultiDayViewCanvas::Action(nsIXPFCCommand * aCommand) -{ - /* - * If this is a DayList Command, modify our children as necessary - */ - - nsresult res; - PRUint32 count = 0; - - nsCalDayListCommand * daylist_command = nsnull; - nsCalNewModelCommand * newmodel_command = nsnull; - static NS_DEFINE_IID(kCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID); - static NS_DEFINE_IID(kCalNewModelCommandCID, NS_CAL_NEWMODEL_COMMAND_CID); - - res = aCommand->QueryInterface(kCalDayListCommandCID,(void**)&daylist_command); - - if (NS_OK == res) - { - - /* - * It's a day list command ... set the date - */ - - nsIIterator * iterator; - - res = daylist_command->CreateIterator(&iterator); - - if (NS_OK != res) - return nsEventStatus_eIgnore; - - iterator->Init(); - - count = iterator->Count(); - - if (iterator->Count() < mMinRepeat) - count = mMinRepeat; - if (iterator->Count() > mMaxRepeat) - count = mMaxRepeat; - - if (count != GetChildCount()) { - - /* - * The number of new days is different from current. If the number is - * less, delete the difference. If it is more, add new canvas. - * - */ - - if (count < GetChildCount()) { - - /* - * Delete the difference - */ - - PRUint32 delta = GetChildCount() - count; - - DeleteChildren(delta); - - } else if (count > GetChildCount()) { - - /* - * Add new children - */ - - PRUint32 delta = count - GetChildCount(); - - PRUint32 i; - - for (i=0; iIsDone())) - { - - if (index > count) - break; - - nsDateTime * datetime = (nsDateTime *) iterator->CurrentItem(); - - if (datetime != nsnull) { - - ChangeChildDateTime(index,datetime); - - } - - index++; - - iterator->Next(); - } - - - Layout(); - } - - res = aCommand->QueryInterface(kCalNewModelCommandCID,(void**)&newmodel_command); - - if (NS_OK == res) - { - nsIXPFCCanvas * canvas = AddDayViewCanvas(); - - /* - * Get the last sibling and set it's model.... - */ - - if (canvas != nsnull) - { - - nsDateTime * nsdatetime; - static NS_DEFINE_IID(kCalDateTimeCID, NS_DATETIME_CID); - static NS_DEFINE_IID(kCalDateTimeIID, NS_IDATETIME_IID); - nsresult res = nsRepository::CreateInstance(kCalDateTimeCID,nsnull, kCalDateTimeCID, (void **)&nsdatetime); - - if (NS_OK == res) - nsdatetime->Init(); - - /* - * Apply to all children .... - */ - nsIIterator * iterator ; - nsCalTimebarCanvas * tbc ; - - res = canvas->CreateIterator(&iterator); - - if (NS_OK == res) - { - iterator->Init(); - - while(!(iterator->IsDone())) - { - - tbc = (nsCalTimebarCanvas *) iterator->CurrentItem(); - - nsCalTimebarCanvas * canvas_iface = nsnull;; - - tbc->QueryInterface(kCalTimebarCanvasCID, (void**) &canvas_iface); - - if (canvas_iface) - { - - SetChildTimeContext(canvas_iface, GetTimeContext(), 0); - ChangeChildDateTime(canvas_iface, nsdatetime); - canvas_iface->SetModel(newmodel_command->mModel); - - NS_RELEASE(canvas_iface); - } - - iterator->Next(); - - } - - iterator->Next(); - } - - NS_RELEASE(iterator); - - Layout(); - - nsRect bounds; - GetView()->GetBounds(bounds); - gXPFCToolkit->GetViewManager()->UpdateView(GetView(), bounds, NS_VMREFRESH_AUTO_DOUBLE_BUFFER | NS_VMREFRESH_NO_SYNC); - - NS_RELEASE(tbc); - - } - } - - return (nsCalMultiViewCanvas::Action(aCommand)); - -} - -nsresult nsCalMultiDayViewCanvas :: SetParameter(nsString& aKey, nsString& aValue) -{ - PRInt32 i ; - - if (aKey.EqualsIgnoreCase(CAL_STRING_MINREPEAT)) { - - mMinRepeat = (PRUint32) aValue.ToInteger(&i); - - } else if (aKey.EqualsIgnoreCase(CAL_STRING_MAXREPEAT)) { - - mMaxRepeat = (PRUint32) aValue.ToInteger(&i); - - } else if (aKey.EqualsIgnoreCase(CAL_STRING_COUNT)) { - - SetNumberViewableDays((PRUint32)aValue.ToInteger(&i)); - - } else if (aKey.EqualsIgnoreCase(XPFC_STRING_LAYOUT)) { - - // XXX: Layout should implement this interface. - // Then, put functionality in the core layout class - // to identify the type of layout object needed. - - if (aValue.EqualsIgnoreCase(XPFC_STRING_XBOX)) { - ((nsBoxLayout *)GetLayout())->SetLayoutAlignment(eLayoutAlignment_horizontal); - } else if (aValue.EqualsIgnoreCase(XPFC_STRING_YBOX)) { - ((nsBoxLayout *)GetLayout())->SetLayoutAlignment(eLayoutAlignment_vertical); - } - - SetMultiDayLayout(((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment()); - - } - - - return (nsCalMultiViewCanvas::SetParameter(aKey, aValue)); -} - -nsresult nsCalMultiDayViewCanvas :: SetMultiDayLayout(nsLayoutAlignment aLayoutAlignment) -{ - nsresult res = NS_OK; - nsIXPFCCanvas * canvas; - nsIIterator * iterator ; - - /* - * Enumarate the child canvas - */ - - nsLayoutAlignment la = ((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment(); - - if (eLayoutAlignment_horizontal == la) - la = eLayoutAlignment_vertical; - else - la = eLayoutAlignment_horizontal; - - res = CreateIterator(&iterator); - - if (NS_OK != res) - return res; - - iterator->Init(); - - while(!(iterator->IsDone())) - { - canvas = (nsIXPFCCanvas *) iterator->CurrentItem(); - - ((nsBoxLayout *)(canvas->GetLayout()))->SetLayoutAlignment(la); - - /* - * Enumarate children looking for DayView and set its alignment - */ - - nsresult res2 = NS_OK; - nsIIterator * iterator2 ; - nsIXPFCCanvas * canvas2 ; - - res2 = canvas->CreateIterator(&iterator2); - - if (NS_OK == res2) - { - - iterator2->Init(); - - while(!(iterator2->IsDone())) - { - - canvas2 = (nsIXPFCCanvas *) iterator2->CurrentItem(); - - nsCalDayViewCanvas * canvas_iface = nsnull;; - - canvas2->QueryInterface(kCCalDayViewCID, (void**) &canvas_iface); - - if (canvas_iface) - { - - ((nsBoxLayout *)(canvas_iface->GetLayout()))->SetLayoutAlignment(la); - - NS_RELEASE(canvas_iface); - } - - iterator2->Next(); - - } - - NS_RELEASE(iterator2); - - } - - iterator->Next(); - } - - NS_IF_RELEASE(iterator); - - return res; -} - -/* - * Call SetContext on all child canvas that support the - * nsCalTimebarCanvas interface. This routine is recursive. - * - * We need to store this TimeContext for ourselves also in case - * we get asked to add new DayView Canvas's, we'll ask the DayView - * to copy our context to start with. - */ - -nsresult nsCalMultiDayViewCanvas :: SetTimeContext(nsICalTimeContext * aContext) -{ - - nsresult res = NS_OK; - nsIIterator * iterator ; - nsCalTimebarCanvas * canvas ; - PRUint32 index = 0; - - res = CreateIterator(&iterator); - - if (NS_OK != res) - return res; - - iterator->Init(); - - while(!(iterator->IsDone())) - { - - /* - * Iterate through these children til we find the right one - */ - - canvas = (nsCalTimebarCanvas *) iterator->CurrentItem(); - - nsresult res2 = NS_OK; - nsIIterator * iterator2 ; - nsCalTimebarCanvas * canvas2 ; - - res2 = canvas->CreateIterator(&iterator2); - - if (NS_OK != res2) - return res2; - - iterator2->Init(); - - while(!(iterator2->IsDone())) - { - - canvas2 = (nsCalTimebarCanvas *) iterator2->CurrentItem(); - - nsCalTimebarCanvas * canvas_iface = nsnull;; - - canvas2->QueryInterface(kCalTimebarCanvasCID, (void**) &canvas_iface); - - if (canvas_iface) { - - SetChildTimeContext(canvas_iface, aContext, index); - - NS_RELEASE(canvas_iface); - } - - iterator2->Next(); - - } - - NS_RELEASE(iterator2); - - index++; - iterator->Next(); - } - - NS_RELEASE(iterator); - - return (nsCalMultiViewCanvas :: SetTimeContext(aContext)); -} diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalMultiUserViewCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalMultiUserViewCanvas.cpp deleted file mode 100644 index f3306fd5802..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalMultiUserViewCanvas.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalMultiDayViewCanvas.h" -#include "nsCalMultiUserViewCanvas.h" -#include "nsCalTimebarTimeHeading.h" -#include "nsBoxLayout.h" -#include "nsCalUICIID.h" -#include "nsIArray.h" -#include "nsIIterator.h" -#include "nsCalToolkit.h" -#include "nsCalNewModelCommand.h" -#include "nscalstrings.h" -#include "nsxpfcstrings.h" -#include "nsCalNewModelCommand.h" - - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalMultiViewCanvasCID, NS_CAL_MULTIVIEWCANVAS_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); -static NS_DEFINE_IID(kCalTimebarCanvasCID, NS_CAL_TIMEBARCANVAS_CID); -static NS_DEFINE_IID(kCalMultiDayViewCanvasCID, NS_CAL_MULTIDAYVIEWCANVAS_CID); - -nsCalMultiUserViewCanvas :: nsCalMultiUserViewCanvas(nsISupports* outer) : nsCalMultiViewCanvas(outer) -{ - NS_INIT_REFCNT(); -} - -nsCalMultiUserViewCanvas :: ~nsCalMultiUserViewCanvas() -{ -} - -nsresult nsCalMultiUserViewCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalMultiViewCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalMultiViewCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalMultiUserViewCanvas) -NS_IMPL_RELEASE(nsCalMultiUserViewCanvas) - -/* - * A MultiUser Canvas has 1 or more MultiDay Canvas's, one for each user - * - * So, let's create the default of 1 MuiltiDay for this canvas and give it - * a week's worth of views. - * - * Ideally, we should probably figure out an XML syntax to specify this stuff - * - */ - -nsresult nsCalMultiUserViewCanvas :: Init() -{ - - /* - * create a multiday as a child of us - */ - nsCalMultiViewCanvas::Init(); - - return (AddMultiDayView(nsnull)); - -} - -nsresult nsCalMultiUserViewCanvas :: AddMultiDayView(nsIModel * aModel) -{ - static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); - - nsCalMultiDayViewCanvas * multi; - - nsresult res = nsRepository::CreateInstance(kCalMultiDayViewCanvasCID, - nsnull, - kIXPFCCanvasIID, - (void **)&multi); - - if (NS_OK == res) - { - - multi->Init(); - - AddChildCanvas(multi); - - multi->SetShowTimeScale(PR_TRUE); - - multi->SetTimeContext(GetTimeContext()); - - SetMultiUserLayout(((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment()); - - multi->SetNumberViewableDays(1); // XXX - - if (nsnull != aModel) - { - multi->SetModel(aModel); - } - - Layout(); - - } - - - return (res); -} - -nsresult nsCalMultiUserViewCanvas :: SetParameter(nsString& aKey, nsString& aValue) -{ - PRInt32 error = 0; - - if (aKey.EqualsIgnoreCase(XPFC_STRING_LAYOUT)) - { - // XXX: Layout should implement this interface. - // Then, put functionality in the core layout class - // to identify the type of layout object needed. - - if (aValue.EqualsIgnoreCase(XPFC_STRING_XBOX)) { - ((nsBoxLayout *)GetLayout())->SetLayoutAlignment(eLayoutAlignment_horizontal); - } else if (aValue.EqualsIgnoreCase(XPFC_STRING_YBOX)) { - ((nsBoxLayout *)GetLayout())->SetLayoutAlignment(eLayoutAlignment_vertical); - } - - // XXX: We need to separate layout from the content model ... arghh... - // - // If someone changes our layout, pass it on to any MultiDay canvas - // that are our children. - - SetMultiUserLayout(((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment()); - - } - - return (nsXPFCCanvas :: SetParameter(aKey, aValue)); -} - -nsresult nsCalMultiUserViewCanvas :: SetMultiUserLayout(nsLayoutAlignment aLayoutAlignment) -{ - nsresult res ; - nsIIterator * iterator ; - nsIXPFCCanvas * canvas ; - - res = CreateIterator(&iterator); - - nsLayoutAlignment la = aLayoutAlignment; - - if (NS_OK == res) - { - - iterator->Init(); - - while(!(iterator->IsDone())) - { - canvas = (nsIXPFCCanvas *) iterator->CurrentItem(); - - nsCalMultiDayViewCanvas * md = nsnull; - - res = canvas->QueryInterface(kCalMultiDayViewCanvasCID, (void**)&md); - - if (NS_OK == res) - { - ((nsBoxLayout *)(canvas->GetLayout()))->SetLayoutAlignment(la); - md->SetMultiDayLayout(la); - NS_RELEASE(md); - } - - iterator->Next(); - } - - NS_RELEASE(iterator); - } - - return NS_OK; -} - -nsresult nsCalMultiUserViewCanvas :: SetTimeContext(nsICalTimeContext * aContext) -{ - //aContext->SetHorizontal(PR_TRUE); - return (nsCalMultiViewCanvas :: SetTimeContext(aContext)); -} - - -nsEventStatus nsCalMultiUserViewCanvas::Action(nsIXPFCCommand * aCommand) -{ - nsresult res; - - nsCalNewModelCommand * newmodel_command = nsnull; - static NS_DEFINE_IID(kCalNewModelCommandCID, NS_CAL_NEWMODEL_COMMAND_CID); - - res = aCommand->QueryInterface(kCalNewModelCommandCID,(void**)&newmodel_command); - - if (NS_OK == res) - { - - /* - * A NewModel Command will Add a new MultiDayView in this MultiUser - * canvas, which *clones* the attributes of the other MultiDay views - * - * For now, let's just limp along by adding it to the list... - */ - - AddMultiDayView(newmodel_command->mModel); - - NS_RELEASE(newmodel_command); - - return (nsEventStatus_eConsumeNoDefault); - } - - return (nsCalMultiViewCanvas::Action(aCommand)); -} - diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalMultiViewCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalMultiViewCanvas.cpp deleted file mode 100644 index a373b00b193..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalMultiViewCanvas.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalMultiViewCanvas.h" -#include "nsCalTimebarTimeHeading.h" -#include "nsBoxLayout.h" -#include "nsCalUICIID.h" -#include "nsIArray.h" -#include "nsIIterator.h" -#include "nsCalToolkit.h" -#include "nsCalNewModelCommand.h" -#include "nscalstrings.h" - - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalMultiViewCanvasCID, NS_CAL_MULTIVIEWCANVAS_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); -static NS_DEFINE_IID(kCalTimebarCanvasCID, NS_CAL_TIMEBARCANVAS_CID); - -nsCalMultiViewCanvas :: nsCalMultiViewCanvas(nsISupports* outer) : nsCalTimebarComponentCanvas(outer) -{ - NS_INIT_REFCNT(); - - mShowHeaders = PR_TRUE; - mShowStatus = PR_FALSE; - mShowTimeScale = PR_FALSE; -} - -nsCalMultiViewCanvas :: ~nsCalMultiViewCanvas() -{ -} - -nsresult nsCalMultiViewCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalMultiViewCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalTimebarComponentCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalMultiViewCanvas) -NS_IMPL_RELEASE(nsCalMultiViewCanvas) - -/* - * - */ - -nsresult nsCalMultiViewCanvas :: Init() -{ - return (nsCalTimebarComponentCanvas::Init()); -} - -nsEventStatus nsCalMultiViewCanvas :: PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - return (nsCalCanvas :: PaintBackground(aRenderingContext,aDirtyRect)); -} - - -PRBool nsCalMultiViewCanvas :: GetShowHeaders() -{ - return (mShowHeaders); -} - -nsresult nsCalMultiViewCanvas :: SetShowHeaders(PRBool aShowHeaders) -{ - mShowHeaders = aShowHeaders; - return (NS_OK); -} - - -PRBool nsCalMultiViewCanvas :: GetShowStatus() -{ - return (mShowStatus); -} - -nsresult nsCalMultiViewCanvas :: SetShowStatus(PRBool aShowStatus) -{ - mShowStatus = aShowStatus; - return (NS_OK); -} - -PRBool nsCalMultiViewCanvas :: GetShowTimeScale() -{ - return (mShowTimeScale); -} - -nsresult nsCalMultiViewCanvas :: SetShowTimeScale(PRBool aShowTimeScale) -{ - mShowTimeScale = aShowTimeScale; - return (NS_OK); -} - - -nsEventStatus nsCalMultiViewCanvas::Action(nsIXPFCCommand * aCommand) -{ - return (nsCalTimebarComponentCanvas::Action(aCommand)); -} - -nsresult nsCalMultiViewCanvas :: SetParameter(nsString& aKey, nsString& aValue) -{ - return (nsCalTimebarComponentCanvas::SetParameter(aKey, aValue)); -} diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalStatusCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalStatusCanvas.cpp deleted file mode 100644 index 32818f32261..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalStatusCanvas.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalStatusCanvas.h" -#include "nsCalUICIID.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalStatusCanvasCID, NS_CAL_STATUSCANVAS_CID); - -nsCalStatusCanvas :: nsCalStatusCanvas(nsISupports* outer) : nsXPFCCanvas(outer) -{ - NS_INIT_REFCNT(); -} - -nsCalStatusCanvas :: ~nsCalStatusCanvas() -{ -} - -nsresult nsCalStatusCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalStatusCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) (nsCalStatusCanvas *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalStatusCanvas) -NS_IMPL_RELEASE(nsCalStatusCanvas) - -nsresult nsCalStatusCanvas :: Init() -{ - return NS_OK; -} - diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarCanvas.cpp deleted file mode 100644 index 971d9316f6c..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarCanvas.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTimebarCanvas.h" -#include "nsCalUICIID.h" -#include "nsXPFCToolkit.h" -#include "nsBoxLayout.h" -#include "nsxpfcCIID.h" -#include "nsIXPFCObserverManager.h" -#include "nsIServiceManager.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalTimebarCanvasCID, NS_CAL_TIMEBARCANVAS_CID); -static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); -static NS_DEFINE_IID(kIXPFCObserverManagerIID, NS_IXPFC_OBSERVERMANAGER_IID); - -#define LOCAL_INSET 1 - -nsCalTimebarCanvas :: nsCalTimebarCanvas(nsISupports* outer) : nsCalCanvas(outer) -{ - NS_INIT_REFCNT(); - mTimeContext = nsnull; -} - -nsCalTimebarCanvas :: ~nsCalTimebarCanvas() -{ - NS_IF_RELEASE(mTimeContext); -} - -nsresult nsCalTimebarCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalTimebarCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) (nsCalTimebarCanvas *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalTimebarCanvas) -NS_IMPL_RELEASE(nsCalTimebarCanvas) - -nsresult nsCalTimebarCanvas :: Init() -{ - static NS_DEFINE_IID(kCCalTimeContextCID, NS_CAL_TIME_CONTEXT_CID); - static NS_DEFINE_IID(kCCalTimeContextIID, NS_ICAL_TIME_CONTEXT_IID); - - nsresult res = nsRepository::CreateInstance(kCCalTimeContextCID, - nsnull, - kCCalTimeContextIID, - (void **)&mTimeContext); - - if (NS_OK != res) - return res ; - - mTimeContext->Init(); - - return (nsCalCanvas::Init()); -} - -PRUint32 nsCalTimebarCanvas::GetVisibleMajorIntervals() -{ - PRUint32 inc = mTimeContext->GetMajorIncrementInterval() ; - PRUint32 delta = mTimeContext->GetVisibleTimeDifference(); - - if ((delta/inc) > 1000) { - PRUint32 inc2 = mTimeContext->GetMajorIncrementInterval() ; - PRUint32 delta2 = mTimeContext->GetVisibleTimeDifference(); - } - - return (delta / inc) ; -} - -PRUint32 nsCalTimebarCanvas::GetVisibleMinorIntervals() -{ - return (mTimeContext->GetMinorIncrementInterval()) ; -} - -nsICalTimeContext * nsCalTimebarCanvas :: GetTimeContext() -{ - /* - * If we have one, just return it - */ - - if (mTimeContext != nsnull) - return (mTimeContext); - - /* - * If we do not have one, look up the hierarchy. We need to be - * careful here. We must look for the first parent that implements - * our interface - */ - - nsIXPFCCanvas * parent = GetParent(); - nsCalTimebarCanvas * time_canvas = nsnull; - nsresult res ; - - while (parent != nsnull) - { - - res = parent->QueryInterface(kCalTimebarCanvasCID,(void**)time_canvas); - - if (res == NS_OK) - { - /* - * Check this parent - */ - - nsICalTimeContext * context = time_canvas->GetTimeContext(); - - NS_RELEASE(time_canvas); - - return context; - } - - parent = parent->GetParent(); - - } - - return nsnull; - -} - - -nsEventStatus nsCalTimebarCanvas :: PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - /* - * Let the Base Canvas paint it's default background - */ - - nsRect rect; - nsCalCanvas::PaintBackground(aRenderingContext,aDirtyRect); - - /* - * Now paint the TimeContext over the base canvas background - * - * We need to find the amount of time between first and last - * visible divied by the major increment. This is the number - * of time intervals. Then divide majorincrement by minor - * increment to get number intervals between those - */ - - if (!mTimeContext) - return nsEventStatus_eConsumeNoDefault; - - PRUint32 major_intervals = GetVisibleMajorIntervals(); - PRUint32 minor_intervals = GetVisibleMinorIntervals(); - - GetBounds(rect); - - PRUint32 space_per_interval, start; - - if (((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment() == eLayoutAlignment_horizontal) - { - space_per_interval = ((rect.width-(2*LOCAL_INSET)) - ((rect.width-(2*LOCAL_INSET)) % major_intervals)) / major_intervals; - start = rect.x+LOCAL_INSET; - } else { - space_per_interval = ((rect.height-(2*LOCAL_INSET)) - ((rect.height-(2*LOCAL_INSET)) % major_intervals)) / major_intervals; - start = rect.y+LOCAL_INSET; - } - - PRUint32 i = 0; - - for (i=0; i<=major_intervals; i++) { - - PaintInterval(aRenderingContext, aDirtyRect, i,start,space_per_interval, minor_intervals); - - start += space_per_interval; - - } - - return nsEventStatus_eConsumeNoDefault; -} - -nsresult nsCalTimebarCanvas::PaintInterval(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - PRUint32 aIndex, - PRUint32 aStart, - PRUint32 aSpace, - PRUint32 aMinorInterval) -{ - /* - * Paint this interval in it's entirety - */ - - nsRect rect; - - GetBounds(rect); - - aRenderingContext.SetColor(GetForegroundColor()); - - if (((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment() == eLayoutAlignment_horizontal) { - rect.x = aStart; - rect.width = aSpace; - aRenderingContext.DrawLine(rect.x, rect.y+LOCAL_INSET, rect.x, rect.y+rect.height-LOCAL_INSET); - } else { - rect.y = aStart; - rect.height = aSpace; - aRenderingContext.DrawLine(rect.x+LOCAL_INSET, rect.y, rect.x+rect.width-LOCAL_INSET, rect.y); - } - - return NS_OK ; -} - -nsresult nsCalTimebarCanvas :: SetParameter(nsString& aKey, nsString& aValue) -{ - return (nsCalCanvas::SetParameter(aKey, aValue)); -} - -/* - * Call SetContext on all child canvas that support the - * nsCalTimebarCanvas interface. This routine is recursive. - * - * We need to store this TimeContext for ourselves also in case - * we get asked to add new DayView Canvas's, we'll ask the DayView - * to copy our context to start with. - */ - -nsresult nsCalTimebarCanvas :: SetTimeContext(nsICalTimeContext * aContext) -{ - - NS_IF_RELEASE(mTimeContext); - mTimeContext = aContext; - NS_ADDREF(mTimeContext); - - return (NS_OK); -} - -nsresult nsCalTimebarCanvas :: ChangeChildDateTime(nsCalTimebarCanvas * aCanvas, - nsDateTime * aDateTime) -{ - - nsIDateTime * datetime; - nsICalTimeContext * context = aCanvas->GetTimeContext(); - - if (context == nsnull) - return NS_OK; - - context->SetDate(aDateTime); - - datetime = context->GetDTStart() ; - datetime->SetYear(aDateTime->GetYear()); - datetime->SetMonth(aDateTime->GetMonth()); - datetime->SetDay(aDateTime->GetDay()); - - datetime = context->GetDTEnd() ; - datetime->SetYear(aDateTime->GetYear()); - datetime->SetMonth(aDateTime->GetMonth()); - datetime->SetDay(aDateTime->GetDay()+1); - - datetime = context->GetDTFirstVisible() ; - datetime->SetYear(aDateTime->GetYear()); - datetime->SetMonth(aDateTime->GetMonth()); - datetime->SetDay(aDateTime->GetDay()); - - datetime = context->GetDTLastVisible() ; - datetime->SetYear(aDateTime->GetYear()); - datetime->SetMonth(aDateTime->GetMonth()); - datetime->SetDay(aDateTime->GetDay()); - - return NS_OK; -} - -nsresult nsCalTimebarCanvas :: SetChildTimeContext(nsCalTimebarCanvas * aCanvas, - nsICalTimeContext * aContext, - PRUint32 increment) -{ - nsICalTimeContext * context; - - static NS_DEFINE_IID(kCCalTimeContextCID, NS_CAL_TIME_CONTEXT_CID); - static NS_DEFINE_IID(kCCalTimeContextIID, NS_ICAL_TIME_CONTEXT_IID); - - nsresult res = nsRepository::CreateInstance(kCCalTimeContextCID, - nsnull, - kCCalTimeContextIID, - (void **)&context); - - if (NS_OK != res) - return res ; - - context->Init(); - - context->Copy(aContext); - - /* - * Register this context to observe the copied context. We'll - * need to deal with context mgmt if these things get frivolously - * destroyed/created. - */ - static NS_DEFINE_IID(kXPFCObserverIID, NS_IXPFC_OBSERVER_IID); - static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); - - nsIXPFCSubject * context_subject; - nsIXPFCObserver * context_observer; - - aContext->QueryInterface(kXPFCSubjectIID, (void **)&context_subject); - context->QueryInterface(kXPFCObserverIID, (void **)&context_observer); - - nsIXPFCObserverManager* om; - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - - om->Register(context_subject, context_observer); - - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - NS_RELEASE(context_subject); - NS_RELEASE(context_observer); - - /* - * TODO: Add the increment here for the appropriate period - */ - - aCanvas->SetTimeContext(context); - - - context->AddPeriod(nsCalPeriodFormat_kDay,increment); - - NS_RELEASE(context); - - return NS_OK; -} - - - -nsresult nsCalTimebarCanvas :: ChangeChildDateTime(PRUint32 aIndex, nsDateTime * aDateTime) -{ - nsresult res = NS_OK; - nsIIterator * iterator ; - nsCalTimebarCanvas * canvas ; - PRUint32 index = 0; - - res = CreateIterator(&iterator); - - if (NS_OK != res) - return res; - - iterator->Init(); - - while((!(iterator->IsDone()))) - { - - if ((index == aIndex)) { - - /* - * Iterate through these children til we find the right one - */ - - canvas = (nsCalTimebarCanvas *) iterator->CurrentItem(); - - nsresult res2 = NS_OK; - nsIIterator * iterator2 ; - nsCalTimebarCanvas * canvas2 ; - - res2 = canvas->CreateIterator(&iterator2); - - if (NS_OK != res2) - return res2; - - iterator2->Init(); - - while(!(iterator2->IsDone())) - { - - canvas2 = (nsCalTimebarCanvas *) iterator2->CurrentItem(); - - nsCalTimebarCanvas * canvas_iface = nsnull;; - - canvas2->QueryInterface(kCalTimebarCanvasCID, (void**) &canvas_iface); - - if ((canvas_iface != nsnull)) { - - ChangeChildDateTime(canvas_iface, aDateTime); - - NS_RELEASE(canvas_iface); - } - - iterator2->Next(); - - } - - } - - index++; - iterator->Next(); - } - - return res; -} - diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarComponentCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarComponentCanvas.cpp deleted file mode 100644 index d9d8174283b..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarComponentCanvas.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTimebarComponentCanvas.h" -#include "nsCalUICIID.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalTimebarComponentCanvasCID, NS_CAL_TIMEBARCOMPONENTCANVAS_CID); - -nsCalTimebarComponentCanvas :: nsCalTimebarComponentCanvas(nsISupports* outer) : nsCalTimebarCanvas(outer) -{ - NS_INIT_REFCNT(); - mComponentColor = NS_RGB(68,141,192); -} - -nsCalTimebarComponentCanvas :: ~nsCalTimebarComponentCanvas() -{ -} - -nsresult nsCalTimebarComponentCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalTimebarComponentCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalTimebarCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalTimebarComponentCanvas) -NS_IMPL_RELEASE(nsCalTimebarComponentCanvas) - -nsresult nsCalTimebarComponentCanvas :: Init() -{ - SetBackgroundColor(NS_RGB(255,255,255)); - return (nsCalTimebarCanvas::Init()) ; -} diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarHeading.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarHeading.cpp deleted file mode 100644 index d7966e52714..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarHeading.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTimebarHeading.h" -#include "nsCalUICIID.h" - -#include "nspr.h" -#include "nsCRT.h" -#include "nsIRenderingContext.h" -#include "nsIFontMetrics.h" - -#define USER_HEADER "Rickety Cricket's Agenda" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalTimebarHeadingCID, NS_CAL_TIMEBARHEADING_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); - -#define DEFAULT_WIDTH 25 -#define DEFAULT_HEIGHT 25 - -nsCalTimebarHeading :: nsCalTimebarHeading(nsISupports* outer) : nsCalTimebarCanvas(outer) -{ - NS_INIT_REFCNT(); -} - -nsCalTimebarHeading :: ~nsCalTimebarHeading() -{ -} - -nsresult nsCalTimebarHeading::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalTimebarHeadingCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } -return (nsCalTimebarCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalTimebarHeading) -NS_IMPL_RELEASE(nsCalTimebarHeading) - -nsresult nsCalTimebarHeading :: Init() -{ - return NS_OK ; -} - -nsEventStatus nsCalTimebarHeading :: PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - /* - * Let the Base Canvas paint it's default background - */ - - nsXPFCCanvas::PaintBackground(aRenderingContext,aDirtyRect); - - return nsEventStatus_eConsumeNoDefault; -} - -nsresult nsCalTimebarHeading :: SetParameter(nsString& aKey, nsString& aValue) -{ - return (nsCalTimebarCanvas::SetParameter(aKey, aValue)); -} - -nsresult nsCalTimebarHeading :: GetClassPreferredSize(nsSize& aSize) -{ - aSize.width = DEFAULT_WIDTH; - aSize.height = DEFAULT_HEIGHT; - return (NS_OK); -} diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarScale.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarScale.cpp deleted file mode 100644 index acd139ca961..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarScale.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTimebarScale.h" -#include "nsCalUICIID.h" - -#include "nspr.h" -#include "nsCRT.h" -#include "nsIRenderingContext.h" -#include "nsIFontMetrics.h" -#include "nsBoxLayout.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalTimebarScaleCID, NS_CAL_TIMEBARSCALE_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); - -#define DEFAULT_WIDTH 39 -#define DEFAULT_HEIGHT 50 - -#define INSET 2 - -nsCalTimebarScale :: nsCalTimebarScale(nsISupports* outer) : nsCalTimebarCanvas(outer) -{ - NS_INIT_REFCNT(); - SetNameID(nsString("TimebarScale")); - - /* - * This is a bit of a hack until we figure out where - * this preference should go. We want to set the background - * and foreground colors of certain classes of widgets... - */ - SetBackgroundColor(NS_RGB(68,141,192)); - SetForegroundColor(NS_RGB(255,255,255)); -} - -nsCalTimebarScale :: ~nsCalTimebarScale() -{ -} - -nsresult nsCalTimebarScale::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalTimebarScaleCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalTimebarCanvas::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalTimebarScale) -NS_IMPL_RELEASE(nsCalTimebarScale) - -/* - * Create a TimeContext with default values for now. - */ - -nsresult nsCalTimebarScale :: Init() -{ - return (nsCalTimebarCanvas::Init()); -} - -/* - * The TimeContext contains the data we use for figuring out how to draw - * ourselves. Get the data from it - */ - -nsresult nsCalTimebarScale::PaintInterval(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - PRUint32 aIndex, - PRUint32 aStart, - PRUint32 aSpace, - PRUint32 aMinorInterval) -{ - int i; - - aRenderingContext.PushState(); - nsFont font(/* m_sFontName*/ "Arial", NS_FONT_STYLE_NORMAL, - NS_FONT_VARIANT_NORMAL, - NS_FONT_WEIGHT_BOLD, - 0, - 12); - aRenderingContext.SetFont(font) ; - - /* - * Paint this interval in it's entirety - */ - nsCalTimebarCanvas::PaintInterval(aRenderingContext, aDirtyRect, aIndex, aStart, aSpace, aMinorInterval); - nsRect rect; - GetBounds(rect); - - aRenderingContext.SetColor(GetForegroundColor()); - - aMinorInterval = 4; // XXX: this is a hack, we should specify this in the XML -sman - - if (((nsBoxLayout *)(GetLayout()))->GetLayoutAlignment() == eLayoutAlignment_horizontal) - { - rect.x = aStart; - rect.width = aSpace; - - /* - * draw the minor ticks... - */ - PRUint32 iYStart = rect.y + (aSpace * 3 / 4); - PRUint32 iYStop = rect.y + rect.height - INSET; - PRUint32 iXSpace = rect.height / aMinorInterval; - PRUint32 iX = rect.x + iXSpace; - for (i = 0; i < (PRUint32) aMinorInterval; i++) - { - aRenderingContext.DrawLine(iX,iYStart, iX,iYStop); - iX += iXSpace; - } - } - else - { - /* - * Vertical version - */ - rect.y = aStart; - rect.height = aSpace; - - /* - * draw the minor ticks... - */ - PRUint32 iXStart = rect.x + rect.width * 3 / 4; - PRUint32 iXStop = rect.x + rect.width - INSET; - PRUint32 iYSpace = rect.height/ aMinorInterval; - PRUint32 iY = rect.y + INSET + iYSpace; - for (i = 1; i < (PRUint32) aMinorInterval; i++) - { - aRenderingContext.DrawLine(iXStart,iY, iXStop,iY); - iY += iYSpace; - } - } - - DrawTime(aRenderingContext, rect, aIndex); - - aRenderingContext.PopState(); - return NS_OK ; -} - -nsresult nsCalTimebarScale :: DrawTime(nsIRenderingContext& aContext, - nsRect& aRect, - PRUint32 aIndex) -{ - - /* - * XXX: Create the String we will draw. We need to make this Unicode - * and support the various formats and time periods.... - */ - - char text[20]; - PRUint32 hour; - nscoord width, height, x, y; - PRBool bAmPmFlag = PR_TRUE; - PRBool bPM; - - hour = aIndex + GetTimeContext()->GetFirstVisibleTime(); - - - if ( bAmPmFlag ) - { - bPM = (hour >= 12); - if (hour == 0) - hour = 12; - else if (hour > 12) - hour -= 12; - PR_snprintf(text, 6, "%2d %s\0", hour, bPM ? "PM" : "AM" ); - } - else - { - PR_snprintf(text, 6, "%2d:00\0", hour); - } - - /* - * compute the Metrics for the string - */ - - aContext.GetFontMetrics()->GetHeight(height); - aContext.GetWidth(text,width); - - /* - * center the text in our rect and draw it - */ -/* - x = ((aRect.width - width)>>1)+aRect.x; - y = ((aRect.height - height)>>1)+aRect.y; -*/ - x = aRect.x + (INSET << 1); - y = aRect.y + (INSET << 1); - - nsString string = text; - - aContext.DrawString(string,x,y,0); - - return (NS_OK); -} - -nsEventStatus nsCalTimebarScale :: PaintBorder(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - nsRect rect; - - GetBounds(rect); - - rect.x++; rect.y++; rect.width-=2; rect.height-=2; - aRenderingContext.SetColor(GetForegroundColor()); - aRenderingContext.DrawRect(rect); - - return nsEventStatus_eConsumeNoDefault; -} - -nsresult nsCalTimebarScale :: SetParameter(nsString& aKey, nsString& aValue) -{ - return (nsCalTimebarCanvas::SetParameter(aKey, aValue)); -} - -nsresult nsCalTimebarScale :: GetClassPreferredSize(nsSize& aSize) -{ - aSize.width = DEFAULT_WIDTH; - aSize.height = DEFAULT_HEIGHT; - return (NS_OK); -} diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarTimeHeading.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarTimeHeading.cpp deleted file mode 100644 index 826ff8208cc..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarTimeHeading.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTimebarTimeHeading.h" -#include "nsCalUICIID.h" - -#include "nspr.h" -#include "nsCRT.h" -#include "nsIRenderingContext.h" -#include "nsIFontMetrics.h" -#include "nsIDeviceContext.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalTimebarTimeHeadingCID, NS_CAL_TIMEBARUSERHEADING_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); - -nsCalTimebarTimeHeading :: nsCalTimebarTimeHeading(nsISupports* outer) : nsCalTimebarHeading(outer) -{ - NS_INIT_REFCNT(); -} - -nsCalTimebarTimeHeading :: ~nsCalTimebarTimeHeading() -{ -} - -nsresult nsCalTimebarTimeHeading::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalTimebarTimeHeadingCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalTimebarHeading::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalTimebarTimeHeading) -NS_IMPL_RELEASE(nsCalTimebarTimeHeading) - -nsresult nsCalTimebarTimeHeading :: Init() -{ - return NS_OK ; -} - -nsEventStatus nsCalTimebarTimeHeading :: PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - - if (GetTimeContext() == nsnull) - return nsEventStatus_eConsumeNoDefault; - - nscoord width, height, x, y; - - nsRect rect; - - GetBounds(rect); - - nsString * string; - nsString pattern("EEE MMM-dd\n"); - - GetTimeContext()->GetDTFirstVisible()->strftime(pattern, &string); - - /* - * set the font... - */ - aRenderingContext.PushState(); - nsFont font(/* m_sFontName*/ "Arial", NS_FONT_STYLE_NORMAL, - NS_FONT_VARIANT_NORMAL, - NS_FONT_WEIGHT_BOLD, - 0, - 12); - aRenderingContext.SetFont(font) ; - - /* - * compute the Metrics for the string - */ - - aRenderingContext.GetFontMetrics()->GetHeight(height); - aRenderingContext.GetWidth(*string,width); - - /* - * XXX: If we are too big, remove the Day of the week. Need a better algorithm - * to use string who fits to begin with - */ - - if (width > rect.width) - { - pattern = "MMM dd\n"; - GetTimeContext()->GetDTFirstVisible()->strftime(pattern, &string); - aRenderingContext.GetWidth(*string,width); - } - - /* - * center the text in our rect and draw it - */ - - x = ((rect.width - width)>>1)+rect.x; - y = ((rect.height - height)>>1)+rect.y; - - aRenderingContext.SetColor(GetForegroundColor()); - aRenderingContext.DrawString(*string,x,y,0); - - aRenderingContext.PopState(); - - return nsEventStatus_eConsumeNoDefault; -} - -nsEventStatus nsCalTimebarTimeHeading :: PaintBackground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - /* - * Let the Base Canvas paint it's default background - */ - - nsXPFCCanvas::PaintBackground(aRenderingContext,aDirtyRect); - - return nsEventStatus_eConsumeNoDefault; -} - -nsresult nsCalTimebarTimeHeading :: SetParameter(nsString& aKey, nsString& aValue) -{ - return (nsCalTimebarCanvas::SetParameter(aKey, aValue)); -} diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarUserHeading.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarUserHeading.cpp deleted file mode 100644 index 43573770f9a..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalTimebarUserHeading.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTimebarUserHeading.h" -#include "nsCalUICIID.h" - -#include "nspr.h" -#include "nsCRT.h" -#include "nsIRenderingContext.h" -#include "nsIFontMetrics.h" -#include "nscalstrings.h" -#include "nsIDeviceContext.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalTimebarUserHeadingCID, NS_CAL_TIMEBARUSERHEADING_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); - -#define DEFAULT_WIDTH 25 -#define DEFAULT_HEIGHT 25 - -nsCalTimebarUserHeading :: nsCalTimebarUserHeading(nsISupports* outer) : nsCalTimebarHeading(outer) -{ - NS_INIT_REFCNT(); - mUserName = CAL_STRING_DEFAULTUSERNAME; -} - -nsCalTimebarUserHeading :: ~nsCalTimebarUserHeading() -{ -} - -nsresult nsCalTimebarUserHeading::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalTimebarUserHeadingCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalTimebarHeading::QueryInterface(aIID,aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalTimebarUserHeading) -NS_IMPL_RELEASE(nsCalTimebarUserHeading) - -nsresult nsCalTimebarUserHeading :: Init() -{ - return NS_OK ; -} - -nsEventStatus nsCalTimebarUserHeading :: PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - nscoord width, height, x, y; - - nsRect rect; - GetBounds(rect); - - /* - * compute the Metrics for the string - */ - - aRenderingContext.GetFontMetrics()->GetHeight(height); - aRenderingContext.GetWidth(mUserName,width); - - /* - * center the text in our rect and draw it - */ - - x = ((rect.width - width)>>1)+rect.x; - y = ((rect.height - height)>>1)+rect.y; - - aRenderingContext.SetColor(GetForegroundColor()); - aRenderingContext.DrawString(mUserName,x,y,0); - - return nsEventStatus_eConsumeNoDefault; -} - -nsresult nsCalTimebarUserHeading :: SetParameter(nsString& aKey, nsString& aValue) -{ - if (aKey.EqualsIgnoreCase(CAL_STRING_TITLE)) - SetUserName(aValue); - - return (nsCalTimebarCanvas::SetParameter(aKey, aValue)); -} - -nsresult nsCalTimebarUserHeading :: SetUserName(nsString& aString) -{ - mUserName = aString; - return NS_OK; -} - -nsString& nsCalTimebarUserHeading :: GetUserName() -{ - return mUserName; -} - -nsresult nsCalTimebarUserHeading :: GetClassPreferredSize(nsSize& aSize) -{ - aSize.width = DEFAULT_WIDTH; - aSize.height = DEFAULT_HEIGHT; - return (NS_OK); -} diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalTodoComponentCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalTodoComponentCanvas.cpp deleted file mode 100644 index 4a764d61b74..00000000000 --- a/mozilla/calendar/modules/ui/canvas/src/nsCalTodoComponentCanvas.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTodoComponentCanvas.h" -#include "nsCalUICIID.h" -#include "nsIListWidget.h" -#include "nsWidgetsCID.h" -#include "nsIDeviceContext.h" -#include "nsViewsCID.h" -#include "nsIViewManager.h" -#include "nsCalToolkit.h" - - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalTodoComponentCanvasCID, NS_CAL_TODOCOMPONENTCANVAS_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); -static NS_DEFINE_IID(kIListWidgetIID, NS_ILISTWIDGET_IID); -static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); -static NS_DEFINE_IID(kCListWidgetCID, NS_LISTBOX_CID); -static NS_DEFINE_IID(kViewCID, NS_VIEW_CID); - -nsCalTodoComponentCanvas :: nsCalTodoComponentCanvas(nsISupports* outer) : nsCalTimebarComponentCanvas(outer) -{ - NS_INIT_REFCNT(); -} - -nsCalTodoComponentCanvas :: ~nsCalTodoComponentCanvas() -{ -} - -nsresult nsCalTodoComponentCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalTodoComponentCanvasCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - return (nsCalTimebarComponentCanvas::QueryInterface(aIID,aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalTodoComponentCanvas) -NS_IMPL_RELEASE(nsCalTodoComponentCanvas) - -nsresult nsCalTodoComponentCanvas :: Init() -{ - nsRect rect; - - GetBounds(rect); - - LoadView(kViewCID, &kCListWidgetCID); - - nsIWidget * widget = nsnull; - nsIListWidget * listWidget = nsnull; - - mView->GetWidget(widget); - nsresult res = widget->QueryInterface(kIListWidgetIID, (void**)&listWidget); - - nsIDeviceContext * context; - - gXPFCToolkit->GetViewManager()->GetDeviceContext(context); - - listWidget->AddItemAt(nsString("TODO LIST"),-1); - listWidget->AddItemAt(nsString("---------"),-1); - listWidget->AddItemAt(nsString("Todo: Item #1"),-1); - listWidget->AddItemAt(nsString("Todo: Item #2"),-1); - listWidget->AddItemAt(nsString("Todo: Item #3"),-1); - listWidget->AddItemAt(nsString("Todo: Item #4"),-1); - listWidget->AddItemAt(nsString("Todo: Item #5"),-1); - listWidget->AddItemAt(nsString("Todo: Item #6"),-1); - listWidget->AddItemAt(nsString("Todo: Item #7"),-1); - listWidget->AddItemAt(nsString("Todo: Item #8"),-1); - listWidget->AddItemAt(nsString("Todo: Item #9"),-1); - listWidget->AddItemAt(nsString("Todo: Item #10"),-1); - - gXPFCToolkit->GetViewManager()->MoveViewTo(mView, rect.x, rect.y); - gXPFCToolkit->GetViewManager()->ResizeView(mView, rect.width, rect.height); - gXPFCToolkit->GetViewManager()->UpdateView(mView, rect, NS_VMREFRESH_AUTO_DOUBLE_BUFFER | NS_VMREFRESH_NO_SYNC) ; - - NS_RELEASE(context); - NS_RELEASE(widget); - NS_RELEASE(listWidget); - - SetBackgroundColor(NS_RGB(255,255,192)); - - return NS_OK; -} - -nsresult nsCalTodoComponentCanvas :: SetBounds(const nsRect &aBounds) -{ - return (nsXPFCCanvas::SetBounds(aBounds)); -} - - -void nsCalTodoComponentCanvas :: SetBackgroundColor(const nscolor &aColor) -{ - nsXPFCCanvas::SetBackgroundColor(aColor); -} - -nsEventStatus nsCalTodoComponentCanvas :: OnPaint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - return (nsEventStatus_eConsumeNoDefault); -} - -nsEventStatus nsCalTodoComponentCanvas :: HandleEvent(nsGUIEvent *aEvent) -{ - return (nsEventStatus_eIgnore); -} \ No newline at end of file diff --git a/mozilla/calendar/modules/ui/command/Makefile b/mozilla/calendar/modules/ui/command/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/command/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/command/inc/Makefile b/mozilla/calendar/modules/ui/command/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/command/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/command/inc/manifest.mn b/mozilla/calendar/modules/ui/command/inc/manifest.mn deleted file mode 100644 index a096637df2e..00000000000 --- a/mozilla/calendar/modules/ui/command/inc/manifest.mn +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsCalMccCommand.h \ - nsCalDurationCommand.h \ - nsCalDayListCommand.h \ - nsCalFetchEventsCommand.h \ - nsCalNewModelCommand.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/command/inc/nsCalDayListCommand.h b/mozilla/calendar/modules/ui/command/inc/nsCalDayListCommand.h deleted file mode 100644 index f4f8d22d375..00000000000 --- a/mozilla/calendar/modules/ui/command/inc/nsCalDayListCommand.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalDayListCommand_h___ -#define nsCalDayListCommand_h___ - -#include "nsXPFCCommand.h" -#include "nsCalUtilCIID.h" -#include "nsIArray.h" -#include "nsIIterator.h" -#include "nsIDateTime.h" - - -class nsCalDayListCommand : public nsXPFCCommand -{ -public: - nsCalDayListCommand(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init() ; - NS_IMETHOD CreateIterator(nsIIterator ** aIterator) ; - - NS_IMETHOD AddDateTime(nsIDateTime * aDateTime); - NS_IMETHOD AddDateVector(nsIArray * aDateVector); - -protected: - ~nsCalDayListCommand(); - -private: - nsIArray * mDateTimes ; - - -}; - -#endif /* nsCalDayListCommand_h___ */ diff --git a/mozilla/calendar/modules/ui/command/inc/nsCalDurationCommand.h b/mozilla/calendar/modules/ui/command/inc/nsCalDurationCommand.h deleted file mode 100644 index 4d1b3e85fd2..00000000000 --- a/mozilla/calendar/modules/ui/command/inc/nsCalDurationCommand.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalDurationCommand_h___ -#define nsCalDurationCommand_h___ - -#include "nsXPFCCommand.h" -#include "nsDuration.h" -#include "nsCalPeriodFormat.h" - -class nsCalDurationCommand : public nsXPFCCommand -{ -public: - nsCalDurationCommand(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(nsDuration * aDuration) ; - - NS_IMETHOD_(nsDuration *) GetDuration(); - NS_IMETHOD SetDuration(nsDuration * aDuration); - - NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat(); - NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat); - -private: - nsCalPeriodFormat mPeriodFormat; - nsDuration * mDuration; - -protected: - ~nsCalDurationCommand(); - -}; - -#endif /* nsCalDurationCommand_h___ */ diff --git a/mozilla/calendar/modules/ui/command/inc/nsCalFetchEventsCommand.h b/mozilla/calendar/modules/ui/command/inc/nsCalFetchEventsCommand.h deleted file mode 100644 index 628a6757f7d..00000000000 --- a/mozilla/calendar/modules/ui/command/inc/nsCalFetchEventsCommand.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalFetchEventsCommand_h___ -#define nsCalFetchEventsCommand_h___ - -#include "nsXPFCCommand.h" -#include "nsCalUtilCIID.h" -#include "nsIDateTime.h" - -class nsCalFetchEventsCommand : public nsXPFCCommand -{ -public: - nsCalFetchEventsCommand(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init() ; - -protected: - ~nsCalFetchEventsCommand(); - -public: - nsIDateTime * mStartDate; - nsIDateTime * mEndDate; - -}; - -#endif /* nsCalFetchEventsCommand_h___ */ diff --git a/mozilla/calendar/modules/ui/command/inc/nsCalMccCommand.h b/mozilla/calendar/modules/ui/command/inc/nsCalMccCommand.h deleted file mode 100644 index 3f0453dca7f..00000000000 --- a/mozilla/calendar/modules/ui/command/inc/nsCalMccCommand.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalMccCommand_h___ -#define nsCalMccCommand_h___ - -#include "nsXPFCCommand.h" -#include "nsCalUtilCIID.h" - -class nsCalMccCommand : public nsXPFCCommand -{ -public: - nsCalMccCommand(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init() ; - -protected: - ~nsCalMccCommand(); - -public: - - -}; - -#endif /* nsCalMccCommand_h___ */ diff --git a/mozilla/calendar/modules/ui/command/inc/nsCalNewModelCommand.h b/mozilla/calendar/modules/ui/command/inc/nsCalNewModelCommand.h deleted file mode 100644 index 97e9595a1c4..00000000000 --- a/mozilla/calendar/modules/ui/command/inc/nsCalNewModelCommand.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalNewModelCommand_h___ -#define nsCalNewModelCommand_h___ - -#include "nsXPFCCommand.h" -#include "nsCalUtilCIID.h" -#include "nsIModel.h" - - -class nsCalNewModelCommand : public nsXPFCCommand -{ -public: - nsCalNewModelCommand(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init() ; - -protected: - ~nsCalNewModelCommand(); - -public: - nsIModel * mModel; - - -}; - -#endif /* nsCalNewModelCommand_h___ */ diff --git a/mozilla/calendar/modules/ui/command/manifest.mn b/mozilla/calendar/modules/ui/command/manifest.mn deleted file mode 100644 index 364aaa1bd7f..00000000000 --- a/mozilla/calendar/modules/ui/command/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/ui/command/src/Makefile b/mozilla/calendar/modules/ui/command/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/ui/command/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/command/src/config.mk b/mozilla/calendar/modules/ui/command/src/config.mk deleted file mode 100644 index 9f912b4e6b5..00000000000 --- a/mozilla/calendar/modules/ui/command/src/config.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES +=-I../inc -I$(GDEPTH)/include - -LIBRARY_NAME = command -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) - diff --git a/mozilla/calendar/modules/ui/command/src/manifest.mn b/mozilla/calendar/modules/ui/command/src/manifest.mn deleted file mode 100644 index 31273d94af0..00000000000 --- a/mozilla/calendar/modules/ui/command/src/manifest.mn +++ /dev/null @@ -1,28 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalDurationCommand.cpp \ - nsCalDayListCommand.cpp \ - nsCalFetchEventsCommand.cpp \ - nsCalNewModelCommand.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex julian nls xpfc - diff --git a/mozilla/calendar/modules/ui/command/src/nsCalDayListCommand.cpp b/mozilla/calendar/modules/ui/command/src/nsCalDayListCommand.cpp deleted file mode 100644 index ec47eaad253..00000000000 --- a/mozilla/calendar/modules/ui/command/src/nsCalDayListCommand.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsCalDayListCommand.h" -#include "nsCalUICIID.h" -#include "nsCalUtilCIID.h" -#include "nsIArray.h" -#include "nsIIterator.h" -#include "nsxpfcCIID.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); - -static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID); -static NS_DEFINE_IID(kCVectorIteratorCID, NS_ARRAY_ITERATOR_CID); - -nsCalDayListCommand :: nsCalDayListCommand() -{ - NS_INIT_REFCNT(); - mDateTimes = nsnull; -} - -nsCalDayListCommand :: ~nsCalDayListCommand() -{ - NS_IF_RELEASE(mDateTimes); -} - -NS_IMPL_ADDREF(nsCalDayListCommand) -NS_IMPL_RELEASE(nsCalDayListCommand) - -nsresult nsCalDayListCommand::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kXPFCCommandIID); - static NS_DEFINE_IID(kCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kCalDayListCommandCID)) { - *aInstancePtr = (void*)(nsCalDayListCommand *) (this); - AddRef(); - return NS_OK; - } - - return (NS_NOINTERFACE); - -} - -nsresult nsCalDayListCommand::Init() -{ - nsresult res ; - - - res = nsRepository::CreateInstance(kCVectorCID, - nsnull, - kCVectorCID, - (void **)&mDateTimes); - - if (NS_OK != res) - return res ; - - mDateTimes->Init(); - - return res ; -} - -nsresult nsCalDayListCommand :: CreateIterator(nsIIterator ** aIterator) -{ - if (mDateTimes) { - mDateTimes->CreateIterator(aIterator); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - -nsresult nsCalDayListCommand :: AddDateTime(nsIDateTime * aDateTime) -{ - mDateTimes->Append(aDateTime); - - return NS_OK; -} - -nsresult nsCalDayListCommand :: AddDateVector(nsIArray * aDateVector) -{ - NS_IF_RELEASE(mDateTimes); - - mDateTimes = aDateVector; - - mDateTimes->AddRef(); - - return NS_OK; -} diff --git a/mozilla/calendar/modules/ui/command/src/nsCalDurationCommand.cpp b/mozilla/calendar/modules/ui/command/src/nsCalDurationCommand.cpp deleted file mode 100644 index 2e7db8aace8..00000000000 --- a/mozilla/calendar/modules/ui/command/src/nsCalDurationCommand.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsCalDurationCommand.h" -#include "nsCalUICIID.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); - -nsCalDurationCommand :: nsCalDurationCommand() -{ - NS_INIT_REFCNT(); - mDuration = nsnull; - mPeriodFormat = nsCalPeriodFormat_kHour; -} - -nsCalDurationCommand :: ~nsCalDurationCommand() -{ - mDuration = nsnull; -} - -NS_IMPL_ADDREF(nsCalDurationCommand) -NS_IMPL_RELEASE(nsCalDurationCommand) - -nsresult nsCalDurationCommand::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kXPFCCommandIID); - static NS_DEFINE_IID(kCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kCalDurationCommandCID)) { - *aInstancePtr = (void*)(nsCalDurationCommand *) (this); - AddRef(); - return NS_OK; - } - - return (NS_NOINTERFACE); - -} - -nsresult nsCalDurationCommand::Init(nsDuration * aDuration) -{ - mDuration = aDuration; - return NS_OK; -} - -nsresult nsCalDurationCommand::SetDuration(nsDuration * aDuration) -{ - mDuration = aDuration; - return NS_OK; -} - -nsDuration * nsCalDurationCommand::GetDuration() -{ - return (mDuration); -} - -nsresult nsCalDurationCommand::SetPeriodFormat(nsCalPeriodFormat aPeriodFormat) -{ - mPeriodFormat = aPeriodFormat; - return NS_OK; -} - -nsCalPeriodFormat nsCalDurationCommand::GetPeriodFormat() -{ - return (mPeriodFormat); -} diff --git a/mozilla/calendar/modules/ui/command/src/nsCalFetchEventsCommand.cpp b/mozilla/calendar/modules/ui/command/src/nsCalFetchEventsCommand.cpp deleted file mode 100644 index 2a3a6e16358..00000000000 --- a/mozilla/calendar/modules/ui/command/src/nsCalFetchEventsCommand.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsCalFetchEventsCommand.h" -#include "nsCalUICIID.h" -#include "nsCalUtilCIID.h" -#include "nsxpfcCIID.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); - -nsCalFetchEventsCommand :: nsCalFetchEventsCommand() -{ - NS_INIT_REFCNT(); - mStartDate = nsnull; - mEndDate = nsnull; -} - -nsCalFetchEventsCommand :: ~nsCalFetchEventsCommand() -{ -} - -NS_IMPL_ADDREF(nsCalFetchEventsCommand) -NS_IMPL_RELEASE(nsCalFetchEventsCommand) - -nsresult nsCalFetchEventsCommand::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kXPFCCommandIID); - static NS_DEFINE_IID(kCalFetchEventsCommandCID, NS_CAL_FETCHEVENTS_COMMAND_CID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kCalFetchEventsCommandCID)) { - *aInstancePtr = (void*)(nsCalFetchEventsCommand *) (this); - AddRef(); - return NS_OK; - } - - return (NS_NOINTERFACE); - -} - -nsresult nsCalFetchEventsCommand::Init() -{ - return NS_OK ; -} - diff --git a/mozilla/calendar/modules/ui/command/src/nsCalNewModelCommand.cpp b/mozilla/calendar/modules/ui/command/src/nsCalNewModelCommand.cpp deleted file mode 100644 index 1360924fa24..00000000000 --- a/mozilla/calendar/modules/ui/command/src/nsCalNewModelCommand.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsCalNewModelCommand.h" -#include "nsCalUICIID.h" -#include "nsCalUtilCIID.h" -#include "nsxpfcCIID.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); - -nsCalNewModelCommand :: nsCalNewModelCommand() -{ - NS_INIT_REFCNT(); - mModel = nsnull; -} - -nsCalNewModelCommand :: ~nsCalNewModelCommand() -{ -} - -NS_IMPL_ADDREF(nsCalNewModelCommand) -NS_IMPL_RELEASE(nsCalNewModelCommand) - -nsresult nsCalNewModelCommand::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kXPFCCommandIID); - static NS_DEFINE_IID(kCalNewModelCommandCID, NS_CAL_NEWMODEL_COMMAND_CID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kCalNewModelCommandCID)) { - *aInstancePtr = (void*)(nsCalNewModelCommand *) (this); - AddRef(); - return NS_OK; - } - - return (NS_NOINTERFACE); - -} - -nsresult nsCalNewModelCommand::Init() -{ - return NS_OK ; -} - diff --git a/mozilla/calendar/modules/ui/component/Makefile b/mozilla/calendar/modules/ui/component/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/component/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/component/inc/Makefile b/mozilla/calendar/modules/ui/component/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/component/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/component/inc/manifest.mn b/mozilla/calendar/modules/ui/component/inc/manifest.mn deleted file mode 100644 index efdee313e48..00000000000 --- a/mozilla/calendar/modules/ui/component/inc/manifest.mn +++ /dev/null @@ -1,21 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsCalComponent.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/component/inc/nsCalComponent.h b/mozilla/calendar/modules/ui/component/inc/nsCalComponent.h deleted file mode 100644 index b942930a177..00000000000 --- a/mozilla/calendar/modules/ui/component/inc/nsCalComponent.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalComponent_h___ -#define nsCalComponent_h___ - -#include "nsICalComponent.h" - -class nsCalComponent : public nsICalComponent -{ -public: - nsCalComponent(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init() ; - -protected: - ~nsCalComponent(); - -}; - -#endif /* nsCalComponent_h___ */ diff --git a/mozilla/calendar/modules/ui/component/manifest.mn b/mozilla/calendar/modules/ui/component/manifest.mn deleted file mode 100644 index ce741a53d39..00000000000 --- a/mozilla/calendar/modules/ui/component/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = public inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/ui/component/public/Makefile b/mozilla/calendar/modules/ui/component/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/component/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/component/public/manifest.mn b/mozilla/calendar/modules/ui/component/public/manifest.mn deleted file mode 100644 index b9a2699479d..00000000000 --- a/mozilla/calendar/modules/ui/component/public/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -EXPORTS = \ - nsICalComponent.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/component/public/nsICalComponent.h b/mozilla/calendar/modules/ui/component/public/nsICalComponent.h deleted file mode 100644 index ac6d1b09847..00000000000 --- a/mozilla/calendar/modules/ui/component/public/nsICalComponent.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalComponent_h___ -#define nsICalComponent_h___ - -#include "nsISupports.h" - -//e7bba9c0-1f38-11d2-bed9-00805f8a8dbd -#define NS_ICAL_COMPONENT_IID \ -{ 0xe7bba9c0, 0x1f38, 0x11d2, \ -{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -class nsICalComponent : public nsISupports -{ - -public: - - NS_IMETHOD Init() = 0; - -}; - -#endif /* nsICalComponent_h___ */ diff --git a/mozilla/calendar/modules/ui/component/src/Makefile b/mozilla/calendar/modules/ui/component/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/ui/component/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/component/src/config.mk b/mozilla/calendar/modules/ui/component/src/config.mk deleted file mode 100644 index 5d06b6a829f..00000000000 --- a/mozilla/calendar/modules/ui/component/src/config.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -INCLUDES +=-I../inc - -LIBRARY_NAME = component -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) - diff --git a/mozilla/calendar/modules/ui/component/src/manifest.mn b/mozilla/calendar/modules/ui/component/src/manifest.mn deleted file mode 100644 index 0382a8fe5fc..00000000000 --- a/mozilla/calendar/modules/ui/component/src/manifest.mn +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalComponent.cpp \ - $(NULL) - -REQUIRES = xpcom raptor trex - diff --git a/mozilla/calendar/modules/ui/component/src/nsCalComponent.cpp b/mozilla/calendar/modules/ui/component/src/nsCalComponent.cpp deleted file mode 100644 index c57d2285a56..00000000000 --- a/mozilla/calendar/modules/ui/component/src/nsCalComponent.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalComponent.h" -#include "nsCalUICIID.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalComponentIID, NS_ICAL_COMPONENT_IID); - -nsCalComponent :: nsCalComponent() -{ - NS_INIT_REFCNT(); -} - -nsCalComponent :: ~nsCalComponent() -{ -} - -NS_IMPL_ADDREF(nsCalComponent) -NS_IMPL_RELEASE(nsCalComponent) -NS_IMPL_QUERY_INTERFACE(nsCalComponent, kCalComponentIID) - -nsresult nsCalComponent::Init() -{ - return NS_OK; -} - diff --git a/mozilla/calendar/modules/ui/config.mk b/mozilla/calendar/modules/ui/config.mk deleted file mode 100644 index 22a5b66757f..00000000000 --- a/mozilla/calendar/modules/ui/config.mk +++ /dev/null @@ -1,43 +0,0 @@ -# - # CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR - -LD_LIBS += \ - raptorbase \ - $(NATIVE_RAPTOR_GFX) \ - $(NATIVE_RAPTOR_WIDGET) \ - xpcom$(MOZ_BITS) \ - $(NATIVE_LIBNLS_LIBS) \ - xpfc10 \ - util10 \ - cal_core_ical10 \ - calcore10 \ - $(XP_REG_LIB) - -AR_LIBS += \ - canvas \ - core \ - context \ - component \ - controller \ - command \ - toolkit \ - $(NULL) - -OS_LIBS += $(GUI_LIBS) $(MATH_LIB) - -EXTRA_LIBS += $(NSPR_LIBS) - diff --git a/mozilla/calendar/modules/ui/context/Makefile b/mozilla/calendar/modules/ui/context/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/context/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/context/inc/Makefile b/mozilla/calendar/modules/ui/context/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/context/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/context/inc/manifest.mn b/mozilla/calendar/modules/ui/context/inc/manifest.mn deleted file mode 100644 index 525f9bc74e3..00000000000 --- a/mozilla/calendar/modules/ui/context/inc/manifest.mn +++ /dev/null @@ -1,21 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsCalTimeContext.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/context/inc/nsCalTimeContext.h b/mozilla/calendar/modules/ui/context/inc/nsCalTimeContext.h deleted file mode 100644 index aaf867fc7b1..00000000000 --- a/mozilla/calendar/modules/ui/context/inc/nsCalTimeContext.h +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTimeContext_h___ -#define nsCalTimeContext_h___ - -#include "nsICalTimeContext.h" -#include "nsXPFCCanvas.h" -#include "nsIDateTime.h" -#include "nsIXPFCObserver.h" -#include "nsIXPFCCommandReceiver.h" -#include "nsIXPFCSubject.h" -#include "nsIXPFCCommand.h" -#include "nsCalDurationCommand.h" -#include "nsCalDayListCommand.h" -#include "nsIXMLParserObject.h" - - -class nsCalTimeContext : public nsICalTimeContext, - public nsIXPFCObserver, - public nsIXPFCSubject, - public nsIXPFCCommandReceiver, - public nsIXMLParserObject -{ -public: - nsCalTimeContext(); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init() ; - - NS_IMETHOD SetDefaultDateTime(); - - NS_IMETHOD SetStartTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ); - - NS_IMETHOD SetEndTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ); - - NS_IMETHOD SetFirstVisibleTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ); - - NS_IMETHOD SetLastVisibleTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ); - - NS_IMETHOD SetMajorIncrement(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ); - - NS_IMETHOD SetMinorIncrement(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ); - - NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat); - NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat(); - NS_IMETHOD_(PRUint32) GetVisibleTimeDifference() ; - NS_IMETHOD_(PRUint32) GetFirstVisibleTime() ; - NS_IMETHOD_(PRUint32) GetLastVisibleTime() ; - NS_IMETHOD_(PRUint32) GetVisibleTimeDifference(nsCalPeriodFormat aFormat) ; - NS_IMETHOD_(PRUint32) GetFirstVisibleTime(nsCalPeriodFormat aFormat) ; - NS_IMETHOD_(PRUint32) GetLastVisibleTime(nsCalPeriodFormat aFormat) ; - - NS_IMETHOD_(nsIDateTime *) GetDTStart() ; - NS_IMETHOD_(nsIDateTime *) GetDTEnd() ; - NS_IMETHOD_(nsIDateTime *) GetDTFirstVisible(); - NS_IMETHOD_(nsIDateTime *) GetDTLastVisible(); - NS_IMETHOD_(nsIDateTime *) GetDTMajorIncrement(); - NS_IMETHOD_(nsIDateTime *) GetDTMinorIncrement(); - - - NS_IMETHOD_(PRUint32) GetMinorIncrementInterval() ; - NS_IMETHOD_(PRUint32) GetMajorIncrementInterval() ; - - NS_IMETHOD_(nsIDateTime *) GetDate() ; - NS_IMETHOD SetDate(nsIDateTime * aDateTime) ; - - // nsIXPFCObserver methods - NS_IMETHOD_(nsEventStatus) Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand); - - // nsIXPFCCommandReceiver methods - NS_IMETHOD_(nsEventStatus) Action(nsIXPFCCommand * aCommand); - - // nsIXPFCSubject methods - NS_IMETHOD Attach(nsIXPFCObserver * aObserver); - NS_IMETHOD Detach(nsIXPFCObserver * aObserver); - NS_IMETHOD Notify(nsIXPFCCommand * aCommand); - - NS_IMETHOD AddPeriod(nsCalPeriodFormat aFormat, PRUint32 aPeriod) ; - - NS_IMETHOD Copy(nsICalTimeContext * aContext); - - // nsIXMLParserObject methods - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - -protected: - ~nsCalTimeContext(); - -private: - NS_IMETHOD_(nsEventStatus) HandleDurationCommand(nsCalDurationCommand * aDurationCommand); - NS_IMETHOD_(nsEventStatus) HandleDayListCommand(nsCalDayListCommand * aDayListCommand); - -private: - nsIDateTime * mStartTime; - nsIDateTime * mEndTime; - nsIDateTime * mFirstVisibleTime; - nsIDateTime * mLastVisibleTime; - nsIDateTime * mMajorIncrement; - nsIDateTime * mMinorIncrement; - nsCalPeriodFormat mPeriodFormat; - nsIDateTime * mDate; - -}; - -#endif /* nsCalTimeContext_h___ */ diff --git a/mozilla/calendar/modules/ui/context/manifest.mn b/mozilla/calendar/modules/ui/context/manifest.mn deleted file mode 100644 index ce741a53d39..00000000000 --- a/mozilla/calendar/modules/ui/context/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = public inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/ui/context/public/Makefile b/mozilla/calendar/modules/ui/context/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/context/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/context/public/manifest.mn b/mozilla/calendar/modules/ui/context/public/manifest.mn deleted file mode 100644 index 2c03c92cb37..00000000000 --- a/mozilla/calendar/modules/ui/context/public/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -EXPORTS = \ - nsICalTimeContext.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/context/public/nsICalTimeContext.h b/mozilla/calendar/modules/ui/context/public/nsICalTimeContext.h deleted file mode 100644 index d83385ff513..00000000000 --- a/mozilla/calendar/modules/ui/context/public/nsICalTimeContext.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalTimeContext_h___ -#define nsICalTimeContext_h___ - -#include "nsISupports.h" -#include "nsIDateTime.h" - -//91649a00-e9e6-11d1-9244-00805f8a7ab6 -#define NS_ICAL_TIME_CONTEXT_IID \ -{ 0x91649a00, 0xe9e6, 0x11d1, \ -{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -#include "nsCalPeriodFormat.h" - - -class nsICalTimeContext : public nsISupports -{ - -public: - - NS_IMETHOD Init() = 0; - - NS_IMETHOD SetDefaultDateTime() = 0; - - NS_IMETHOD SetStartTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) = 0; - - NS_IMETHOD SetEndTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) = 0; - - NS_IMETHOD SetFirstVisibleTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) = 0; - - NS_IMETHOD SetLastVisibleTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) = 0; - - NS_IMETHOD SetMajorIncrement(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) = 0; - - NS_IMETHOD SetMinorIncrement(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) = 0; - - NS_IMETHOD_(nsIDateTime *) GetDTStart() = 0; - NS_IMETHOD_(nsIDateTime *) GetDTEnd() = 0; - NS_IMETHOD_(nsIDateTime *) GetDTFirstVisible() = 0; - NS_IMETHOD_(nsIDateTime *) GetDTLastVisible() = 0; - NS_IMETHOD_(nsIDateTime *) GetDTMajorIncrement() = 0; - NS_IMETHOD_(nsIDateTime *) GetDTMinorIncrement() = 0; - - NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat) = 0; - NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat() = 0; - - NS_IMETHOD_(PRUint32) GetVisibleTimeDifference() = 0; - NS_IMETHOD_(PRUint32) GetFirstVisibleTime() = 0; - NS_IMETHOD_(PRUint32) GetLastVisibleTime() = 0; - NS_IMETHOD_(PRUint32) GetVisibleTimeDifference(nsCalPeriodFormat aFormat) = 0; - NS_IMETHOD_(PRUint32) GetFirstVisibleTime(nsCalPeriodFormat aFormat) = 0; - NS_IMETHOD_(PRUint32) GetLastVisibleTime(nsCalPeriodFormat aFormat) = 0; - - NS_IMETHOD_(PRUint32) GetMinorIncrementInterval() = 0; - NS_IMETHOD_(PRUint32) GetMajorIncrementInterval() = 0; - - NS_IMETHOD_(nsIDateTime *) GetDate() = 0; - NS_IMETHOD SetDate(nsIDateTime * aDateTime) = 0; - - NS_IMETHOD AddPeriod(nsCalPeriodFormat aFormat, PRUint32 aPeriod) = 0; - - NS_IMETHOD Copy(nsICalTimeContext * aContext) = 0; -}; - -#endif /* nsICalTimeContext_h___ */ diff --git a/mozilla/calendar/modules/ui/context/src/Makefile b/mozilla/calendar/modules/ui/context/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/ui/context/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/context/src/config.mk b/mozilla/calendar/modules/ui/context/src/config.mk deleted file mode 100644 index eedecb354da..00000000000 --- a/mozilla/calendar/modules/ui/context/src/config.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES +=-I../inc -I$(GDEPTH)/include - -LIBRARY_NAME = context -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) - diff --git a/mozilla/calendar/modules/ui/context/src/manifest.mn b/mozilla/calendar/modules/ui/context/src/manifest.mn deleted file mode 100644 index 5e997056468..00000000000 --- a/mozilla/calendar/modules/ui/context/src/manifest.mn +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalTimeContext.cpp \ - $(NULL) - -REQUIRES = shell xpcom raptor trex julian nls xpfc - diff --git a/mozilla/calendar/modules/ui/context/src/nsCalTimeContext.cpp b/mozilla/calendar/modules/ui/context/src/nsCalTimeContext.cpp deleted file mode 100644 index b5402dcd191..00000000000 --- a/mozilla/calendar/modules/ui/context/src/nsCalTimeContext.cpp +++ /dev/null @@ -1,950 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTimeContext.h" -#include "nsCalUICIID.h" -#include "nsCalUtilCIID.h" -#include "nsIXPFCCommand.h" -#include "nsCalDurationCommand.h" -#include "nsCalFetchEventsCommand.h" -#include "nsCalToolkit.h" -#include "nsDateTime.h" -#include "math.h" -#include "nscalstrings.h" -#include "nsIXMLParserObject.h" -#include "nsxpfcCIID.h" -#include "nsIXPFCObserverManager.h" -#include "nsIServiceManager.h" -#include "nsIXPFCObserver.h" -#include "nsIXPFCSubject.h" - - -static NS_DEFINE_IID(kCXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); -static NS_DEFINE_IID(kCXPFCObserverIID, NS_IXPFC_OBSERVER_IID); -static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); -static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); -static NS_DEFINE_IID(kXPFCCommandCID, NS_XPFC_COMMAND_CID); - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalTimeContextIID, NS_ICAL_TIME_CONTEXT_IID); - -static NS_DEFINE_IID(kCalDateTimeCID, NS_DATETIME_CID); -static NS_DEFINE_IID(kCalDateTimeIID, NS_IDATETIME_IID); - -static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); -static NS_DEFINE_IID(kIXPFCObserverManagerIID, NS_IXPFC_OBSERVERMANAGER_IID); - -// XXX: TODO: Simplify this code! -// XXX: TODO: Much of this code should be in a nsCalTimebarContext -// XXX: TODO: DO NOT USE DateTime objects for all the private data -// elements. The overhead is not needed - -nsCalTimeContext :: nsCalTimeContext() -{ - NS_INIT_REFCNT(); - - mStartTime = nsnull; - mEndTime = nsnull; - mFirstVisibleTime = nsnull; - mLastVisibleTime = nsnull; - mMajorIncrement = nsnull; - mMinorIncrement = nsnull; - mPeriodFormat = nsCalPeriodFormat_kHour; - mDate = nsnull; - -} - -nsCalTimeContext :: ~nsCalTimeContext() -{ - - nsIXPFCObserverManager* om; - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - nsIXPFCObserver * observer = (nsIXPFCObserver *) this; - nsIXPFCSubject * subject = (nsIXPFCSubject *) this; - - om->UnregisterSubject(subject); - om->UnregisterObserver(observer); - - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - NS_IF_RELEASE(mStartTime); - NS_IF_RELEASE(mEndTime); - NS_IF_RELEASE(mFirstVisibleTime); - NS_IF_RELEASE(mLastVisibleTime); - NS_IF_RELEASE(mMajorIncrement); - NS_IF_RELEASE(mMinorIncrement); - NS_IF_RELEASE(mDate); - -} - -NS_IMPL_ADDREF(nsCalTimeContext) -NS_IMPL_RELEASE(nsCalTimeContext) - -nsresult nsCalTimeContext::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalTimeContextIID); - static NS_DEFINE_IID(kXPFCObserverIID, NS_IXPFC_OBSERVER_IID); - static NS_DEFINE_IID(kXPFCCommandReceiverIID, NS_IXPFC_COMMANDRECEIVER_IID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kXPFCObserverIID)) { - *aInstancePtr = (void*)(nsIXPFCObserver *) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kXPFCSubjectIID)) { - *aInstancePtr = (void*) (nsIXPFCSubject *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kXPFCCommandReceiverIID)) { - *aInstancePtr = (void*)(nsIXPFCCommandReceiver *) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - - return (NS_NOINTERFACE); - -} - -nsresult nsCalTimeContext::Copy(nsICalTimeContext * aContext) -{ - mStartTime = aContext->GetDTStart()->Copy(); - mEndTime = aContext->GetDTEnd()->Copy(); - mFirstVisibleTime = aContext->GetDTFirstVisible()->Copy(); - mLastVisibleTime = aContext->GetDTLastVisible()->Copy(); - mMajorIncrement = aContext->GetDTMajorIncrement()->Copy(); - mMinorIncrement = aContext->GetDTMinorIncrement()->Copy(); - mDate = aContext->GetDate()->Copy(); - return NS_OK; -} - -nsresult nsCalTimeContext::Init() -{ - /* - * Set the default to be today from 9am to 5pm - */ - - SetDefaultDateTime(); - - return NS_OK; -} - -nsIDateTime * nsCalTimeContext::GetDate() -{ - return (mDate); -} - -nsresult nsCalTimeContext::SetDate(nsIDateTime * aDateTime) -{ - mDate = aDateTime; - return (NS_OK); -} - -nsIDateTime * nsCalTimeContext::GetDTStart() -{ - return (mStartTime); -} - -nsIDateTime * nsCalTimeContext::GetDTEnd() -{ - return (mEndTime); -} - -nsIDateTime * nsCalTimeContext::GetDTFirstVisible() -{ - return (mFirstVisibleTime); -} - -nsIDateTime * nsCalTimeContext::GetDTLastVisible() -{ - return (mLastVisibleTime); -} - -nsIDateTime * nsCalTimeContext::GetDTMajorIncrement() -{ - return (mMajorIncrement); -} - -nsIDateTime * nsCalTimeContext::GetDTMinorIncrement() -{ - return (mMinorIncrement); -} - - -nsresult nsCalTimeContext::SetDefaultDateTime() -{ - - nsresult res; - - PRUint32 y,d,mo,h,mi,s; - - NS_IF_RELEASE(mDate); - - res = nsRepository::CreateInstance(kCalDateTimeCID, - nsnull, - kCalDateTimeCID, - (void **)&mDate); - - if (NS_OK != res) - return res; - - mDate->Init(); - - y = mDate->GetYear(); - mo = mDate->GetMonth(); - d = mDate->GetDay(); - h = mDate->GetHour(); - mi = mDate->GetMinute(); - s = mDate->GetSecond(); - - SetStartTime(y,mo,d,0,0,0); - SetEndTime(y,mo,d+1,0,0,0); - SetFirstVisibleTime(y,mo,d,9,0,0); - SetLastVisibleTime(y,mo,d,17,0,0); - - SetMajorIncrement(0,0,0,1,0,0); - SetMinorIncrement(0,0,0,0,15,0); - - mPeriodFormat = nsCalPeriodFormat_kHour; - - return res; -} - -nsresult nsCalTimeContext::SetStartTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) -{ - - if (nsnull == mStartTime) - { - nsresult res; - - NS_IF_RELEASE(mStartTime); - - res = nsRepository::CreateInstance(kCalDateTimeCID, - nsnull, - kCalDateTimeCID, - (void **)&mStartTime); - - if (NS_OK != res) - return res; - - mStartTime->Init(); - } - - mStartTime->SetYear(aYear); - mStartTime->SetMonth(aMonth); - mStartTime->SetDay(aDay); - mStartTime->SetHour(aHour); - mStartTime->SetMinute(aMinute); - mStartTime->SetSecond(aSecond); - return NS_OK; -} - -nsresult nsCalTimeContext::SetEndTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) -{ - if (nsnull == mEndTime) - { - nsresult res; - - NS_IF_RELEASE(mEndTime); - - res = nsRepository::CreateInstance(kCalDateTimeCID, - nsnull, - kCalDateTimeCID, - (void **)&mEndTime); - - if (NS_OK != res) - return res; - - mEndTime->Init(); - - } - - mEndTime->SetYear(aYear); - mEndTime->SetMonth(aMonth); - mEndTime->SetDay(aDay); - mEndTime->SetHour(aHour); - mEndTime->SetMinute(aMinute); - mEndTime->SetSecond(aSecond); - return NS_OK; -} - -nsresult nsCalTimeContext::SetFirstVisibleTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) -{ - if (nsnull == mFirstVisibleTime) - { - nsresult res; - - NS_IF_RELEASE(mFirstVisibleTime); - - res = nsRepository::CreateInstance(kCalDateTimeCID, - nsnull, - kCalDateTimeCID, - (void **)&mFirstVisibleTime); - - if (NS_OK != res) - return res; - - mFirstVisibleTime->Init(); - - } - - mFirstVisibleTime->SetYear(aYear); - mFirstVisibleTime->SetMonth(aMonth); - mFirstVisibleTime->SetDay(aDay); - mFirstVisibleTime->SetHour(aHour); - mFirstVisibleTime->SetMinute(aMinute); - mFirstVisibleTime->SetSecond(aSecond); - return NS_OK; -} - -nsresult nsCalTimeContext::SetLastVisibleTime(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) -{ - if (nsnull == mLastVisibleTime) - { - nsresult res; - - NS_IF_RELEASE(mLastVisibleTime); - - res = nsRepository::CreateInstance(kCalDateTimeCID, - nsnull, - kCalDateTimeCID, - (void **)&mLastVisibleTime); - - if (NS_OK != res) - return res; - - mLastVisibleTime->Init(); - - } - - mLastVisibleTime->SetYear(aYear); - mLastVisibleTime->SetMonth(aMonth); - mLastVisibleTime->SetDay(aDay); - mLastVisibleTime->SetHour(aHour); - mLastVisibleTime->SetMinute(aMinute); - mLastVisibleTime->SetSecond(aSecond); - return NS_OK; -} - -nsresult nsCalTimeContext::SetMajorIncrement(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) -{ - if (nsnull == mMajorIncrement) - { - nsresult res; - - NS_IF_RELEASE(mMajorIncrement); - - res = nsRepository::CreateInstance(kCalDateTimeCID, - nsnull, - kCalDateTimeCID, - (void **)&mMajorIncrement); - - if (NS_OK != res) - return res; - - mMajorIncrement->Init(); - - } - mMajorIncrement->SetYear(aYear); - mMajorIncrement->SetMonth(aMonth); - mMajorIncrement->SetDay(aDay); - mMajorIncrement->SetHour(aHour); - mMajorIncrement->SetMinute(aMinute); - mMajorIncrement->SetSecond(aSecond); - return NS_OK; -} - -nsresult nsCalTimeContext::SetMinorIncrement(PRUint32 aYear, - PRUint32 aMonth, - PRUint32 aDay, - PRUint32 aHour, - PRUint32 aMinute, - PRUint32 aSecond - ) -{ - if (nsnull == mMinorIncrement) - { - nsresult res; - - NS_IF_RELEASE(mMinorIncrement); - - res = nsRepository::CreateInstance(kCalDateTimeCID, - nsnull, - kCalDateTimeCID, - (void **)&mMinorIncrement); - - if (NS_OK != res) - return res; - - mMinorIncrement->Init(); - - } - mMinorIncrement->SetYear(aYear); - mMinorIncrement->SetMonth(aMonth); - mMinorIncrement->SetDay(aDay); - mMinorIncrement->SetHour(aHour); - mMinorIncrement->SetMinute(aMinute); - mMinorIncrement->SetSecond(aSecond); - return NS_OK; -} - -nsresult nsCalTimeContext::SetPeriodFormat(nsCalPeriodFormat aPeriodFormat) -{ - mPeriodFormat = aPeriodFormat; - return NS_OK; -} - -nsCalPeriodFormat nsCalTimeContext::GetPeriodFormat() -{ - return (mPeriodFormat); -} - -/* - * compute the visible time difference in units of mPeriodFormat - */ - -PRUint32 nsCalTimeContext::GetVisibleTimeDifference() -{ - return(GetVisibleTimeDifference(mPeriodFormat)); -} - -/* - * compute the visible time difference in units of mPeriodFormat - */ - -PRUint32 nsCalTimeContext::GetVisibleTimeDifference(nsCalPeriodFormat aFormat) -{ - PRUint32 difference = 0 ; - - switch (aFormat) - { - case nsCalPeriodFormat_kYear: - difference = abs((int)(mLastVisibleTime->GetYear() - mFirstVisibleTime->GetYear())); - break; - - case nsCalPeriodFormat_kMonth: - difference = abs((int)(mLastVisibleTime->GetMonth() - mFirstVisibleTime->GetMonth())); - break; - - case nsCalPeriodFormat_kDay: - difference = abs((int)(mLastVisibleTime->GetDay() - mFirstVisibleTime->GetDay())); - break; - - case nsCalPeriodFormat_kHour: - difference = abs((int)(mLastVisibleTime->GetHour() - mFirstVisibleTime->GetHour())); - break; - - case nsCalPeriodFormat_kMinute: - difference = abs((int)(mLastVisibleTime->GetMinute() - mFirstVisibleTime->GetMinute())); - break; - - case nsCalPeriodFormat_kSecond: - difference = abs((int)(mLastVisibleTime->GetSecond() - mFirstVisibleTime->GetSecond())); - break; - - } - - return (difference); -} - -PRUint32 nsCalTimeContext::GetMajorIncrementInterval() -{ - PRUint32 interval = 0 ; - - switch (mPeriodFormat) - { - case nsCalPeriodFormat_kYear: - interval = mMajorIncrement->GetYear(); - break; - - case nsCalPeriodFormat_kMonth: - interval = mMajorIncrement->GetMonth(); - break; - - case nsCalPeriodFormat_kDay: - interval = mMajorIncrement->GetDay(); - break; - - case nsCalPeriodFormat_kHour: - interval = mMajorIncrement->GetHour(); - break; - - case nsCalPeriodFormat_kMinute: - interval = mMajorIncrement->GetMinute(); - break; - - case nsCalPeriodFormat_kSecond: - interval = mMajorIncrement->GetSecond(); - break; - - } - - return (interval); -} - -PRUint32 nsCalTimeContext::GetMinorIncrementInterval() -{ - PRUint32 interval = 0 ; - - switch (mPeriodFormat) - { - case nsCalPeriodFormat_kYear: - interval = mMinorIncrement->GetYear(); - break; - - case nsCalPeriodFormat_kMonth: - interval = mMinorIncrement->GetMonth(); - break; - - case nsCalPeriodFormat_kDay: - interval = mMinorIncrement->GetDay(); - break; - - case nsCalPeriodFormat_kHour: - interval = mMinorIncrement->GetHour(); - break; - - case nsCalPeriodFormat_kMinute: - interval = mMinorIncrement->GetMinute(); - break; - - case nsCalPeriodFormat_kSecond: - interval = mMinorIncrement->GetSecond(); - break; - - } - - return (interval); -} - -PRUint32 nsCalTimeContext::GetFirstVisibleTime() -{ - return (GetFirstVisibleTime(mPeriodFormat)); -} - -PRUint32 nsCalTimeContext::GetFirstVisibleTime(nsCalPeriodFormat aFormat) -{ - PRUint32 interval = 0 ; - - switch (aFormat) - { - case nsCalPeriodFormat_kYear: - interval = mFirstVisibleTime->GetYear(); - break; - - case nsCalPeriodFormat_kMonth: - interval = mFirstVisibleTime->GetMonth(); - break; - - case nsCalPeriodFormat_kDay: - interval = mFirstVisibleTime->GetDay(); - break; - - case nsCalPeriodFormat_kHour: - interval = mFirstVisibleTime->GetHour(); - break; - - case nsCalPeriodFormat_kMinute: - interval = mFirstVisibleTime->GetMinute(); - break; - - case nsCalPeriodFormat_kSecond: - interval = mFirstVisibleTime->GetSecond(); - break; - - } - - return (interval); -} - -PRUint32 nsCalTimeContext::GetLastVisibleTime() -{ - return (GetLastVisibleTime(mPeriodFormat)); -} - -PRUint32 nsCalTimeContext::GetLastVisibleTime(nsCalPeriodFormat aFormat) -{ - PRUint32 interval = 0 ; - - switch (aFormat) - { - case nsCalPeriodFormat_kYear: - interval = mLastVisibleTime->GetYear(); - break; - - case nsCalPeriodFormat_kMonth: - interval = mLastVisibleTime->GetMonth(); - break; - - case nsCalPeriodFormat_kDay: - interval = mLastVisibleTime->GetDay(); - break; - - case nsCalPeriodFormat_kHour: - interval = mLastVisibleTime->GetHour(); - break; - - case nsCalPeriodFormat_kMinute: - interval = mLastVisibleTime->GetMinute(); - break; - - case nsCalPeriodFormat_kSecond: - interval = mLastVisibleTime->GetSecond(); - break; - - } - - return (interval); -} - -/* - * We've just received a notification that someone somewhere wants our - * context to be updated. The source of the change is in aSubject - * and the target operation is in aCommand. - * - * We use QueryInterface to decide the actual types of objects. - * - * Once we've updated our internal streucture, we need to send a - * visual notification to all observers of us ... - */ - -nsEventStatus nsCalTimeContext::Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand) -{ - - nsEventStatus status ; - /* - * Update our internal structure based on this update - */ - - status = Action(aCommand); - - /* - * Pass this notification on. There may be other - * TimeContext's watching us. It is assumed observer's - * like Model's will ignore this command - */ - - Notify(aCommand); - - /* - * If we consumed the event, send a FetchEvents Command to our observers - * Only Model data want this. If we get a FetchEvents command, we'll just - * pass it on (above) - */ - - if (nsEventStatus_eIgnore != status) - { - // XXX: Change this to a Fetch for range. I suppose we just - // Want to ask for our current visible range. Let the - // CacheManager decide what to actually request over the - // wire. - - nsCalFetchEventsCommand * fetch_command = nsnull; - nsresult res; - - static NS_DEFINE_IID(kCalFetchEventsCommandCID, NS_CAL_FETCHEVENTS_COMMAND_CID); - - res = nsRepository::CreateInstance(kCalFetchEventsCommandCID, - nsnull, - kXPFCCommandIID, - (void **)&fetch_command); - - if (NS_OK == res) - { - fetch_command->Init(); - - // XXX: Are these setup correctly? - fetch_command->mStartDate = mStartTime; - fetch_command->mEndDate = mEndTime; - - Notify(fetch_command); - - NS_IF_RELEASE(fetch_command); - } - } - - return (status); -} - -nsEventStatus nsCalTimeContext::Action(nsIXPFCCommand * aCommand) -{ - nsCalDurationCommand * duration_command = nsnull; - nsCalDayListCommand * daylist_command = nsnull; - nsresult res; - - static NS_DEFINE_IID(kCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID); - - res = aCommand->QueryInterface(kCalDurationCommandCID,(void**)&duration_command); - - if (NS_OK == res) - return (HandleDurationCommand(duration_command)); - - - /* - * Check for DayList - */ - - - static NS_DEFINE_IID(kCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID); - - res = aCommand->QueryInterface(kCalDayListCommandCID,(void**)&daylist_command); - - if (NS_OK == res) - return (HandleDayListCommand(daylist_command)); - - - return nsEventStatus_eIgnore; -} - -nsEventStatus nsCalTimeContext::HandleDayListCommand(nsCalDayListCommand * aDayListCommand) -{ - /* - * Handle the DayList here... - */ - - // Change our date to the first in the list - nsIIterator * iterator; - nsDateTime * datetime; - nsresult res; - - - // Iterate through the children - res = aDayListCommand->CreateIterator(&iterator); - - if (NS_OK != res) - return nsEventStatus_eIgnore; - - iterator->Init(); - - if(!(iterator->IsDone())) - { - datetime = (nsDateTime *) iterator->CurrentItem(); - - SetDate(datetime); - - } - - NS_IF_RELEASE(iterator); - NS_IF_RELEASE(aDayListCommand); - - return nsEventStatus_eConsumeDoDefault; -} - -nsEventStatus nsCalTimeContext::HandleDurationCommand(nsCalDurationCommand * aDurationCommand) -{ - nsDuration * dtDuration; - - dtDuration = aDurationCommand->GetDuration(); - - if (nsnull == dtDuration) - return nsEventStatus_eIgnore; - - switch (aDurationCommand->GetPeriodFormat()) - { - case nsCalPeriodFormat_kYear: - mLastVisibleTime->SetYear(mLastVisibleTime->GetYear() + dtDuration->GetYear()); - mFirstVisibleTime->SetYear(mFirstVisibleTime->GetYear() + dtDuration->GetYear()); - break; - - case nsCalPeriodFormat_kMonth: - mLastVisibleTime->IncrementYear(dtDuration->GetYear()); - mLastVisibleTime->IncrementMonth(dtDuration->GetMonth()); - mLastVisibleTime->IncrementDay(dtDuration->GetDay()); - mFirstVisibleTime->IncrementYear(dtDuration->GetYear()); - mFirstVisibleTime->IncrementMonth(dtDuration->GetMonth()); - mFirstVisibleTime->IncrementDay(dtDuration->GetDay()); - mStartTime->IncrementYear(dtDuration->GetYear()); - mStartTime->IncrementMonth(dtDuration->GetMonth()); - mStartTime->IncrementDay(dtDuration->GetDay()); - mEndTime->IncrementYear(dtDuration->GetYear()); - mEndTime->IncrementMonth(dtDuration->GetMonth()); - mEndTime->IncrementDay(dtDuration->GetDay()); - break; - - case nsCalPeriodFormat_kDay: - mLastVisibleTime->IncrementDay(dtDuration->GetDay()); - mFirstVisibleTime->IncrementDay(dtDuration->GetDay()); - mStartTime->IncrementDay(dtDuration->GetDay()); - mEndTime->IncrementDay(dtDuration->GetDay()); - break; - - case nsCalPeriodFormat_kHour: - if (mLastVisibleTime->GetHour() != 23) { - mLastVisibleTime->SetHour(mLastVisibleTime->GetHour() + dtDuration->GetHour()); - mFirstVisibleTime->SetHour(mFirstVisibleTime->GetHour() + dtDuration->GetHour()); - } - break; - - case nsCalPeriodFormat_kMinute: - mLastVisibleTime->SetMinute(mLastVisibleTime->GetMinute() + dtDuration->GetMinute()); - mFirstVisibleTime->SetMinute(mFirstVisibleTime->GetMinute() + dtDuration->GetMinute()); - break; - - case nsCalPeriodFormat_kSecond: - mLastVisibleTime->SetSecond(mLastVisibleTime->GetSecond() + dtDuration->GetSecond()); - mFirstVisibleTime->SetSecond(mFirstVisibleTime->GetSecond() + dtDuration->GetSecond()); - break; - - } - - NS_IF_RELEASE(aDurationCommand); - - return nsEventStatus_eConsumeDoDefault; -} - -nsresult nsCalTimeContext :: Attach(nsIXPFCObserver * aObserver) -{ - return NS_OK; -} - -nsresult nsCalTimeContext :: Detach(nsIXPFCObserver * aObserver) -{ - return NS_OK; -} - -nsresult nsCalTimeContext :: Notify(nsIXPFCCommand * aCommand) -{ - nsIXPFCSubject * subject; - - nsresult res = QueryInterface(kXPFCSubjectIID,(void **)&subject); - - if (res != NS_OK) - return res; - - nsIXPFCObserverManager* om; - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - - res = om->Notify(subject,aCommand); - - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - return(res); -} - - -nsresult nsCalTimeContext::AddPeriod(nsCalPeriodFormat aFormat, PRUint32 aPeriod) -{ - switch (aFormat) - { - case nsCalPeriodFormat_kYear: - mDate->IncrementYear(aPeriod); - mLastVisibleTime->IncrementYear(aPeriod); - mFirstVisibleTime->IncrementYear(aPeriod); - mStartTime->IncrementYear(aPeriod); - mEndTime->IncrementYear(aPeriod); - break; - - case nsCalPeriodFormat_kMonth: - mDate->IncrementMonth(aPeriod); - mLastVisibleTime->IncrementMonth(aPeriod); - mFirstVisibleTime->IncrementMonth(aPeriod); - mStartTime->IncrementMonth(aPeriod); - mEndTime->IncrementMonth(aPeriod); - break; - - case nsCalPeriodFormat_kDay: - mDate->IncrementDay(aPeriod); - mLastVisibleTime->IncrementDay(aPeriod); - mFirstVisibleTime->IncrementDay(aPeriod); - mStartTime->IncrementDay(aPeriod); - mEndTime->IncrementDay(aPeriod); - break; - - case nsCalPeriodFormat_kHour: - mDate->IncrementHour(aPeriod); - mLastVisibleTime->IncrementHour(aPeriod); - mFirstVisibleTime->IncrementHour(aPeriod); - mStartTime->IncrementHour(aPeriod); - mEndTime->IncrementHour(aPeriod); - break; - - case nsCalPeriodFormat_kMinute: - mDate->IncrementMinute(aPeriod); - mLastVisibleTime->IncrementMinute(aPeriod); - mFirstVisibleTime->IncrementMinute(aPeriod); - mStartTime->IncrementMinute(aPeriod); - mEndTime->IncrementMinute(aPeriod); - break; - - case nsCalPeriodFormat_kSecond: - mDate->IncrementSecond(aPeriod); - mLastVisibleTime->IncrementSecond(aPeriod); - mFirstVisibleTime->IncrementSecond(aPeriod); - mStartTime->IncrementSecond(aPeriod); - mEndTime->IncrementSecond(aPeriod); - break; - - } - - return NS_OK; -} - -nsresult nsCalTimeContext :: SetParameter(nsString& aKey, nsString& aValue) -{ - - return NS_OK; -} diff --git a/mozilla/calendar/modules/ui/controller/Makefile b/mozilla/calendar/modules/ui/controller/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/controller/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/controller/inc/Makefile b/mozilla/calendar/modules/ui/controller/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/controller/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/controller/inc/manifest.mn b/mozilla/calendar/modules/ui/controller/inc/manifest.mn deleted file mode 100644 index d3c322aa50e..00000000000 --- a/mozilla/calendar/modules/ui/controller/inc/manifest.mn +++ /dev/null @@ -1,23 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - nsCalContextController.h \ - nsCalTimebarContextController.h \ - nsCalMonthContextController.h \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/controller/inc/nsCalContextController.h b/mozilla/calendar/modules/ui/controller/inc/nsCalContextController.h deleted file mode 100644 index d8a917288da..00000000000 --- a/mozilla/calendar/modules/ui/controller/inc/nsCalContextController.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalContextController_h___ -#define nsCalContextController_h___ - -#include "nsICalContextController.h" -#include "nsCalCanvas.h" - -#include "nsIXPFCSubject.h" -#include "nsIXPFCCommand.h" - -#include "nsCalPeriodFormat.h" -#include "nsDuration.h" - -class nsCalContextController : public nsICalContextController, - public nsIXPFCSubject, - public nsCalCanvas -{ -public: - nsCalContextController(nsISupports * aOuter); - - NS_DECL_ISUPPORTS - - // ContextController Methods - NS_IMETHOD_(void) SetOrientation(nsContextControllerOrientation eOrientation); - NS_IMETHOD_(nsContextControllerOrientation) GetOrientation(); - - NS_IMETHOD_(nsDuration *) GetDuration(); - NS_IMETHOD SetDuration(nsDuration * aDuration); - - // nsIXPFCSubject methods - NS_IMETHOD Init(); - NS_IMETHOD Attach(nsIXPFCObserver * aObserver); - NS_IMETHOD Detach(nsIXPFCObserver * aObserver); - NS_IMETHOD Notify(nsIXPFCCommand * aCommand); - - NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat(); - NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat); - // nsIXMLParserObject methods - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - -private: - nsCalPeriodFormat mPeriodFormat; - -protected: - ~nsCalContextController(); - -private: - nsContextControllerOrientation mOrientation; - nsDuration * mDuration; - -}; - -#endif /* nsCalContextController_h___ */ diff --git a/mozilla/calendar/modules/ui/controller/inc/nsCalMonthContextController.h b/mozilla/calendar/modules/ui/controller/inc/nsCalMonthContextController.h deleted file mode 100644 index 0670406d664..00000000000 --- a/mozilla/calendar/modules/ui/controller/inc/nsCalMonthContextController.h +++ /dev/null @@ -1,284 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalMonthContextController_h___ -#define nsCalMonthContextController_h___ - -#include "nsCalContextController.h" - -#include "jdefines.h" -#include "datetime.h" -#include - -#include "nsIWidget.h" -#include "nsIFontMetrics.h" -#include "nsString.h" - -class DateTime; -class CMouseEvent; -class CMiniCalEvent; -class JulianPtrArray; - -class nsCalMonthContextController : public nsCalContextController -{ - -public: - nsCalMonthContextController(nsISupports* outer); - NS_DECL_ISUPPORTS - NS_IMETHOD Init(); - NS_IMETHOD GetClassPreferredSize(nsSize& aSize); - -protected: - ~nsCalMonthContextController(); - -public: - enum EALIGNMENT {LEFT, RIGHT, CENTER}; - -protected: - - /* - * Data members defining state and "non-ui" aspects of the the MiniCal - */ - PRBool m_bGrid; // show the grid? - PRBool m_bSep; // show separator below day of week column headings - PRBool m_bWeeks; // show weeks? - PRBool m_bColumnSelectMode; // select by rows or columns? - PRBool m_bArrows; // are arrows enabled - DateTime m_ULDate; // represents the month that is shown in the upper left corner - DateTime m_Date; // the currently selected date - - nscolor m_MCBGColor; // background color for minicals - nscolor m_DIMFGColor; // background color for the dates before and after current month - nscolor m_CurDayFGColor; // foreground for current date - nscolor m_CurDayBGColor; // background for current date - nscolor m_HighlightFGColor; // foreground for current date - nscolor m_HighlightBGColor; // background for current date - int m_iFDOW; // what day do we show as first-day-of-the-week - -public: - - inline PRBool GetArrows() { return m_bArrows; } - inline void SetArrows(PRBool b) { m_bArrows = b; } - inline PRBool GetGrid() { return m_bGrid; } - inline void SetGrid(PRBool b) { m_bGrid = b; } - inline PRBool GetSeparator() { return m_bSep; } - inline void SetSeparator(PRBool b) { m_bSep = b; } - inline PRBool GetWeeks() { return m_bWeeks; } - inline void SetWeeks(PRBool b) { m_bWeeks = b; } - inline int GetFDOW() { return m_iFDOW; } - void SetFDOW(int i); - DateTime& GetDate() { return m_ULDate; } - inline void SetDate(DateTime d) { m_ULDate = d; } - - inline void SetMCBGColor(int r, int g, int b) { m_MCBGColor = NS_RGB(r,g,b); } - inline nscolor GetMCBGColor() { return m_MCBGColor; } - - inline void SetDIMFGColor(int r, int g, int b) { m_DIMFGColor = NS_RGB(r,g,b); } - inline nscolor GetDIMFGColor() { return m_DIMFGColor; } - inline void SetCurrentDayFGColor(int r, int g, int b) { m_CurDayFGColor = NS_RGB(r,g,b); } - inline nscolor GetCurrentDayFGColor() { return m_CurDayFGColor; } - inline void SetCurrentDayBGColor(int r, int g, int b) { m_CurDayBGColor = NS_RGB(r,g,b); } - inline nscolor GetCurrentDayBGColor() { return m_CurDayBGColor; } - inline void SetHighlightFGColor(int r, int g, int b) { m_HighlightFGColor = NS_RGB(r,g,b); } - inline nscolor GetHighlightFGColor() { return m_HighlightFGColor; } - inline void SetHighlightBGColor(int r, int g, int b) { m_HighlightBGColor = NS_RGB(r,g,b); } - inline nscolor GetHighlightBGColor() { return m_HighlightBGColor; } - - nsString ToString(); - -protected: - EALIGNMENT m_eTitleAlign; // how the is title aligned - - Locale m_Locale; // in what local are we working - int m_iFontSize; // point size of font - int m_iDOWChars; // number of chars to show in the day of the week col hdr - int m_iDigitWidth; // width of a digit 0 - 9 - int m_iMaxDOWColHdrWidth; // max width of dow col hdr string - int m_iDigitHeight; // height of a digit - - int m_iNumRows; // number of cell rows per minical - int m_iNumCols; // number of cell cols per minical - int m_iCellWidth; // total width of a minical cell - int m_iCellHeight; // total height of a minical cell - int m_iCellHorzSpacing; // horizontal space in addition to the character width in a cell - int m_iCellVertSpacing; // vertical space in addition to the character height - - int m_iMCWidth; // total width of a single minical - int m_iMCHeight; // total height of a single minical - int m_iMCVertSpacing; // vertical spacing between minicals - int m_iMCHorzSpacing; // horizontal spacing between minicals - int m_iMCRows; // number of rows of minicals for current window height - int m_iMCCols; // number of columns of minicals for current window width - - int m_iWidth; // combined width of all minicals - int m_iHeight; // combined height of all minicals - - int m_iTMCW; // total minical width - int m_iTMCH; // total minical height; - int m_iPikMCCol; // which column of minicals - int m_iPikMCRow; // which row of minicals - int m_iMCX; // x coord relative to upper left of m_iPikMC - int m_iMCY; // y coord relative to upper left of m_iPikMC - int m_iCellCol; // which cell column of m_iPikMC - int m_iCellRow; // which cell row of m_iPikMC - int m_iAnchorMCCol; // column in which the drag was anchored - int m_iAnchorMCRow; // row in which the drag was anchored - int m_iYOffset; - int m_iXOffset; // this far from the right edge of the cell. - int m_iCmdArmed; // mouse down started on this command - - char* m_asDOW[7]; // array holding the days of the week names - char* m_asMonths[12]; // names for the months of the year - - int m_iMatrixSize; // the buffers below are valid for m_iMCRows*m_iMCCols is less that the value of this number - Date* m_pStartTimeMap; // buffer for a matrix of start times corresponding to the first day in each minical - int* m_pValidPosMap; // buffer for a matrix of start/stop valid cell positions - JulianPtrArray *m_pDates; // Selected dates - - /* - * Internal methods - */ - int ResizeMapBuffers(); - void SetFDOW(DateTime &d); - -public: - /* - * General requests for the Bridge... - */ - void DrawMiniCal(void* p); - void RemoveSelectedDate(DateTime d); - void UnhighlightDate(DateTime d); - void SetDateCoords(DateTime d, int& iCellX, int& m_iCellY); - void HandleEvent(CMiniCalEvent* pe); - void SetMousePickInfo(CMiniCalEvent* e); - nsresult HandleColSelect(CMiniCalEvent* pe); - nsresult HandleWeekSelect(CMiniCalEvent* pe); - nsresult HandleDaySelect(CMiniCalEvent* pe); - NS_IMETHOD GetDOWList(int iDOW); - int FindDate(CMiniCalEvent* e); - void FindDOW(CMiniCalEvent* e); - int SetPaintValues(); - inline int GetFontSize() { return m_iFontSize; } - inline void SetFontSize(int i) { m_iFontSize = i; } - inline nsString GetFontName() { return m_sFontName; } - inline void SetFontName(nsString s) { m_sFontName = s; } - inline int GetMCVertSpacing() { return m_iMCVertSpacing; } - inline void SetMCVertSpacing(int i) { m_iMCVertSpacing = i; } - inline int GetMCHorzSpacing() { return m_iMCHorzSpacing; } - inline void SetMCHorzSpacing(int i) { m_iMCHorzSpacing = i; } - inline int GetCellVertSpacing() { return m_iCellVertSpacing;} - inline void SetCellVertSpacing(int i) { m_iCellVertSpacing = i; } - inline int GetCellHorzSpacing() { return m_iCellHorzSpacing;} - inline void SetCellHorzSpacing(int i) { m_iCellHorzSpacing = i; } - inline int GetDOWColHdrChars() { return m_iDOWChars; } - inline void SetDOWColHdrChars(int i) { m_iDOWChars = i; } - inline int GetWidth() { return m_iWidth; } - inline int GetHeight() { return m_iHeight; } - inline int GetCellWidth() { return m_iCellWidth; } - inline int GetCellHeight() { return m_iCellHeight; } - inline int GetMCWidth() { return m_iMCWidth; } - inline int GetMCHeight() { return m_iMCHeight; } - inline int GetMCRows() { return m_iMCRows; } - inline int GetMCCols() { return m_iMCCols; } - inline int GetCellRows() { return m_iNumRows; } - inline int GetCellCols() { return m_iNumCols; } - inline int GetTMCW() { return m_iTMCW; } - inline int GetTMCH() { return m_iTMCH; } - inline int GetPikMCCol() { return m_iPikMCCol; } - inline int GetPikMCRow() { return m_iPikMCRow; } - inline int GetMCX() { return m_iMCX; } - inline int GetMCY() { return m_iMCY; } - inline int GetCellCol() { return m_iCellCol; } - inline int GetCellRow() { return m_iCellRow; } - inline int GetAnchorMCCol() { return m_iAnchorMCCol; } - inline int GetAnchorMCRow() { return m_iAnchorMCRow; } - inline void SetLocale(const Locale l) { m_Locale = l; SetDOWNameArray(1); SetMonthsArray(); } - Locale& GetLocale() { return m_Locale; } - inline char** GetDOWArray() { return m_asDOW; } - inline char** GetMonthArray() { return m_asMonths; } - inline JulianPtrArray* GetDateList() { return m_pDates; } - - void SetSelectedDates(JulianPtrArray* pV); - void ClearDateList(); - - inline Date GetStartTimeMap(int iRow, int iCol) { return m_pStartTimeMap[iRow * m_iMCCols + iCol ]; } - inline void SetStartTimeMap(int iRow, int iCol, Date dVal) { m_pStartTimeMap[iRow * m_iMCCols + iCol] = dVal; } - void GetValidPos(int iRow, int iCol, int* piPosStart, int* piPosStop); - void SetValidPos(int iRow, int iCol, int iPosStart, int iPosStop); - inline void SetValidPos(int iRow, int iCol, int iVal) {m_pValidPosMap[iRow * m_iMCCols + iCol] = iVal;} - - inline void SetTitleAlignment(EALIGNMENT e) { m_eTitleAlign = e; } - inline EALIGNMENT GetTitleAlignment() { return m_eTitleAlign; } - void SetDOWNameArray(PRBool bLocaleChange); - void SetMonthsArray(); - - void PaintMiniCalElement(void* p, int iRow,int iCol, int iTotRows, int iTotCols, int iXLeft, int iYTop, DateTime& baseDate, PRBool bLeading ); - void HighlightCell(DateTime d, nscolor fg, nscolor bg, int iX, int iY); - void HighlightCell(DateTime d, nscolor fg, nscolor bg); - - -protected: - nsString m_sFontName; // the name of the font face - -public: - NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD_(nsEventStatus) OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight); - NS_IMETHOD_(nsEventStatus) OnLeftButtonDown(nsGUIEvent *aEvent); - NS_IMETHOD_(nsEventStatus) OnLeftButtonUp(nsGUIEvent *aEvent); - NS_IMETHOD_(nsEventStatus) OnMouseMove(nsGUIEvent *aEvent); - - -// Operations -public: - -// Implementation -public: - void InitRedraw(void* p); - void PostRedraw(void* p); - - void GetTextExtent(char* p, int iChars, int& iWidth,int& iHeight); - void GetFontInfo(nsString s, int iFontSize, int iStyle,int& riDigitWidth, int& riDigitOutput, int& iMaxWidth ); - void GetWindowSize(int& riWidth, int& riHeight); - - - // nsIXPFCObserver methods - NS_IMETHOD_(nsEventStatus) Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand); - - // nsIXPFCCommandReceiver methods - NS_IMETHOD_(nsEventStatus) Action(nsIXPFCCommand * aCommand); - - void SetDefaults(); - - -protected: - nsresult GetWeekDateList(int iWeekOffset); - nsresult HighlightActionList(); - void ClearActionDateList(); - nsresult AddToActionList(DateTime d); - void CommitArrow(int iDayVal, int iMonthVal); - void CommitDateList(); - nsIArray * m_ActionDateList; // Interactive DateList as we move the mouse - -}; - -#endif /* nsCalMonthContextController_h___ */ diff --git a/mozilla/calendar/modules/ui/controller/inc/nsCalTimebarContextController.h b/mozilla/calendar/modules/ui/controller/inc/nsCalTimebarContextController.h deleted file mode 100644 index f59fd1a17f8..00000000000 --- a/mozilla/calendar/modules/ui/controller/inc/nsCalTimebarContextController.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalTimebarContextController_h___ -#define nsCalTimebarContextController_h___ - -#include "nsCalContextController.h" - -class nsCalTimebarContextController : public nsCalContextController -{ -public: - nsCalTimebarContextController(nsISupports * aOuter); - - NS_DECL_ISUPPORTS - - NS_IMETHOD Init(); - - // Subclass Canvas functions - NS_IMETHOD_(nsEventStatus) PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - NS_IMETHOD_(nsEventStatus) OnLeftButtonDown(nsGUIEvent *aEvent); - - - // nsIXMLParserObject methods - NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ; - - NS_IMETHOD GetClassPreferredSize(nsSize& aSize); - -protected: - ~nsCalTimebarContextController(); - -private: - NS_METHOD GetTrianglePoints(nsPoint * pts); - NS_METHOD_(PRBool) IsPointInTriangle(nsPoint aPoint, nsPoint * aTriangle); - NS_METHOD RenderController(nsIRenderingContext& aCtx, - nsPoint* aPoints, - PRUint32 aNumPoints); - - -}; - -#endif /* nsCalTimebarContextController_h___ */ diff --git a/mozilla/calendar/modules/ui/controller/manifest.mn b/mozilla/calendar/modules/ui/controller/manifest.mn deleted file mode 100644 index ce741a53d39..00000000000 --- a/mozilla/calendar/modules/ui/controller/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = public inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/ui/controller/public/Makefile b/mozilla/calendar/modules/ui/controller/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/controller/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/controller/public/manifest.mn b/mozilla/calendar/modules/ui/controller/public/manifest.mn deleted file mode 100644 index b4e2d4868bf..00000000000 --- a/mozilla/calendar/modules/ui/controller/public/manifest.mn +++ /dev/null @@ -1,22 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -EXPORTS = \ - nsICalContextController.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/controller/public/nsICalContextController.h b/mozilla/calendar/modules/ui/controller/public/nsICalContextController.h deleted file mode 100644 index 96d1ad0f421..00000000000 --- a/mozilla/calendar/modules/ui/controller/public/nsICalContextController.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsICalContextController_h___ -#define nsICalContextController_h___ - -#include "nsISupports.h" - -#include "nsDateTime.h" -#include "nsDuration.h" - -#include "nsCalPeriodFormat.h" - -//aefb24f0-e9e5-11d1-9244-00805f8a7ab6 -#define NS_ICAL_CONTEXT_CONTROLLER_IID \ -{ 0xaefb24f0, 0xe9e5, 0x11d1, \ -{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -// ContextController Orientation -enum nsContextControllerOrientation -{ - nsContextControllerOrientation_north, - nsContextControllerOrientation_south, - nsContextControllerOrientation_east, - nsContextControllerOrientation_west, - nsContextControllerOrientation_default -}; - -class nsICalContextController : public nsISupports -{ - -public: - - NS_IMETHOD_(void) SetOrientation(nsContextControllerOrientation eOrientation) = 0; - NS_IMETHOD_(nsContextControllerOrientation) GetOrientation() = 0; - - NS_IMETHOD_(nsDuration *) GetDuration() = 0 ; - NS_IMETHOD SetDuration(nsDuration * aDuration) = 0; - - NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat() = 0; - NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat) = 0; - -}; - -#endif /* nsICalContextController_h___ */ diff --git a/mozilla/calendar/modules/ui/controller/src/Makefile b/mozilla/calendar/modules/ui/controller/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/ui/controller/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/controller/src/config.mk b/mozilla/calendar/modules/ui/controller/src/config.mk deleted file mode 100644 index 1a67660fdc9..00000000000 --- a/mozilla/calendar/modules/ui/controller/src/config.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES +=-I../inc -I$(GDEPTH)/include - -LIBRARY_NAME = controller -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) diff --git a/mozilla/calendar/modules/ui/controller/src/manifest.mn b/mozilla/calendar/modules/ui/controller/src/manifest.mn deleted file mode 100644 index 575c97a0038..00000000000 --- a/mozilla/calendar/modules/ui/controller/src/manifest.mn +++ /dev/null @@ -1,27 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalContextController.cpp \ - nsCalTimebarContextController.cpp \ - nsCalMonthContextController.cpp \ - $(NULL) - -REQUIRES = shell xpcom raptor trex julian nls xpfc - diff --git a/mozilla/calendar/modules/ui/controller/src/nsCalContextController.cpp b/mozilla/calendar/modules/ui/controller/src/nsCalContextController.cpp deleted file mode 100644 index ba5b217ca02..00000000000 --- a/mozilla/calendar/modules/ui/controller/src/nsCalContextController.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalContextController.h" -#include "nsIXPFCSubject.h" -#include "nsCalUICIID.h" -#include "nsCalUtilCIID.h" -#include "nsCalToolkit.h" -#include "nsIXPFCCommand.h" -#include "nscalstrings.h" -#include "nsxpfcCIID.h" -#include "nsIXPFCObserverManager.h" -#include "nsIServiceManager.h" -#include "nsIXPFCObserver.h" -#include "nsIXPFCSubject.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalContextControllerIID, NS_ICAL_CONTEXT_CONTROLLER_IID); -static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); -static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); -static NS_DEFINE_IID(kXPFCCommandCID, NS_XPFC_COMMAND_CID); -static NS_DEFINE_IID(kCXPFCObserverManagerCID, NS_XPFC_OBSERVERMANAGER_CID); -static NS_DEFINE_IID(kIXPFCObserverManagerIID, NS_IXPFC_OBSERVERMANAGER_IID); -static NS_DEFINE_IID(kCXPFCObserverIID, NS_IXPFC_OBSERVER_IID); -static NS_DEFINE_IID(kCXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); - -#define kNotFound -1 - -nsCalContextController :: nsCalContextController(nsISupports * aOuter) : nsCalCanvas(aOuter) -{ - NS_INIT_REFCNT(); - - mOrientation = nsContextControllerOrientation_west; - mDuration = nsnull; - mPeriodFormat = nsCalPeriodFormat_kHour; -} - -nsCalContextController :: ~nsCalContextController() -{ - nsIXPFCObserverManager* om; - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - nsIXPFCSubject * subject = (nsIXPFCSubject *)this; - om->UnregisterSubject(subject); - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - NS_IF_RELEASE(mDuration); -} - -nsresult nsCalContextController::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalContextControllerIID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kXPFCSubjectIID)) { - *aInstancePtr = (void*) (nsIXPFCSubject *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - - return (nsCalCanvas::QueryInterface(aIID, aInstancePtr)); - -} - - -NS_IMPL_ADDREF(nsCalContextController) -NS_IMPL_RELEASE(nsCalContextController) - -void nsCalContextController :: SetOrientation(nsContextControllerOrientation eOrientation) -{ - mOrientation = eOrientation; -} - -nsContextControllerOrientation nsCalContextController :: GetOrientation() -{ - return (mOrientation); -} - -nsresult nsCalContextController :: Init() -{ - static NS_DEFINE_IID(kCalDurationCID, NS_DURATION_CID); - static NS_DEFINE_IID(kCalDurationIID, NS_IDURATION_IID); - - nsresult res = nsRepository::CreateInstance(kCalDurationCID, - nsnull, - kCalDurationCID, - (void **)&mDuration); - - if (NS_OK != res) - return res; - - mDuration->SetYear(0); - mDuration->SetMonth(0); - mDuration->SetDay(0); - mDuration->SetHour(0); - mDuration->SetMinute(0); - mDuration->SetSecond(0); - - return (nsCalCanvas::Init()); -} - -nsresult nsCalContextController :: Attach(nsIXPFCObserver * aObserver) -{ - return NS_OK; -} - -nsresult nsCalContextController :: Detach(nsIXPFCObserver * aObserver) -{ - return NS_OK; -} - -nsresult nsCalContextController :: Notify(nsIXPFCCommand * aCommand) -{ - nsIXPFCSubject * subject; - - nsresult res = QueryInterface(kXPFCSubjectIID,(void **)&subject); - - if (res != NS_OK) - return res; - - nsIXPFCObserverManager* om; - nsServiceManager::GetService(kCXPFCObserverManagerCID, kIXPFCObserverManagerIID, (nsISupports**)&om); - - res = om->Notify(subject,aCommand); - - nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, om); - - return(res); -} - -nsresult nsCalContextController :: SetDuration(nsDuration * aDuration) -{ - mDuration = aDuration; - return NS_OK; -} - -nsDuration * nsCalContextController :: GetDuration() -{ - return (mDuration); -} - -nsresult nsCalContextController::SetPeriodFormat(nsCalPeriodFormat aPeriodFormat) -{ - mPeriodFormat = aPeriodFormat; - return NS_OK; -} - -nsCalPeriodFormat nsCalContextController::GetPeriodFormat() -{ - return (mPeriodFormat); -} - -nsresult nsCalContextController :: SetParameter(nsString& aKey, nsString& aValue) -{ - /* - * Orientation - */ - - if (aKey.EqualsIgnoreCase(CAL_STRING_ORIENTATION)) { - if (aValue.EqualsIgnoreCase(CAL_STRING_EAST)) - SetOrientation(nsContextControllerOrientation_east); - else if (aValue.EqualsIgnoreCase(CAL_STRING_WEST)) - SetOrientation(nsContextControllerOrientation_west); - else if (aValue.EqualsIgnoreCase(CAL_STRING_NORTH)) - SetOrientation(nsContextControllerOrientation_north); - else if (aValue.EqualsIgnoreCase(CAL_STRING_SOUTH)) - SetOrientation(nsContextControllerOrientation_south); - // XXX: TODO the actual orientation in this case depends on - // the layout objects orientation! - else if (aValue.EqualsIgnoreCase(CAL_STRING_NORTHWEST)) - SetOrientation(nsContextControllerOrientation_north); - else if (aValue.EqualsIgnoreCase(CAL_STRING_SOUTHEAST)) - SetOrientation(nsContextControllerOrientation_south); - } - - /* - * Context Rule - */ - - else if (aKey.EqualsIgnoreCase(CAL_STRING_USECTXRULE)) { - // XXX: Look at value "Day+1" to determine how to assign our - // datetime object and whether it is positive or negative - - PRInt32 i ; - - if (aValue.Find(CAL_STRING_SECOND) != kNotFound) { - SetPeriodFormat(nsCalPeriodFormat_kSecond); - nsString string = aValue.Cut(0,6); - mDuration->SetSecond(string.ToInteger(&i)); - } else if (aValue.Find(CAL_STRING_MINUTE) != kNotFound) { - SetPeriodFormat(nsCalPeriodFormat_kMinute); - nsString string = aValue.Cut(0,6); - mDuration->SetMinute(string.ToInteger(&i)); - } else if (aValue.Find(CAL_STRING_HOUR) != kNotFound) { - SetPeriodFormat(nsCalPeriodFormat_kHour); - nsString string = aValue.Cut(0,4); - mDuration->SetHour(string.ToInteger(&i)); - } else if (aValue.Find(CAL_STRING_DAY) != kNotFound) { - SetPeriodFormat(nsCalPeriodFormat_kDay); - nsString string = aValue.Cut(0,3); - mDuration->SetDay(string.ToInteger(&i)); - } else if (aValue.Find(CAL_STRING_MONTH) != kNotFound) { - SetPeriodFormat(nsCalPeriodFormat_kMonth); - nsString string = aValue.Cut(0,5); - mDuration->SetMonth(string.ToInteger(&i)); - } else if (aValue.Find(CAL_STRING_YEAR) != kNotFound) { - SetPeriodFormat(nsCalPeriodFormat_kMonth); - nsString string = aValue.Cut(0,4); - mDuration->SetYear(string.ToInteger(&i)); - } - - } - - - return (nsCalCanvas::SetParameter(aKey, aValue)); -} diff --git a/mozilla/calendar/modules/ui/controller/src/nsCalMonthContextController.cpp b/mozilla/calendar/modules/ui/controller/src/nsCalMonthContextController.cpp deleted file mode 100644 index 4a5acd94e9e..00000000000 --- a/mozilla/calendar/modules/ui/controller/src/nsCalMonthContextController.cpp +++ /dev/null @@ -1,1960 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalMonthContextController.h" -#include "nsCalUICIID.h" - -#include "jdefines.h" -#include "events.h" -#include "ptrarray.h" -#include "datetime.h" - -#include "nsIWidget.h" -#include "nsIDeviceContext.h" -#include "nsColor.h" -#include "nsFont.h" -#include "nsWidgetsCID.h" -#include "nsCRT.h" -#include "nsDebug.h" -#include "nsSize.h" -#include "nsPoint.h" -#include "nsDuration.h" -#include "nsxpfcCIID.h" - - -static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); -static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); -static NS_DEFINE_IID(kCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID); -static NS_DEFINE_IID(kCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID); - -#include "nsCalDurationCommand.h" -#include "nsCalDayListCommand.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalMonthContextControllerCID, NS_CAL_MONTH_CONTEXT_CONTROLLER_CID); -static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID); -static NS_DEFINE_IID(kCalDateTimeCID, NS_DATETIME_CID); -static NS_DEFINE_IID(kCalDateTimeIID, NS_IDATETIME_IID); -static NS_DEFINE_IID(kCalDurationCID, NS_DURATION_CID); -static NS_DEFINE_IID(kCalDurationIID, NS_IDURATION_IID); - -#define DEFAULT_WIDTH 210 -#define DEFAULT_HEIGHT 210 - -nsCalMonthContextController :: nsCalMonthContextController(nsISupports* outer) : nsCalContextController(outer) -{ - NS_INIT_REFCNT(); - int i; - m_iFontSize = 10; - m_iMCRows = 0; - m_iMCCols = 0; - m_sFontName = "Arial"; // Used to be "Times Roman" - m_iMCVertSpacing = 10; - m_iMCHorzSpacing = 10; - m_iCellHorzSpacing = 4; - m_iCellVertSpacing = 4; - m_iDOWChars = 2; - m_iYOffset = 2; - m_iXOffset = 2; // this far from the right edge of the cell. - m_eTitleAlign = nsCalMonthContextController::CENTER; - m_Locale = Locale::getDefault(); - for (i = 0; i < 7; i++) - m_asDOW[i] = 0; - for (i = 0; i < 12; i++) - m_asMonths[i] = 0; - m_iFDOW = 0; - m_iMatrixSize = 0; - m_pStartTimeMap = 0; - m_pValidPosMap = 0; - m_pDates = 0; - m_iCmdArmed = (int)CMiniCalEvent::MNOTHING; - m_iFDOW = Calendar::SUNDAY; - SetMonthsArray(); - SetDOWNameArray(1); - m_bGrid = 0; - m_bSep = 1; - m_bWeeks = 1; - m_bArrows = 1; - m_MCBGColor = GetBackgroundColor(); - m_DIMFGColor = NS_RGB(128,64,0); - m_CurDayFGColor = NS_RGB(255,255,255); - m_CurDayBGColor = NS_RGB(0,0,255); - m_HighlightFGColor = NS_RGB(255,255,255); - m_HighlightBGColor = NS_RGB(255,0,0); - m_ActionDateList = nsnull; - SetDefaults(); -} - -nsCalMonthContextController :: ~nsCalMonthContextController() -{ - if (m_pDates != 0) - delete m_pDates; - - if (nsnull != m_pValidPosMap) - PR_Free(m_pValidPosMap); - - if (nsnull != m_pStartTimeMap) - PR_Free(m_pStartTimeMap); - - NS_IF_RELEASE(m_ActionDateList); - -} - -nsresult nsCalMonthContextController::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalMonthContextControllerCID); - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) (nsCalMonthContextController *)this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - if (aIID.Equals(kIXPFCCanvasIID)) { - *aInstancePtr = (void*) (nsIXPFCCanvas *)(this); - AddRef(); - return NS_OK; - } - return (nsCalContextController::QueryInterface(aIID, aInstancePtr)); -} - -NS_IMPL_ADDREF(nsCalMonthContextController) -NS_IMPL_RELEASE(nsCalMonthContextController) - -nsresult nsCalMonthContextController :: Init() -{ - if (nsnull == m_pDates) - m_pDates = new JulianPtrArray(); - - /* - * Create the Interactive date list array - */ - - if (nsnull == m_ActionDateList) - { - static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID); - - nsresult res = nsRepository::CreateInstance(kCVectorCID, - nsnull, - kCVectorCID, - (void **)&m_ActionDateList); - - if (NS_OK != res) - return res ; - - m_ActionDateList->Init(); - } - - nsFont font(m_sFontName /*"Arial"*/, NS_FONT_STYLE_NORMAL, - NS_FONT_VARIANT_NORMAL, - NS_FONT_WEIGHT_BOLD, - 0, - 12); - - SetFont(font) ; - - return ResizeMapBuffers(); -} - - -/** -*** Draw all the minicals we can in the space we have -*** -**/ -void nsCalMonthContextController::DrawMiniCal(void* p) -{ -#define TIME_IT 1 -#if TIME_IT - /* - * A simple timing mechanism to help determine whether - * a change has help or hurt the redraw speed... - */ - clock_t start, finish; - start = clock(); -#endif - nsIRenderingContext * ctx = mRenderingContext; - - ctx->PushState(); - - DateTime d = GetDate(); - InitRedraw(p); - - nsRect rect; - GetBounds(rect); - - int iX = rect.x; - int iY = rect.y; - int iRows = GetMCRows(); - int iCols = GetMCCols(); - int i; - - for (i = 0; i < iRows; i++) - { - for (int j = 0; j < iCols; j++) - { - SetValidPos(i,j,0); - SetStartTimeMap(i,j,0); - PaintMiniCalElement( p, - i, j, iRows, iCols, iX,iY, d, - (i == 0 && j == 0) || (i+1 == iRows && j+1 == iCols) ); - iX += GetMCWidth() + GetMCHorzSpacing(); - d.nextMonth(); - } - iX = rect.x; - iY += GetMCHeight() + GetMCVertSpacing(); - } - -#if TIME_IT - finish = clock(); - double duration = (double)(finish - start) / CLOCKS_PER_SEC; - start = clock(); -#endif - - HighlightCell(GetDate(),GetCurrentDayFGColor(),GetCurrentDayBGColor()); - - nscolor hFG = GetCurrentDayFGColor(); - nscolor hBG = GetCurrentDayBGColor(); - for (i = 0; i < m_pDates->GetSize(); i++) - { - HighlightCell(*(DateTime*)m_pDates->GetAt(i),hFG,hBG); - } - -#if TIME_IT - finish = clock(); - duration = (double)(finish - start) / CLOCKS_PER_SEC; -#endif - - PostRedraw(p); - - ctx->PopState(); -} - - -/** - * Paint a particular minical. - * @param p void* pointer that can be cast to a CDC* - * @param iRow which row of minicals - * @param iCol which column of minicals - * @param iTotRows total number of rows in the minical matrix - * @param iTotCols total number of columns in the minical matrix - * @param iXLeft x coordinate of upper left corner of cell - * @param iYTop y coordinate of upper left corner of cell - * @param baseDate a DateTime value with the correct month for this minical - * @param m_tm used to help with proper spacing - * @param bLeading show dates in cells that don't belong to this month? - */ -void nsCalMonthContextController::PaintMiniCalElement( - void* p, - int iRow, int iCol, - int iTotRows, int iTotCols, - int iXLeft, int iYTop, - DateTime& baseDate, - PRBool bLeading) -{ - nsIDeviceContext * pDeviceContext = (nsIDeviceContext *) p; - int iDaysInYear = 365; - int iX, iY; - int iBottom, iRight; - nsSize te; - int iStrWidth, iStrHeight; - int i, j; - char s[50]; - UnicodeString sFmt("MMMM yyyy"); // date-format pattern to print - PRBool bFirstRowFirstCol = (PRBool)(iRow == 0 && iCol == 0); - PRBool bLastRowLastCol = (PRBool)(iRow + 1 == iTotRows && iCol + 1 == iTotCols); - DateTime d = baseDate; - - /* - * Paint the background for the mini-cal - */ - mRenderingContext->SetColor(GetMCBGColor()); - mRenderingContext->FillRect(iXLeft,iYTop, GetMCWidth(),GetMCHeight()); - mRenderingContext->SetColor(GetForegroundColor()); - - /* - * If the grid is enabled, draw it... - */ - if (GetGrid()) - { - iX = iXLeft; - iY = iYTop; - iBottom = iY + GetCellRows() * GetCellHeight(); - - for ( i = 0; i <= GetCellCols(); i++) - { - mRenderingContext->DrawLine(iX,iY,iX,iBottom); - iX += GetCellWidth(); - } - iRight = iXLeft + GetCellCols()*GetCellWidth(); - iY = iYTop; - for (j = 0; j <= GetCellRows(); j++) - { - mRenderingContext->DrawLine(iXLeft,iY,iRight,iY); - iY += GetCellHeight(); - } - } - - - /* - * Print the title of the minical... - */ - // sprintf(s,"%s",d.strftime(sFmt/*,GetLocale()*/).toCString("") ); - sprintf(s,"%s %d", m_asMonths[d.getMonth()], d.getYear() ); - GetTextExtent(s,strlen(s),iStrWidth,iStrHeight); - int iSpacing = 0; - switch (m_eTitleAlign) - { - case nsCalMonthContextController::CENTER: iX = iXLeft + ((GetMCWidth() - iStrWidth)>>1); break; - case nsCalMonthContextController::LEFT: iX = iXLeft + iSpacing; break; - default: iX = iXLeft + (GetMCWidth() - iStrWidth - iSpacing); break; - } - - nscoord leading; - - mRenderingContext->GetFontMetrics()->GetLeading(leading); - - iY = iYTop + leading; - - mRenderingContext->DrawString(s, nsCRT::strlen(s), iX, iY, 100); - - /* - *** - *** Draw the arrows if needed... - *** - **/ - if (GetArrows()) - { - if (iRow == 0 && iCol == 0) - { - nsPoint pts[3]; - iY = iYTop; - - /* - * Left arrow... - */ - switch (m_eTitleAlign) - { - case nsCalMonthContextController::CENTER: iX = iXLeft; break; - case nsCalMonthContextController::LEFT: iX = iXLeft + GetMCWidth() - 2 * GetCellWidth(); break; - default: iX = iXLeft; break; - } - - pts[0].x = iX + ((3 * GetCellWidth()) >> 2); - pts[0].y = iY + (GetCellHeight() >> 2); - pts[1].x = iX + (GetCellWidth() >> 2); - pts[1].y = iY + (GetCellHeight() >> 1); - pts[2].x = pts[0].x; - pts[2].y = iY + ((3 * GetCellHeight()) >> 2); - mRenderingContext->FillPolygon(pts,3); - //m_pDC->Polygon(pts,3); - - /* - * Right arrow... - */ - switch (m_eTitleAlign) - { - case nsCalMonthContextController::CENTER: iX = iXLeft + GetMCWidth() - GetCellWidth(); break; - case nsCalMonthContextController::LEFT: iX = iXLeft + GetMCWidth() - GetCellWidth(); break; - default: iX = iXLeft + GetCellWidth(); break; - } - - pts[0].x = iX + (GetCellWidth() >> 2); - pts[0].y = iY + (GetCellHeight() >> 2); - pts[1].x = pts[0].x; - pts[1].y = iY + ((3 * GetCellHeight()) >> 2); - pts[2].x = iX + ((3 * GetCellWidth()) >> 2); - pts[2].y = iY + (GetCellHeight() >> 1); - mRenderingContext->FillPolygon(pts,3); - } - } - - - /* - * Draw the days of the week - */ - int iMaxChars = GetDOWColHdrChars(); - iX = iXLeft + (GetWeeks() ? GetCellWidth() : 0); - iY = iYTop + GetCellHeight() + leading; - for ( i = 0; i < 7; i++) - { - GetTextExtent(m_asDOW[i],iMaxChars,iStrWidth,iStrHeight); - mRenderingContext->DrawString(m_asDOW[i], nsCRT::strlen(m_asDOW[i]), iX + ((GetCellWidth() - iStrWidth)>>1), iY, 100); - iX += GetCellWidth(); - } - - /* - * Draw the separator(s) - */ - if (GetSeparator()) - { - iY = iYTop + 2 * GetCellHeight() - GetCellVertSpacing() + 1; - mRenderingContext->DrawLine(iXLeft,iY,iXLeft + GetMCWidth(),iY); - if (GetWeeks()) - { - iBottom = iY + 6*GetCellHeight(); - mRenderingContext->DrawLine(iXLeft + GetCellWidth(),iY,iXLeft + GetCellWidth(),iBottom); - } - } - - /* - * Draw the days of the monthly calendar - */ - int iXL = iXLeft + GetCellWidth() - m_iXOffset; - int iXLeftInit = iXL + (GetWeeks() ? GetCellWidth() : 0); - int iDay = 1; - iX = iXLeftInit; - iY = iYTop + 2 * GetCellHeight() + m_iYOffset; - d = baseDate; - int iThisMonth = d.get(Calendar::MONTH); - int iLastDOM; // what is the last day of the current month - PRBool bShow; - - /* - * Track the cell positions that mark where the days of the current month - * start and stop. This during event handling to quickly determine whether - * or not the mouse is on a day of the month. Note that these positions - * are relative to the 6row 7col subset of cells where the days of the month - * actually appear. - */ - int iStartPos = -1; // first day this month starts at this position - int iStopPos = -1; // last day this month is at this position - int iPos = 0; - - /* - * Set d to the first day that is to appear on the minical. That is go to the first - * of the month, then back off days until we get to the desired first day of the week. - * - * We jump through a few hoops here to set up counters so that we don't have to - * put a DateTime object inside the loops below. Things slowed down considerably - * when a DateTime was incremented through the course of the loop. - * - * The state diagram is as follows: - * < 0 - date is in previous month - * == 0 - date is in current month - * > 0 - date is in next month - */ - d.set(Calendar::DAY_OF_MONTH,1); - d.nextMonth(); - d.prevDay(); - iLastDOM = d.get(Calendar::DAY_OF_MONTH); // this is the last day of the month - d.nextDay(); - d.prevMonth(); - int iState = 0 - d.prevDOW(GetFDOW()); // this is the date for cell 0,0 of the month matrix - SetStartTimeMap(iRow,iCol,d.getTime()); // update the map for this minical - - if ( d.get(Calendar::MONTH) != iThisMonth ) - iDay = d.get(Calendar::DAY_OF_MONTH); - int iDOY = d.get(Calendar::DAY_OF_YEAR); - int iWeek; - PRBool bDaysShownThisWeek; - - if (iDay == 1) - iStartPos = 0; - - /* - * Now spin through the all the cells of the monthly calendar - */ - for (i = 0; i < 6; i++) - { - bDaysShownThisWeek = 0; - for (j = 0; j < 7; j++) - { - /* - * If the date is in the previous or next month, don't show it unless - * bLeading is true. - */ - bShow = 1; - if ( iState != 0) // if d.month != iThisMonth - { - /* - * Actually, leading means show the previous days on the upper left - * minical and the trailing days on the lower right minical. - */ - if ( i == 0 && bFirstRowFirstCol || i > 0 && bLastRowLastCol ) - { - bShow = bLeading; - mRenderingContext->SetColor(GetDIMFGColor()); - } - else - bShow = 0; - } - - /* - * Print the date if we must... - */ - if (bShow) - { - sprintf(s,"%2d", iDay); - GetTextExtent(s,2,iStrWidth,iStrHeight); - mRenderingContext->DrawString(s, nsCRT::strlen(s), iX - iStrWidth, iY, 100); - bDaysShownThisWeek = 1; - } - - /* - * Set the week number based on the 4th day of the week... - */ - if (j == 3) - iWeek = iDOY/7; - - ++iDay; - if ((++iDOY) > iDaysInYear) - iDOY = 1; - - if (iDay > iLastDOM && iState == 0) - { - iStopPos = iPos; // last day of current month is at this position - iState = 1; // next month now - iDay = 1; - } - - ++iPos; - if (iState < 0) - { - ++iState; - if (iState == 0) - { - iDay = 1; - iStartPos = iPos; // first day of current month is at this position - mRenderingContext->SetColor(GetForegroundColor()); - } - } - - iX += GetCellWidth(); - } - - /* - * If any days on the week were drawn, show the week number if weeks are turned on. - */ - if (GetWeeks() && bDaysShownThisWeek) - { - sprintf(s,"%2d", iWeek ); - GetTextExtent(s,2,iStrWidth,iStrHeight); - mRenderingContext->DrawString(s, nsCRT::strlen(s), iXL - iStrWidth, iY, 100); - } - - /* - * Move to the next row... - */ - iY += GetCellHeight(); - iX = iXLeftInit; - } - - SetValidPos(iRow,iCol,iStartPos,iStopPos); -} - -/** - * Distinguish the cell for date d from the other cells - * - * @param d this determines which cell will be highlighted - * @param fg the forground color for highighting - * @param bg the background color for highlighting - */ -void nsCalMonthContextController::HighlightCell(DateTime d, nscolor fg, nscolor bg) -{ - int iCellX, iCellY; - SetDateCoords(d,iCellX,iCellY); - HighlightCell( d, fg, bg, iCellX, iCellY ); -} - -/** - * Distinguish the cell for date d from the other cells - * - * @param d the date in the cell - * @param iX the left coordinate of the cell - * @param iY the top coordinate of the cell - */ -void nsCalMonthContextController::HighlightCell(DateTime d, nscolor fg, nscolor bg, int iX, int iY) -{ - if (iX == -1 || iY == -1) - return; - - char sBuf[20]; - - mRenderingContext->SetColor(bg); - mRenderingContext->FillRect(iX,iY, GetCellWidth(),GetCellHeight()); - - mRenderingContext->SetColor(fg); - - iX += GetCellWidth(); - sprintf(sBuf,"%2d", (int) d.getDate()); - - int iW, iH; - GetTextExtent(sBuf,2,iW,iH); - mRenderingContext->DrawString(sBuf, nsCRT::strlen(sBuf), iX - iW - m_iXOffset, iY+m_iYOffset, 100); -} - -/** - * Add the supplied dates to the current date list - * @param pV pointer to an array of dates to add - */ -void nsCalMonthContextController::SetSelectedDates(JulianPtrArray* pV) -{ - DateTime *pD; - - for (int i = 0; i < pV->GetSize(); i++) - { - pD = (DateTime *)pV->GetAt(i); - m_pDates->InsertBinary(new DateTime(*pD), DateTime_SortAscending); - //m_pDates->Add( new DateTime(*pD) ); - } -} - -/** - * Remove all dates from the current list - * - */ -void nsCalMonthContextController::ClearDateList() -{ - DateTime *pD; - for (int i = 0; i < m_pDates->GetSize(); i++) - { - pD = (DateTime *)m_pDates->GetAt(i); - delete pD; - } - m_pDates->RemoveAll(); -} - -/** - * UnhighlightDate sets the cell for the supplied date back - * to the normal foreground and background colors. - * @param d the date to unhighlight. - */ -void nsCalMonthContextController::UnhighlightDate(DateTime d) -{ - - HighlightCell(d, GetForegroundColor(), GetMCBGColor() ); -} - -/** - * RemoveSelectedDate removes the supplied date from the current - * date list if it is present. - * @param d the date to remove. - */ -void nsCalMonthContextController::RemoveSelectedDate(DateTime d) -{ - DateTime *pD; - for (int i = 0; i < m_pDates->GetSize(); i++) - { - pD = (DateTime *)m_pDates->GetAt(i); - if (*pD == d) - { - delete pD; - m_pDates->RemoveAt(i); - return; - } - } -} - -/** - * Sets internal variables that control the size of a minical. - * - * @return 0 = success, 1 = failure - */ -int nsCalMonthContextController::SetPaintValues() -{ - /* - * Based on the name, size, and style, this platform routine calculates - * the width and height of a digit. - */ - GetFontInfo( - m_sFontName, m_iFontSize, 0, - m_iDigitWidth, m_iDigitHeight, m_iMaxDOWColHdrWidth ); - - /* - * Now we have enough info to compute the size of a minical cell... - */ - m_iNumRows = 8; - m_iNumCols = 7 + (GetWeeks() ? 1 : 0); - m_iCellWidth = (m_iDigitWidth<<1); - - if (m_iMaxDOWColHdrWidth > m_iCellWidth) - m_iCellWidth = m_iMaxDOWColHdrWidth; - - m_iCellWidth += m_iCellHorzSpacing; - m_iCellHeight = m_iDigitHeight + m_iCellVertSpacing; - m_iMCWidth = m_iNumCols * m_iCellWidth; - m_iMCHeight = m_iNumRows * m_iCellHeight; - - /* - * Compute the number of minical rows and columns that will fit in the - * window we have to work with. - */ - int iWidth, iHeight; - GetWindowSize(iWidth,iHeight); - m_iMCRows = (iHeight + m_iMCVertSpacing) / (m_iMCHeight + m_iMCVertSpacing); - if (m_iMCRows < 1) m_iMCRows = 1; - m_iMCCols = (iWidth + m_iMCHorzSpacing) / (m_iMCWidth + m_iMCHorzSpacing); - if (m_iMCCols < 1) m_iMCCols = 1; - - /* - * The actual size is the amount of space taken up by all the - * minicals. This will be the same or less than the window size. - */ - m_iWidth = m_iMCCols * (m_iMCWidth + m_iMCHorzSpacing) - m_iMCHorzSpacing; - m_iHeight = m_iMCRows * (m_iMCHeight + m_iMCVertSpacing) - m_iMCVertSpacing; - - /* - * Finally, make sure we have enough room in the map buffers. - */ - return ResizeMapBuffers(); -} - -/** - * Handle events in this controller. - * - * Here's the way this stuff works. We catch low level events: mouse down, mouse up, - * mouse move. Depending on what widgets or controls are used to create this controller - * we may get full blown events. This routine breaks up the handling into 3 phases. - * - * Phase 1 - ARM - * The first phase handles mouse down. We translate this into a command and ARM the - * command. The command depends on where the mouse down happened. For example, if the - * mouse down happens over a date, we ARM the MDATE command. - * - * Phase 2 - COMMIT and DISARM - * When the mouse up event occurs, we translate the mouse-up point to a command and check - * to see if it is the same command as we ARMED. If it is the same, we COMMIT the command. - * We disarm any command after a mouse-up has occurred and after any commit has been - * handled. - * - * @param pe pointer to the mouse event pinpointing where the date must be determined. - */ -void nsCalMonthContextController::HandleEvent(CMiniCalEvent* pe) -{ - DateTime d; - SetMousePickInfo(pe); - - /* - * PHASE 1 Handle MOUSE DOWN. Set the armed command... - */ - if (CMouseEvent::MOUSEDOWN == pe->GetType() || CMouseEvent::MOUSEMOVE == pe->GetType()) - { - if (CMouseEvent::MOUSEDOWN == pe->GetType()) - { - m_iCmdArmed = (int)pe->GetAction(); - /* - * TODO: m_ActionDateList is cleared out by the routine that catches the - * mouse down. That code should be moved to here. - */ - } - - /* - * Depending on the command, take any further action necessary - */ - switch ( pe->GetAction() ) - { - case CMiniCalEvent::MNOTHING: - break; - - case CMiniCalEvent::MDATE: - if ((int)CMiniCalEvent::MNOTHING != m_iCmdArmed) - { - HandleDaySelect(pe); - } - break; - - - case CMiniCalEvent::MDOW: - if ((int)CMiniCalEvent::MNOTHING != m_iCmdArmed) - { - HandleColSelect(pe); - } - break; - - case CMiniCalEvent::MWEEK: - if ((int)CMiniCalEvent::MNOTHING != m_iCmdArmed) - { - HandleWeekSelect(pe); - } - break; - - case CMiniCalEvent::MLEFTARROW: - case CMiniCalEvent::MRIGHTARROW: - break; - - default: - /* do nothing */ - break; - } - } - - /* - * PHASES 2 and 3 require MOUSE UP - */ - if (CMouseEvent::MOUSEUP == pe->GetType()) - { - switch ( pe->GetAction() ) - { - case CMiniCalEvent::MNOTHING: - break; - - case CMiniCalEvent::MDATE: - if (((int)CMiniCalEvent::MDATE) == m_iCmdArmed) - { - HandleDaySelect(pe); - CommitDateList(); - m_iCmdArmed = (int)CMiniCalEvent::MNOTHING; - GetWidget()->Invalidate(0); - } - break; - - case CMiniCalEvent::MDOW: - if (((int)CMiniCalEvent::MDOW) == m_iCmdArmed) - { - HandleColSelect(pe); - CommitDateList(); - m_iCmdArmed = (int)CMiniCalEvent::MNOTHING; - GetWidget()->Invalidate(0); - } - break; - - case CMiniCalEvent::MWEEK: - if (((int)CMiniCalEvent::MWEEK) == m_iCmdArmed) - { - HandleWeekSelect(pe); - CommitDateList(); - m_iCmdArmed = (int)CMiniCalEvent::MNOTHING; - GetWidget()->Invalidate(0); - } - break; - - case CMiniCalEvent::MLEFTARROW: - if (((int)CMiniCalEvent::MLEFTARROW) == m_iCmdArmed) - { - int iDay = 0; - int iMonth = -1; - if (0 != pe->GetCtrl()) - { - iMonth = 0; - iDay = -1; - } - else if (0 != pe->GetShift()) - { - iMonth = 0; - iDay = -7; - } - CommitArrow(iDay,iMonth); - m_iCmdArmed = (int)CMiniCalEvent::MNOTHING; - GetWidget()->Invalidate(0); - } - break; - - case CMiniCalEvent::MRIGHTARROW: - if (((int)CMiniCalEvent::MRIGHTARROW) == m_iCmdArmed) - { - /* - * Standard = 1 month - * Shift = 1 week - * Ctrl = 1 Day - * Shift/Ctrl = 1 Day (we can do something else with this) - */ - int iDay = 0; - int iMonth = 1; - if (0 != pe->GetCtrl()) - { - iMonth = 0; - iDay = 1; - } - else if (0 != pe->GetShift()) - { - iMonth = 0; - iDay = 7; - } - CommitArrow(iDay,iMonth); - m_iCmdArmed = (int)CMiniCalEvent::MNOTHING; - GetWidget()->Invalidate(0); - } - break; - - default: - m_iCmdArmed = (int)CMiniCalEvent::MNOTHING; - break; - } - } -} - -/** - * Take all the dates in m_ActionDateList and notify observers. - */ -void nsCalMonthContextController::CommitDateList() -{ - nsCalDayListCommand * pCmd; - nsresult res = nsRepository::CreateInstance(kCalDayListCommandCID, nsnull, kXPFCCommandIID, (void **)&pCmd); - if (NS_OK != res) - return ; - pCmd->Init(); - pCmd->AddDateVector(m_ActionDateList); - Notify(pCmd); - NS_IF_RELEASE(pCmd); -} - -/** - * Move a month forward or backward - * @param iMonthVal set to a positive number to move that many months forward, - * or a negative number to move that many months backwards. - */ -void nsCalMonthContextController::CommitArrow(int iDayVal, int iMonthVal) -{ - nsCalDurationCommand * command; - nsresult res = nsRepository::CreateInstance(kCalDurationCommandCID, nsnull, kXPFCCommandIID, (void **)&command); - if (NS_OK != res) - return; - - nsDuration * duration; - res = nsRepository::CreateInstance(kCalDurationCID, nsnull, kCalDurationCID, (void **)&duration); - command->Init(duration); - command->SetPeriodFormat(nsCalPeriodFormat_kMonth); - duration->SetMonth(iMonthVal); - duration->SetDay(iDayVal); - Notify(command); - NS_IF_RELEASE(duration); - NS_IF_RELEASE(command); -} - -/** - * Set some useful variables for determining where the mouse cursor is. It also - * sets the Action variable in the event. It does not take action, it just sets the - * action to take. - * - * @param pe pointer to the mouse event pinpointing where the date must be determined. - */ -void nsCalMonthContextController::SetMousePickInfo(CMiniCalEvent *pe) -{ - m_iTMCW = m_iMCWidth + m_iMCHorzSpacing; // total minical width - m_iTMCH = m_iMCHeight + m_iMCVertSpacing; // total minical height; - m_iPikMCCol = pe->GetX() / m_iTMCW; // which column of minicals - m_iPikMCRow = pe->GetY() / m_iTMCH; // which row of minicals - m_iMCX = pe->GetX() - m_iPikMCCol * m_iTMCW; // x coord relative to upper left of m_iPikMC - m_iMCY = pe->GetY() - m_iPikMCRow * m_iTMCH; // y coord relative to upper left of m_iPikMC - m_iCellCol = m_iMCX / m_iCellWidth; // which cell column of m_iPikMC - m_iCellRow = m_iMCY / m_iCellHeight; // which cell row of m_iPikMC - - if (-1 == m_iAnchorMCCol) - { - m_iAnchorMCCol = m_iPikMCCol; - m_iAnchorMCRow = m_iPikMCRow; - } - - /*--------------------------------------------------------- - * Now determine what type of event it was... - *--------------------------------------------------------*/ - pe->SetAction(CMiniCalEvent::MNOTHING); - - /* - * CHECK FOR WEEKS - */ - if ( GetWeeks() && m_iCellCol == 0 && 2 <= m_iCellRow && m_iCellRow <= 7) - { - int iStartPos, iStopPos; - GetValidPos(m_iPikMCRow, m_iPikMCCol, &iStartPos, &iStopPos); - if ( m_iCellRow - 2 > iStopPos/7 ) - { - SetCursor(eCursor_standard); - } - else - { - pe->SetAction(CMiniCalEvent::MWEEK); - pe->SetWeekOffset(m_iCellRow - 2); - SetCursor(eCursor_hyperlink); - } - return; - } - - int iCellCol = m_iCellCol; - if (GetWeeks()) - --iCellCol; - - /* - * CHECK FOR ARROWS - */ - if (GetArrows() && 0 == m_iCellRow && m_iPikMCRow == 0 && m_iPikMCCol == 0) - { - // Left Arrow... - if (nsCalMonthContextController::RIGHT == m_eTitleAlign || - nsCalMonthContextController::CENTER == m_eTitleAlign ) - { - if (m_iCellCol == 0) - { - SetCursor(eCursor_hyperlink); - pe->SetAction(CMiniCalEvent::MLEFTARROW); - return; - } - } - if (nsCalMonthContextController::LEFT == m_eTitleAlign && - m_iCellCol == (5 + (GetWeeks() ? 1 : 0)) ) - { - SetCursor(eCursor_hyperlink); - pe->SetAction(CMiniCalEvent::MLEFTARROW); - return; - } - - // Right Arrow... - if (nsCalMonthContextController::LEFT == m_eTitleAlign || - nsCalMonthContextController::CENTER == m_eTitleAlign ) - { - if (m_iCellCol == (6 + (GetWeeks() ? 1 : 0)) ) - { - SetCursor(eCursor_hyperlink); - pe->SetAction(CMiniCalEvent::MRIGHTARROW); - return; - } - } - if (nsCalMonthContextController::RIGHT == m_eTitleAlign && m_iCellCol == 1) - { - SetCursor(eCursor_hyperlink); - pe->SetAction(CMiniCalEvent::MRIGHTARROW); - return; - } - } - - /* - * CHECK FOR DOW COLUMNS - */ - if (m_iCellRow == 1 && iCellCol >= 0 && iCellCol <= 6) - { - FindDOW(pe); - SetCursor(eCursor_hyperlink); - pe->SetAction(CMiniCalEvent::MDOW); - return; - } - - /* - * CHECK FOR DATES - */ - if (2 <= m_iCellRow && m_iCellRow <= 7 && iCellCol >= 0 && iCellCol <= 6) - { - if (FindDate(pe)) - { - FindDOW(pe); - SetCursor(eCursor_hyperlink); - pe->SetAction(CMiniCalEvent::MDATE); - } - else - { - SetCursor(eCursor_standard); - } - return; - } - - SetCursor(eCursor_standard); -} - -/** - * Based on the date, set the upper left coordinate of the cell - * @param d the date for which coordinates will be determined. - * @param iCellX left coordinate of cell where date is located, -1 if date is not found - * @param iCellY top coordinate of cell where date is located, -1 if date is not found - */ -void nsCalMonthContextController::SetDateCoords(DateTime d, int& iCellX, int& iCellY) -{ - PRBool bFound = 0; - int iDay = d.getDate(); - int iMonth = d.getMonth(); - int iYear = d.getYear(); - - DateTime dd = GetDate(); - iCellX = iCellY = -1; // assume it's not found - - //------------------------------------------------ - // Which Minical is it in? - //------------------------------------------------ - int i=0,j=-1; - for (i = 0; i < m_iMCRows; i++) - { - for (j = 0; j < m_iMCCols; j++) - { - if (dd.getMonth() == iMonth && - dd.getYear() == iYear ) - { - bFound = TRUE; - break; - } - else - dd.nextMonth(); - } - if (bFound) break; - } - - if (!bFound) return; // if we didn't find it, bail out now - - //------------------------------------------------ - // Track down the location... - //------------------------------------------------ - iCellX = j * (m_iMCWidth + m_iMCHorzSpacing); - iCellY = i * (m_iMCHeight + m_iMCVertSpacing); - dd.setDayOfMonth(1); - - SetFDOW(dd); - bFound = FALSE; - for (i = 0; i < 6; i++) - { - for (j = 0; j < 7; j++) - { - if ( dd.get(Calendar::DAY_OF_MONTH) == iDay && - dd.get(Calendar::YEAR) == iYear && - dd.get(Calendar::MONTH) == iMonth ) - { - nsRect rect; - - iCellX += (j + (GetWeeks()?1:0)) * m_iCellWidth; - iCellY += (2 + i) * m_iCellHeight; - - GetBounds(rect); - iCellX += rect.x; - iCellY += rect.y; - - return; - } - dd.nextDay(); - } - } - iCellX = iCellY = -1; // didn't find it -} - -/** - * Add the days for this column to m_ActionDateList. Highlight the dates - * @param pe the event - */ -nsresult nsCalMonthContextController::HandleColSelect(CMiniCalEvent *pe) -{ - nsresult res = GetDOWList(pe->GetDOW()); - - // XXX What happens if we fail? - if (NS_OK != res) - return res; - - HighlightActionList(); - return NS_OK; -} - -/** - * Add the days for this column to m_ActionDateList. Highlight the dates - * @param pe the event - * @return NS_OK - */ -nsresult nsCalMonthContextController::HandleWeekSelect(CMiniCalEvent *pe) -{ - GetWeekDateList(pe->GetWeekOffset()); - HighlightActionList(); - return NS_OK; -} - -/** - * Add the days for this column to m_ActionDateList. Highlight the dates - * @param pe the event - * @return NS_OK - */ -nsresult nsCalMonthContextController::HandleDaySelect(CMiniCalEvent *pe) -{ - Date d(pe->GetDate().getTime() ); - AddToActionList( d ); - HighlightActionList(); - return NS_OK; -} - -/** - * A comparison routine for nsDateTime values... - * @param v1 pointer to a pointer to the first nsDateTime - * @param v2 pointer to a pointer to the second nsDateTime - * @return -1 if D1 < D2, 0 if D1 == D2, 1 if D1 > D2 - */ -PRInt32 nsDateTime_SortAscending( const void* v1, const void* v2 ) -{ - nsDateTime *p1 = *(nsDateTime**)v1; - nsDateTime *p2 = *(nsDateTime**)v2; - - DateTime *pD1 = p1->GetDateTime(); - DateTime *pD2 = p2->GetDateTime(); - - if (*pD1 == *pD2) - return 0; - else if (*pD1 > *pD2) - return 1; - else - return -1; -} - -/** - * The ActionList has been updated. Refresh the screen... - */ -nsresult nsCalMonthContextController::HighlightActionList() -{ - nsDateTime* pDate; - - /* - * Create a Rendering Context for highlighting - * - * XXX: Get rid of mRenderingContext - */ - nsIRenderingContext * prevContext = nsnull; - if (mRenderingContext != nsnull) - { - prevContext = mRenderingContext; - } - else - { - mRenderingContext = GetWidget()->GetRenderingContext(); - InitRedraw((void *)mRenderingContext); - } - - /* - * Highlight the dates we found. - */ - nsIIterator * iterator; - m_ActionDateList->CreateIterator(&iterator); - iterator->Init(); - DateTime another_datetime; - - while(!(iterator->IsDone())) - { - pDate = (nsDateTime *) iterator->CurrentItem(); - another_datetime.setTime(pDate->GetDateTime()->getTime()); - HighlightCell(another_datetime,GetHighlightFGColor(),GetHighlightBGColor()); - iterator->Next(); - } - NS_IF_RELEASE(iterator); - - if (prevContext == nsnull) - { - NS_IF_RELEASE(mRenderingContext); - mRenderingContext = nsnull; - } - return NS_OK; -} - -nsresult nsCalMonthContextController::AddToActionList(DateTime d) -{ - nsDateTime * nsdatetime; - nsresult res = nsRepository::CreateInstance(kCalDateTimeCID,nsnull, kCalDateTimeCID, (void **)&nsdatetime); - if (NS_OK == res) - { - nsdatetime->Init(); - DateTime * dstar = new DateTime(d.getTime()); - nsdatetime->SetDateTime(dstar); - if ( -1 == m_ActionDateList->InsertBinary(nsdatetime,(nsArrayCompareProc)nsDateTime_SortAscending, PR_FALSE /* do not allow dups */)) - { - NS_IF_RELEASE(nsdatetime); - } - } - return res; -} - -/** - * Build a list of dates for the supplied month and the supplied day of the week. - * Note that the caller must delete everything. - * - * @param iDOW the day of the week constant. For example, Calendar.MONDAY - * @return the vector of dates - */ -nsresult nsCalMonthContextController::GetDOWList(int iDOW) -{ - DateTime d; - d.setTime(GetStartTimeMap(m_iPikMCRow,m_iPikMCCol)); - - /* - * If we're on a day of the previous month, move forward until we hit the - * actual month. If the day number is > 7 then we *must* be on the previous month - */ - while (7 < d.getDate()) - d.nextDay(); - - /* - * Now move forward until we get to the day of the week that the user selected... - */ - while ( iDOW != d.get(Calendar::DAY_OF_WEEK)) - d.nextDay(); - - /* - * Now collect all the days of this month that fall on the selected day of the week - */ - for (int iMonth = d.getMonth(); iMonth == d.getMonth(); d.add(Calendar::DATE,7) ) - AddToActionList(d); - - return NS_OK; -} - -/** - * Build a vector of dates for the week at the supplied offset in the selected minical. - * @param iWeekOffset the day of the week constant. For example, Calendar::MONDAY - * @return NS_OK - */ -nsresult nsCalMonthContextController::GetWeekDateList(int iWeekOffset) -{ - DateTime d; - d.setTime(GetStartTimeMap(m_iPikMCRow,m_iPikMCCol)); - - int i; - for (i = 1; i <= iWeekOffset; i++) - d.add(Calendar::DATE, 7); - for (i = 0; i < 7; d.nextDay(), i++ ) - AddToActionList(d); - return NS_OK; -} - - -#if 0 -/** - * Update the minical based on the date found under the latest mouse event. - * @param T The date under the mouse - */ -void nsCalMonthContextController::trackMouseEvent(DateTime T) -{ - DateTime A = m_AnchorDate; - DateTime L = m_LastTrackDate; - - if (null == m_AnchorDate) - { - m_AnchorDate = T; - m_LastTrackDate = T; - addToDateList( T ); - return; - } - - /* - * Key: - * A = anchor date - * L = last track date - * T = current tracking date - */ - if (L.equals(T)) - return; - else if ( T.before(L) && A.equals(L) ) /* T - AL */ - addToDateList( expandDateList( T,L.prevDay() ) ); - else if ( A.equals(L) && L.before(T) ) /* AL - T */ - addToDateList( expandDateList( L.nextDay(),T ) ); - else if ( L.before(A) && A.equals(T) ) /* L - AT */ - removeFromDateList( expandDateList( L, A.prevDay() ) ); - else if ( A.equals(T) && A.before(L) ) /* AT - L */ - removeFromDateList( expandDateList( A.nextDay(),L ) ); - else if ( A.before(L) && L.before(T) ) /* A - L - T */ - addToDateList( expandDateList( L.nextDay(),T ) ); - else if ( A.before(T) && T.before(L) ) /* A - T - L */ - removeFromDateList( expandDateList( T.nextDay(),L ) ); - else if ( L.before(T) && T.before(A) ) /* L - T - A */ - removeFromDateList( expandDateList( L, T.prevDay() ) ); - else if ( T.before(L) && L.before(A) ) /* T - L - A */ - addToDateList( expandDateList( T, L.prevDay() ) ); - else if ( T.before(A) && A.before(L) ) /* T - A - L */ - { - removeFromDateList( expandDateList( A.nextDay(), L ) ); - addToDateList( expandDateList( T, A.prevDay() ) ); - } - else if ( L.before(A) && A.before(T) ) /* L - A - T */ - { - removeFromDateList( expandDateList( L, A.prevDay() ) ); - addToDateList( expandDateList( A.nextDay(), T ) ); - } - - m_LastTrackDate = T; -} -#endif - -/** - * Based on the supplied date, move the date backwards until - * it is on the desired first day of the week. - * @param d The date from which to back off - */ -void nsCalMonthContextController::SetFDOW(DateTime &d) -{ - int i = d.get(Calendar::DAY_OF_WEEK); - while ( i != GetFDOW()) - { - if ( i == Calendar::SUNDAY ) - i = Calendar::SATURDAY; - else - i--; - d.prevDay(); - i = d.get(Calendar::DAY_OF_WEEK); - } -} - -/** - * Make sure there's enough room in the map buffers to hold entries for the - * current number of rows and columns. If not, reallocate some memory. - * - * @return 0 = success, 1 = failure - */ -int nsCalMonthContextController::ResizeMapBuffers() -{ - int iMatrixSize = m_iMCCols * m_iMCRows; // number of entries - if (iMatrixSize < 25) - iMatrixSize = 25; // minimum is for 5 rows 5 cols - if (m_iMatrixSize >= iMatrixSize) - return 0; // return if current buffers are big enough - - if (m_pStartTimeMap) - PR_Free(m_pStartTimeMap); - if (m_pValidPosMap) - PR_Free(m_pValidPosMap); - - m_iMatrixSize = 0; // be pessimistic - int iSize = iMatrixSize * sizeof(long); - if (0 == (m_pStartTimeMap = (Date *)PR_Malloc(iSize))) - return 1; - - iSize = iMatrixSize * sizeof(int); - if (0 == (m_pValidPosMap = (int *)PR_Malloc(iSize))) - return 1; - - m_iMatrixSize = iMatrixSize; // success! - return 0; -} - -/** - * The entries in this matrix contain the valid start and stop cell positions - * in the minical at the specified row and column. This routine returns those - * positions. - * - */ -void nsCalMonthContextController::GetValidPos(int iRow, int iCol, int* piPosStart, int* piPosStop) -{ - int iVal = m_pValidPosMap[iRow * m_iMCCols + iCol]; - *piPosStart = iVal & 0xff; - *piPosStop = (iVal >> 8) & 0xff; -} - -/** - * The entries in this matrix contain the valid start and stop cell positions - * in the minical at the specified row and column. This routine sets the value - * at the supplied position - */ -void nsCalMonthContextController::SetValidPos(int iRow, int iCol, int iPosStart, int iPosStop) -{ - m_pValidPosMap[iRow * m_iMCCols + iCol] = (0xff & iPosStart) | ((0xff & iPosStop) << 8); -} - - -/** - * Determine the date that the mouse is over. SetMousePickInfo must have been - * called prior to calling this routine. Its calculations are based on its - * calculations. If the pick is found to be outside the valid date range, this - * routine sets the Action to MNOTHING. If a date is found, it is set in - * the Date slot for the CMiniCalEvent. - * - * @return 1 if a date is found, 0 if no date is found - */ -int nsCalMonthContextController::FindDate(CMiniCalEvent* e) -{ - e->SetAction(CMiniCalEvent::MNOTHING); // assume we don't find anything - - if (m_iPikMCCol >= m_iMCCols || m_iPikMCRow >= m_iMCRows) - return 0; - - int iPos, iStartPos,iStopPos; - int iCellCol = m_iCellCol; - int iCellRow = m_iCellRow; - - /* - * Info for quick reject check. If iRow,iCol does not point to a cell containing valid - * dates for this month, reject it. - */ - GetValidPos(m_iPikMCRow, m_iPikMCCol, &iStartPos, &iStopPos); - - if (m_iPikMCRow < m_iMCRows && m_iPikMCCol < m_iMCCols) - { - DateTime d( GetStartTimeMap(m_iPikMCRow,m_iPikMCCol) ); - - iCellRow -= 2; // first 2 rows are month/year and weekday names - if (GetWeeks()) - iCellCol -= 1; // if weeks are on, first col is week number - - if (iCellRow < 6 && iCellRow >= 0 && - iCellCol < 7 && iCellCol >= 0 ) - { - //--------------------------------------------------------------- - // Last check, make sure that this cell is showing a date... - //--------------------------------------------------------------- - iPos = iCellRow*7 + iCellCol; - if (iPos < iStartPos || iPos > iStopPos) - return 0; - - //--------------------------------------------------------------- - // We got it! It's a valid date. Add it to the selected list. - //--------------------------------------------------------------- - int iOffset = 7 * iCellRow + iCellCol; - d.add(Calendar::DAY_OF_YEAR, iOffset); - e->SetAction(CMiniCalEvent::MDATE); - e->SetDate(d); - return 1; - } - } - return 0; -} - -/** - * Determine the day of the week that the mouse is over - * sets the FDOW field in the event to the dow, -1 means no match - * @param e the mouse event pinpointing where the dow must be determined. - */ -void nsCalMonthContextController::FindDOW(CMiniCalEvent* e) -{ - int iCellCol = m_iCellCol; - - if (GetWeeks()) - iCellCol -= 1; // if weeks are on, first col is week number - int i, iDOW; - for (iDOW = GetFDOW(), i = 0; i <= iCellCol; i++) - { - if (i == iCellCol) - { - e->SetDOW(iDOW); - return; - } - if (iDOW == Calendar::SATURDAY) - iDOW = Calendar::SUNDAY; - else - iDOW++; - } - return; -} - -/** -*** Reset the internal array of names for fast painting. -*** -**/ -void nsCalMonthContextController::SetDOWNameArray(PRBool bLocaleChange) -{ - UnicodeString sFmt("EEE"); - char sBuf[256]; - - /* - * Did first day of week change? - */ - int iFDOW = GetFDOW(); - if (m_iFDOW != iFDOW || bLocaleChange) - { - /* - * Something has changed. Update the strings... - */ - sFmt = "EEE"; - int iMaxChars = GetDOWColHdrChars(); - int iLen = iMaxChars + 1; - m_iFDOW = iFDOW; - DateTime d; - d.prevDOW(GetFDOW()); - for ( int i = 0; i < 7; i++) - { - if (m_asDOW[i]) - PR_Free(m_asDOW[i]); - m_asDOW[i] = (char *) PR_Malloc(iLen); - sprintf(sBuf,"%s", d.strftime(sFmt,GetLocale()).toCString("")); - strncpy(m_asDOW[i],sBuf,iMaxChars); - (m_asDOW[i])[iMaxChars] = 0; - d.nextDay(); - } - } -} - -/** - * The locale changed. Reload the months array... - */ -void nsCalMonthContextController::SetMonthsArray() -{ - UnicodeString sFmt("MMMM"); - char sBuf[256]; - DateTime d(1998,0,1); - int iLen; - - for (int i = 0; i < 12; i++) - { - if (m_asMonths[i]) - PR_Free(m_asMonths[i]); - sprintf(sBuf,"%s",d.strftime(sFmt,GetLocale()).toCString("") ); - iLen = strlen(sBuf); - m_asMonths[i] = (char *) PR_Malloc(iLen+1); - strcpy(m_asMonths[i],sBuf); - (m_asMonths[i])[iLen] = 0; - d.nextMonth(); - } -} - - -nsString nsCalMonthContextController::ToString() -{ - nsString sVal = "MiniCal \r\n"; - sVal += " Grid="; - sVal += m_bGrid ? "on" : "off"; - sVal += "\r\n"; - - sVal += " Sep="; - sVal += m_bSep ? "on" : "off"; - sVal += "\r\n"; - - sVal += " Weeks="; - sVal += m_bWeeks ? "on" : "off"; - sVal += "\r\n"; - - return sVal; -} - -void nsCalMonthContextController::SetFDOW(int i) -{ - m_iFDOW = i; - SetDOWNameArray(0); -} - - -void nsCalMonthContextController::SetDefaults() -{ - m_sFontName = "Arial"; // "Times New Roman"; -} - - -///////////////////////////////////////////////////////////////////////////// -// CMiniCalPlatform message handlers - - -nsEventStatus nsCalMonthContextController :: OnPaint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - mRenderingContext = &aRenderingContext; - - PushState(aRenderingContext); - - PaintBackground(aRenderingContext,aDirtyRect); - - DrawMiniCal((void *)mRenderingContext); - - PopState(aRenderingContext); - - mRenderingContext = nsnull; - - return nsEventStatus_eConsumeNoDefault; -} - -nsEventStatus nsCalMonthContextController :: OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) -{ - GetWidget()->Resize(0,0,aWidth,aHeight, PR_TRUE); - return nsEventStatus_eConsumeNoDefault; -} - -/** - * Use this routine to set up any variables needed to - * redraw. It is called by the bridge at the beginning of - * the redraw. It should be called once prior to drawing - * or highlighting. - * - * @param p the value m_pBridge->DrawMiniCal was called with. - * currently it is a pointer to the DC to use. - * - */ -void nsCalMonthContextController::InitRedraw(void* /*p*/) -{ - SetPaintValues(); - mRenderingContext->SetFont(GetFont()); -} - -/** - * Use this routine to clean up any variables after - * the redraw. - * - * @param p the value m_pBridge->DrawMiniCal was called with. - * currently it is a pointer to the DC to use - */ -void nsCalMonthContextController::PostRedraw(void* /*p*/) -{ -} - - -/** - * Set the color used to draw text - * - * @param p character string to print - * @param iWidth the width of the string - * @param iHeight the height of the string - */ -void nsCalMonthContextController::GetTextExtent(char *p, int iChars, int& iWidth,int& iHeight) -{ - nsIFontMetrics * fm ; - - fm = mRenderingContext->GetFontMetrics(); - - mRenderingContext->GetWidth(p,(nscoord)iWidth); - fm->GetHeight((nscoord)iHeight); - -} - - -/** -*** The bridge part calls this method when it needs to get -*** font metrics. We keep the local cached copy of the -*** font name, size, and style up-to-date. We load a new -*** font only if necessary. -**/ -void nsCalMonthContextController::GetFontInfo( - nsString s, int iFontSize, int /*iStyle*/, // input - int& riDigitWidth, int& riDigitHeight, // output - int& riMaxDOWColHdrWidth ) // output -{ - - /* - * If anything about the font has changed, update the font... - */ - if (s != m_sFontName || iFontSize != m_iFontSize) - { - m_sFontName = s; - m_iFontSize = iFontSize; - } - - /* - * Set the font and associated values if necessary... - */ - nsSize te; - //if (NULL == mRenderingContext->GetFont()) - if (1) - { - mRenderingContext->SetFont(GetFont()); - - /* - * The minimal cell width is equal to the greater of: - * a) the amount of space required by the widest day-of-the-week (DOW) col hdr - * b) the width of two digits - * We must ask the bridge for the number of characters we are to show - * in the DOW col header and compute its width. - */ - - nsIRenderingContext * ctx = mRenderingContext; - - nsFont font(m_sFontName, NS_FONT_STYLE_NORMAL, - NS_FONT_VARIANT_NORMAL, - NS_FONT_WEIGHT_NORMAL, - 0, - 12); - - ctx->SetFont(font); - - nsIFontMetrics * fm = ctx->GetFontMetrics(); - - ctx->GetWidth("0",m_iDigitWidth); - fm->GetHeight(m_iDigitHeight); - - /* - * The next few lines need to be replaced with some code that gets the - * strings for every day of the week and computes the max width... - */ - char sBuf[100]; - strcpy(sBuf,"Wednesday"); - sBuf[GetDOWColHdrChars() ] = 0; - - ctx->GetWidth(sBuf,m_iMaxDOWColHdrWidth); - - } - - /* - * Set measurement constants that are based on the font - * based on our cached values. - */ - riDigitWidth = m_iDigitWidth; - riDigitHeight = m_iDigitHeight; - riMaxDOWColHdrWidth = m_iMaxDOWColHdrWidth; -} - -/** -*** Return the current size of this window -**/ -void nsCalMonthContextController::GetWindowSize(int& riWidth, int& riHeight) -{ - nsRect rect; - GetBounds(rect); - riWidth = rect.width; - riHeight =rect.height; -} - -/** - * clear out the action date list - */ -void nsCalMonthContextController::ClearActionDateList() -{ - if (m_ActionDateList != nsnull) - { - nsIIterator * iterator = nsnull; - nsresult res = m_ActionDateList->CreateIterator(&iterator); - if (NS_OK == res) - { - iterator->Init(); - while(!(iterator->IsDone())) - { - nsDateTime * d = (nsDateTime *)iterator->CurrentItem(); - NS_IF_RELEASE(d); - iterator->Next(); - } - m_ActionDateList->RemoveAll(); - } - NS_IF_RELEASE(iterator); - } -} - - -nsEventStatus nsCalMonthContextController::OnLeftButtonDown(nsGUIEvent *aEvent) -{ - nsRect rect; - GetBounds(rect); - - nsInputEvent * input_event = (nsInputEvent *) aEvent; - - /* - * Clean out the current DateList if shift/control not down - */ - - if ((input_event->isShift == PR_FALSE) && (input_event->isControl == PR_FALSE)) - { - ClearActionDateList(); - } - - - CMiniCalEvent e( (int)aEvent->point.x - rect.x, (int)aEvent->point.y - rect.y, CMouseEvent::MOUSEDOWN, 1, 0 ); - if (input_event->isShift) - e.SetShift(); - if (input_event->isControl) - e.SetCtrl(); - HandleEvent( &e ); - - return nsEventStatus_eConsumeNoDefault; -} - -nsEventStatus nsCalMonthContextController::OnLeftButtonUp(nsGUIEvent *aEvent) -{ - nsInputEvent * input_event = (nsInputEvent *) aEvent; - nsRect rect; - GetBounds(rect); - CMiniCalEvent e( (int)aEvent->point.x - rect.x, (int)aEvent->point.y - rect.y, CMouseEvent::MOUSEUP, 1, 0 ); - if (input_event->isShift) - e.SetShift(); - if (input_event->isControl) - e.SetCtrl(); - HandleEvent( &e ); - return nsEventStatus_eConsumeNoDefault; -} - -nsEventStatus nsCalMonthContextController::OnMouseMove(nsGUIEvent *aEvent) -{ - nsInputEvent * input_event = (nsInputEvent *) aEvent; - nsRect rect; - GetBounds(rect); - CMiniCalEvent e( (int)aEvent->point.x - rect.x, (int)aEvent->point.y - rect.y, CMouseEvent::MOUSEMOVE, 1, 0 ); - if (input_event->isShift) - e.SetShift(); - if (input_event->isControl) - e.SetCtrl(); - HandleEvent( &e ); - return nsEventStatus_eConsumeNoDefault; -} - -nsEventStatus nsCalMonthContextController::Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand) -{ - return (nsXPFCCanvas::Update(aSubject,aCommand)); -} - -/* - * After some event occurs and modification is needed to this ontext controller, - * adjust our DateTime object to reflect the event type. - * - */ - -nsEventStatus nsCalMonthContextController::Action(nsIXPFCCommand * aCommand) -{ - /* - * Adjust the duration if this is a duration command - */ - - nsCalDurationCommand * duration_command; - nsDuration * dtDuration; - nsresult res; - - static NS_DEFINE_IID(kCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID); - - /* - * DURATION - */ - res = aCommand->QueryInterface(kCalDurationCommandCID,(void**)&duration_command); - if (NS_OK == res) - { - dtDuration = duration_command->GetDuration(); - if (nsnull == dtDuration) - return nsEventStatus_eIgnore; - - DateTime d = GetDate(); - d.add(dtDuration->GetDuration()); - SetDate(d); - - for (int i = 0; i < m_pDates->GetSize(); i++) - ((DateTime*)m_pDates->GetAt(i))->add(dtDuration->GetDuration()); - - return nsEventStatus_eIgnore; - } - - - /* - * DAYLIST - */ - nsCalDayListCommand * daylist_command ; - static NS_DEFINE_IID(kCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID); - res = aCommand->QueryInterface(kCalDayListCommandCID,(void**)&daylist_command); - if (NS_OK == res) - { - nsIIterator * iterator; - res = daylist_command->CreateIterator(&iterator); - int iDateSet = 0; - - if (NS_OK != res) - return nsEventStatus_eIgnore; - iterator->Init(); - ClearDateList(); /* empty the current date list first */ - while(!(iterator->IsDone())) - { - nsDateTime * datetime = (nsDateTime *) iterator->CurrentItem(); - if (datetime != nsnull) - { - /* - * XXX: TBD Use one array class for everything - * - * Copy into m_pDates from the Command Object - */ - DateTime * dt = new DateTime(datetime->GetDateTime()->getTime()); - if (0 == iDateSet) - { - SetDate( *dt ); - iDateSet = 1; - } - m_pDates->Add((void *) dt); - } - iterator->Next(); - } - return nsEventStatus_eIgnore; - } - - return(nsXPFCCanvas::Action(aCommand)); -} - -nsresult nsCalMonthContextController :: GetClassPreferredSize(nsSize& aSize) -{ - aSize.width = DEFAULT_WIDTH; - aSize.height = DEFAULT_HEIGHT; - return (NS_OK); -} diff --git a/mozilla/calendar/modules/ui/controller/src/nsCalTimebarContextController.cpp b/mozilla/calendar/modules/ui/controller/src/nsCalTimebarContextController.cpp deleted file mode 100644 index fda7624b937..00000000000 --- a/mozilla/calendar/modules/ui/controller/src/nsCalTimebarContextController.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nsCalTimebarContextController.h" -#include "nsCalUICIID.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kCalContextControllerIID, NS_ICAL_CONTEXT_CONTROLLER_IID); - -static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID); -static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID); -static NS_DEFINE_IID(kCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID); - -#define DEFAULT_WIDTH 25 -#define DEFAULT_HEIGHT 25 - -#include "nsCalDurationCommand.h" - -nsCalTimebarContextController :: nsCalTimebarContextController(nsISupports * aOuter) : nsCalContextController(aOuter) -{ - NS_INIT_REFCNT(); -} - -nsCalTimebarContextController :: ~nsCalTimebarContextController() -{ -} - -nsresult nsCalTimebarContextController::QueryInterface(REFNSIID aIID, void** aInstancePtr) -{ - - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - static NS_DEFINE_IID(kClassIID, kCalContextControllerIID); - - if (aIID.Equals(kClassIID)) { - *aInstancePtr = (void*) this; - AddRef(); - return NS_OK; - } - if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*) (this); - AddRef(); - return NS_OK; - } - - return (nsCalContextController::QueryInterface(aIID, aInstancePtr)); - -} - - -NS_IMPL_ADDREF(nsCalTimebarContextController) -NS_IMPL_RELEASE(nsCalTimebarContextController) - -nsEventStatus nsCalTimebarContextController :: PaintForeground(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - - nsPoint pts[3]; - - aRenderingContext.SetColor(GetForegroundColor()); - - GetTrianglePoints(pts); - - RenderController(aRenderingContext, pts,3); - - return nsEventStatus_eConsumeNoDefault; -} - - -nsresult nsCalTimebarContextController :: RenderController(nsIRenderingContext& aCtx, - nsPoint * aPoints, - PRUint32 aNumPoints) -{ - aCtx.FillPolygon(aPoints,aNumPoints); - - switch(GetOrientation()) - { - case nsContextControllerOrientation_east: - - aCtx.SetColor(Highlight(GetForegroundColor())); - aCtx.DrawLine(aPoints[0].x,aPoints[0].y,aPoints[1].x,aPoints[1].y); - aCtx.DrawLine(aPoints[2].x,aPoints[2].y,aPoints[0].x,aPoints[0].y); - - aCtx.SetColor(Dim(GetForegroundColor())); - aCtx.DrawLine(aPoints[1].x,aPoints[1].y,aPoints[2].x,aPoints[2].y); - - break; - - case nsContextControllerOrientation_west: - - aCtx.SetColor(Highlight(Highlight(GetForegroundColor()))); - aCtx.DrawLine(aPoints[0].x,aPoints[0].y,aPoints[1].x,aPoints[1].y); - - aCtx.SetColor(Dim(GetForegroundColor())); - aCtx.DrawLine(aPoints[1].x,aPoints[1].y,aPoints[2].x,aPoints[2].y); - aCtx.DrawLine(aPoints[2].x,aPoints[2].y,aPoints[0].x,aPoints[0].y); - break; - - case nsContextControllerOrientation_north: - - aCtx.SetColor(Highlight(Highlight(GetForegroundColor()))); - aCtx.DrawLine(aPoints[0].x,aPoints[0].y,aPoints[1].x,aPoints[1].y); - - aCtx.SetColor(Highlight(GetForegroundColor())); - aCtx.DrawLine(aPoints[1].x,aPoints[1].y,aPoints[2].x,aPoints[2].y); - - aCtx.SetColor(Dim(GetForegroundColor())); - aCtx.DrawLine(aPoints[2].x,aPoints[2].y,aPoints[0].x,aPoints[0].y); - break; - - case nsContextControllerOrientation_south: - aCtx.SetColor(Dim(GetForegroundColor())); - aCtx.DrawLine(aPoints[0].x,aPoints[0].y,aPoints[1].x,aPoints[1].y); - aCtx.DrawLine(aPoints[1].x,aPoints[1].y,aPoints[2].x,aPoints[2].y); - - aCtx.SetColor(Highlight(GetForegroundColor())); - aCtx.DrawLine(aPoints[2].x,aPoints[2].y,aPoints[0].x,aPoints[0].y); - break; - - } - - - return (NS_OK); -} - - -nsresult nsCalTimebarContextController :: Init() -{ - return (nsCalContextController::Init()); -} - - -nsresult nsCalTimebarContextController :: GetTrianglePoints(nsPoint * pts) -{ - nsRect rect; - PRUint32 widthPart, widthHalf; - PRUint32 heightPart, heightHalf; - - GetBounds(rect); - - widthPart = (PRUint32)(((float)rect.width) * 0.2f); - heightPart = (PRUint32)(((float)rect.height) * 0.2f); - widthHalf = (PRUint32)(((float)rect.width) * 0.5f); - heightHalf = (PRUint32)(((float)rect.height) * 0.5f); - - switch(GetOrientation()) - { - case nsContextControllerOrientation_east: - - pts[0].x = rect.x + widthPart; - pts[0].y = rect.y + heightPart; - - pts[1].x = rect.x + rect.width - widthPart; - pts[1].y = rect.y + heightHalf; - - pts[2].x = rect.x + widthPart; - pts[2].y = rect.y + rect.height - heightPart; - - break; - - case nsContextControllerOrientation_west: - - pts[0].x = rect.x + rect.width - widthPart; - pts[0].y = rect.y + heightPart; - - pts[1].x = rect.x + widthPart; - pts[1].y = rect.y + heightHalf; - - pts[2].x = rect.x + rect.width - widthPart; - pts[2].y = rect.y + rect.height - heightPart; - - break; - - case nsContextControllerOrientation_north: - - pts[0].x = rect.x + widthPart; - pts[0].y = rect.y + rect.height - heightPart; - - pts[1].x = rect.x + widthHalf; - pts[1].y = rect.y + heightPart; - - pts[2].x = rect.x + rect.width - widthPart; - pts[2].y = rect.y + rect.height - heightPart; - - break; - - case nsContextControllerOrientation_south: - - pts[0].x = rect.x + widthPart; - pts[0].y = rect.y + heightPart; - - pts[1].x = rect.x + widthHalf; - pts[1].y = rect.y + rect.height - heightPart; - - pts[2].x = rect.x + rect.width - widthPart; - pts[2].y = rect.y + heightPart; - - break; - - } - - return NS_OK; - -} - -/* - * Need to implement point in triangle intersection - */ - -PRBool nsCalTimebarContextController::IsPointInTriangle(nsPoint aPoint, nsPoint * aTrinagle) -{ - - return PR_TRUE; -} - -/* - * If the user clicked on the foreground drawing area for the context controller, - * notify the relevant context[s] - */ -nsEventStatus nsCalTimebarContextController::OnLeftButtonDown(nsGUIEvent *aEvent) -{ - nsPoint pts[3]; - nsRect rect; - GetBounds(rect); - - GetTrianglePoints(pts); - - if (IsPointInTriangle(aEvent->point, pts) == PR_TRUE) { - - /* - * Notify the Observers of the appropriate Command - * - */ - - nsCalDurationCommand * command; - - nsresult res = nsRepository::CreateInstance(kCalDurationCommandCID, - nsnull, - kXPFCCommandIID, - (void **)&command); - - if (NS_OK != res) - return nsEventStatus_eConsumeNoDefault ; - - command->Init(GetDuration()); - - command->SetPeriodFormat(GetPeriodFormat()); - - Notify(command); - - NS_IF_RELEASE(command); - - } - - return nsEventStatus_eConsumeNoDefault; -} - -nsresult nsCalTimebarContextController :: SetParameter(nsString& aKey, nsString& aValue) -{ - return (nsCalContextController::SetParameter(aKey, aValue)); -} - -nsresult nsCalTimebarContextController :: GetClassPreferredSize(nsSize& aSize) -{ - aSize.width = DEFAULT_WIDTH; - aSize.height = DEFAULT_HEIGHT; - return (NS_OK); -} diff --git a/mozilla/calendar/modules/ui/core/Makefile b/mozilla/calendar/modules/ui/core/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/core/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/core/inc/Makefile b/mozilla/calendar/modules/ui/core/inc/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/core/inc/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/core/inc/manifest.mn b/mozilla/calendar/modules/ui/core/inc/manifest.mn deleted file mode 100644 index 8d061c15dc8..00000000000 --- a/mozilla/calendar/modules/ui/core/inc/manifest.mn +++ /dev/null @@ -1,23 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - nsCalUICIID.h \ - nsCalPeriodFormat.h \ - nscalstrings.h \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/core/inc/nsCalPeriodFormat.h b/mozilla/calendar/modules/ui/core/inc/nsCalPeriodFormat.h deleted file mode 100644 index 12ae747750e..00000000000 --- a/mozilla/calendar/modules/ui/core/inc/nsCalPeriodFormat.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalPeriodFormat_h___ -#define nsCalPeriodFormat_h___ - -typedef enum { - nsCalPeriodFormat_kYear, - nsCalPeriodFormat_kMonth, - nsCalPeriodFormat_kDay, - nsCalPeriodFormat_kHour, - nsCalPeriodFormat_kMinute, - nsCalPeriodFormat_kSecond, - nsCalPeriodFormat_kMinutesInDay -} nsCalPeriodFormat; - -#endif - - - diff --git a/mozilla/calendar/modules/ui/core/inc/nsCalUICIID.h b/mozilla/calendar/modules/ui/core/inc/nsCalUICIID.h deleted file mode 100644 index 9e1e2532400..00000000000 --- a/mozilla/calendar/modules/ui/core/inc/nsCalUICIID.h +++ /dev/null @@ -1,155 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef nsCalUICIID_h__ -#define nsCalUICIID_h__ - -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsRepository.h" - -//29bd8f10-e9e6-11d1-9244-00805f8a7ab6 -#define NS_CAL_CONTEXT_CONTROLLER_CID \ -{ 0x29bd8f10, 0xe9e6, 0x11d1, \ -{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//36658790-2032-11d2-9246-00805f8a7ab6 -#define NS_CAL_TIMEBAR_CONTEXT_CONTROLLER_CID \ -{ 0x36658790, 0x2032, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//07fdbd10-21bb-11d2-9246-00805f8a7ab6 -#define NS_CAL_MONTH_CONTEXT_CONTROLLER_CID \ -{ 0x07fdbd10, 0x21bb, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//b0d4fa90-e9e6-11d1-9244-00805f8a7ab6 -#define NS_CAL_TIME_CONTEXT_CID \ -{ 0xb0d4fa90, 0xe9e6, 0x11d1, \ -{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//7013faa0-1f39-11d2-bed9-00805f8a8dbd -#define NS_CAL_COMPONENT_CID \ -{ 0x7013faa0, 0x1f39, 0x11d2, \ -{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -//8bf4b740-200d-11d2-9246-00805f8a7ab6 -#define NS_CAL_TOOLKIT_CID \ -{ 0x8bf4b740, 0x200d, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//757fbd20-2039-11d2-9246-00805f8a7ab6 -#define NS_CAL_DURATION_COMMAND_CID \ -{ 0x757fbd20, 0x2039, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//489a6750-224d-11d2-9246-00805f8a7ab6 -#define NS_CAL_DAYLIST_COMMAND_CID \ -{ 0x489a6750, 0x224d, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//bf65e6f0-62de-11d2-bee8-00805f8a8dbd -#define NS_CAL_FETCHEVENTS_COMMAND_CID \ -{ 0xbf65e6f0, 0x62de, 0x11d2, \ -{ 0xbe, 0xe8, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -//fd9f9c80-56ed-11d2-bee6-00805f8a8dbd -#define NS_CAL_NEWMODEL_COMMAND_CID \ -{ 0xfd9f9c80, 0x56ed, 0x11d2, \ -{ 0xbe, 0xe6, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -//6e645390-edba-11d1-bec6-00805f8a8dbd -#define NS_CAL_TIMEBARCANVAS_CID \ -{ 0x6e645390, 0xedba, 0x11d1, \ -{ 0xbe, 0xc6, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -//11faca40-4cd5-11d2-924a-00805f8a7ab6 -#define NS_CAL_CANVAS_CID \ -{ 0x11faca40, 0x4cd5, 0x11d2, \ -{ 0x92, 0x4a, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//025d7730-edbc-11d1-bec6-00805f8a8dbd -#define NS_CAL_TIMEBARCOMPONENTCANVAS_CID \ -{ 0x025d7730, 0xedbc, 0x11d1, \ -{ 0xbe, 0xc6, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -//65620940-1b64-11d2-9246-00805f8a7ab6 -#define NS_CAL_TODOCOMPONENTCANVAS_CID \ -{ 0x65620940, 0x1b64, 0x11d2, \ -{ 0x92, 0x64, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//d6da5f20-1b61-11d2-9246-00805f8a7ab6 -#define NS_CAL_TIMEBARHEADING_CID \ -{ 0xd6da5f20, 0x1b61, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//994b4280-1db7-11d2-bed9-00805f8a8dbd -#define NS_CAL_TIMEBARUSERHEADING_CID \ -{ 0x994b4280, 0x1db7, 0x11d2, \ -{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -//560bd2a0-1db6-11d2-bed9-00805f8a8dbd -#define NS_CAL_TIMEBARTIMEHEADING_CID \ -{ 0x560bd2a0, 0x1db6, 0x11d2, \ -{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -//940fda80-1b66-11d2-9246-00805f8a7ab6 -#define NS_CAL_TIMEBARSCALE_CID \ -{ 0x940fda80, 0x1b66, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//5b6775e0-1c39-11d2-9246-00805f8a7ab6 -#define NS_CAL_MULTIDAYVIEWCANVAS_CID \ -{ 0x5b6775e0, 0x1c39, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//a60db790-5c85-11d2-924c-00805f8a7ab6 -#define NS_CAL_MULTIUSERVIEWCANVAS_CID \ -{ 0xa60db790, 0x5c85, 0x11d2, \ -{ 0x92, 0x4c, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//0a402270-5c87-11d2-924c-00805f8a7ab6 -#define NS_CAL_MULTIVIEWCANVAS_CID \ -{ 0x0a402270, 0x5c87, 0x11d2, \ -{ 0x92, 0x4c, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//879f3230-1da4-11d2-bed9-00805f8a8dbd -#define NS_CAL_DAYVIEWCANVAS_CID \ -{ 0x879f3230, 0x1da4, 0x11d2, \ -{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -//9a9e2030-57dc-11d2-bee6-00805f8a8dbd -#define NS_CAL_MONTHVIEWCANVAS_CID \ -{ 0x9a9e2030, 0x57dc, 0x11d2, \ -{ 0xbe, 0xe6, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } } - -//f5b41150-218e-11d2-9246-00805f8a7ab6 -#define NS_CAL_STATUSCANVAS_CID \ -{ 0xf5b41150, 0x218e, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -//107f9a00-218f-11d2-9246-00805f8a7ab6 -#define NS_CAL_COMMANDCANVAS_CID \ -{ 0x107f9a00, 0x218f, 0x11d2, \ -{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } - -#endif diff --git a/mozilla/calendar/modules/ui/core/inc/nscalstrings.h b/mozilla/calendar/modules/ui/core/inc/nscalstrings.h deleted file mode 100644 index f8a6698937a..00000000000 --- a/mozilla/calendar/modules/ui/core/inc/nscalstrings.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#ifndef NS_CALSTRINGS__ -#define NS_CALSTRINGS__ - -#define CAL_STRING_BACKGROUNDCOLOR "backgroundcolor" -#define CAL_STRING_CLASS "class" -#define CAL_STRING_CONTROL "control" -#define CAL_STRING_DAY "day" -#define CAL_STRING_DEFAULTUSERNAME "A Default UserName" -#define CAL_STRING_CONTAINER "container" -#define CAL_STRING_COUNT "count" -#define CAL_STRING_CTX "ctx" -#define CAL_STRING_DAY "day" -#define CAL_STRING_EAST "east" -#define CAL_STRING_DEFAULT "default" -#define CAL_STRING_FOREGROUNDCOLOR "foregroundcolor" -#define CAL_STRING_HEIGHT "height" -#define CAL_STRING_HOUR "hour" -#define CAL_STRING_PREF_JULIAN_UI_XML_MENUBAR "julian.ui.xml.menubar" -#define CAL_STRING_PREF_JULIAN_UI_XML_TOOLBAR "julian.ui.xml.toolbar" -#define CAL_STRING_PREF_JULIAN_UI_XML_CALENDAR "julian.ui.xml.calendar" -#define CAL_STRING_ID "id" -#define CAL_STRING_LABEL "label" -#define CAL_STRING_LAYOUT "layout" -#define CAL_STRING_MAXREPEAT "maxrepeat" -#define CAL_STRING_MINREPEAT "minrepeat" -#define CAL_STRING_MINUTE "minute" -#define CAL_STRING_MONTH "month" -#define CAL_STRING_NAME "name" -#define CAL_STRING_NORTH "north" -#define CAL_STRING_NORTHWEST "northwest" -#define CAL_STRING_ORIENTATION "orientation" -#define CAL_STRING_PANEL "panel" -#define CAL_STRING_RESOURCE_UI_MENUBAR "resource://res/ui/menubar.ui" -#define CAL_STRING_RESOURCE_UI_TOOLBAR "resource://res/ui/toolbar.ui" -#define CAL_STRING_RESOURCE_UI_CALENDAR "resource://res/ui/trex.ui" -#define CAL_STRING_RULE "rule" -#define CAL_STRING_SECOND "second" -#define CAL_STRING_SETBACKGROUNDCOLOR "setbackgroundcolor" -#define CAL_STRING_SOUTH "south" -#define CAL_STRING_SOUTHEAST "southeast" -#define CAL_STRING_TIMEBAR_USER_HEADING "timebaruserheading" -#define CAL_STRING_TITLE "title" -#define CAL_STRING_TYPE "type" -#define CAL_STRING_USECTXRULE "usectxrule" -#define CAL_STRING_USEPREFERREDSIZE "usepreferredsize" -#define CAL_STRING_WEIGHTMAJOR "weightmajor" -#define CAL_STRING_WEIGHTMINOR "weightminor" -#define CAL_STRING_WEST "west" -#define CAL_STRING_WIDTH "width" -#define CAL_STRING_XBOX "xbox" -#define CAL_STRING_YBOX "ybox" -#define CAL_STRING_YEAR "year" - -#define CAL_STRING_PREF_LOCAL_ADDRESS "cal.localCalAddress" -#define CAL_STRING_PREF_LOCAL_ADDRESS_DEFAULT "file://localhost/$USERPROFILE/cal/$USERNAME" -#define CAL_STRING_PREF_PREFERRED_ADDR "cal.preferredCalAddress" -#define CAL_STRING_PREF_PREFERRED_ADDR_DEFAULT CAL_STRING_PREF_LOCAL_ADDRESS_DEFAULT -#define CAL_STRING_PREF_USERNAME "cal.username" -#define CAL_STRING_PREF_USERNAME_DEFAULT "$USERNAME" -#define CAL_STRING_PREF_USER_DISPLAY_NAME "cal.userDisplayName" -#define CAL_STRING_PREF_USER_DISPLAY_NAME_DEFAULT "$USERNAME" - -#define CAL_STRING_CMD_MCC "mcc" - -#endif - - diff --git a/mozilla/calendar/modules/ui/core/manifest.mn b/mozilla/calendar/modules/ui/core/manifest.mn deleted file mode 100644 index ce741a53d39..00000000000 --- a/mozilla/calendar/modules/ui/core/manifest.mn +++ /dev/null @@ -1,15 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. -DEPTH = ../../../.. - -DIRS_EXPORT = public inc -DIRS_LIBS = src - diff --git a/mozilla/calendar/modules/ui/core/public/Makefile b/mozilla/calendar/modules/ui/core/public/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/core/public/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/core/public/manifest.mn b/mozilla/calendar/modules/ui/core/public/manifest.mn deleted file mode 100644 index 81084277208..00000000000 --- a/mozilla/calendar/modules/ui/core/public/manifest.mn +++ /dev/null @@ -1,21 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. -DEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = raptor diff --git a/mozilla/calendar/modules/ui/core/src/Makefile b/mozilla/calendar/modules/ui/core/src/Makefile deleted file mode 100644 index 60df328e33a..00000000000 --- a/mozilla/calendar/modules/ui/core/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - -include config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/ruleset.mk -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/core/src/config.mk b/mozilla/calendar/modules/ui/core/src/config.mk deleted file mode 100644 index 817ecc45be3..00000000000 --- a/mozilla/calendar/modules/ui/core/src/config.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -# -# Override TARGETS variable so that only static libraries -# are specifed as dependencies within rules.mk. -# - -CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20 -INCLUDES += -I../inc -I$(GDEPTH)/include - -LIBRARY_NAME = core -LIBRARY_VERSION = 10 - -ARCHIVE_ONLY = 1 - -TARGETS = $(LIBRARY) - diff --git a/mozilla/calendar/modules/ui/core/src/manifest.mn b/mozilla/calendar/modules/ui/core/src/manifest.mn deleted file mode 100644 index d63acdeba91..00000000000 --- a/mozilla/calendar/modules/ui/core/src/manifest.mn +++ /dev/null @@ -1,25 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -CPPSRCS = \ - nsCalFactory.cpp \ - $(NULL) - -REQUIRES = shell xpcom raptor trex julian nls xpfc - diff --git a/mozilla/calendar/modules/ui/core/src/nsCalFactory.cpp b/mozilla/calendar/modules/ui/core/src/nsCalFactory.cpp deleted file mode 100644 index f8d564b0913..00000000000 --- a/mozilla/calendar/modules/ui/core/src/nsCalFactory.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* -*- 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.1 (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.org 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. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsIFactory.h" -#include "nsISupports.h" -#include "nsCalUICIID.h" - -#include "nsCalTimeContext.h" -#include "nsCalComponent.h" -#include "nsCalDurationCommand.h" -#include "nsCalDayListCommand.h" -#include "nsCalFetchEventsCommand.h" -#include "nsCalNewModelCommand.h" -#include "nsCalContextController.h" -#include "nsCalTimebarContextController.h" -#include "nsCalMonthContextController.h" - -#include "nsCalTimebarCanvas.h" -#include "nsCalStatusCanvas.h" -#include "nsCalCommandCanvas.h" -#include "nsCalTimebarComponentCanvas.h" -#include "nsCalTimebarHeading.h" -#include "nsCalTimebarUserHeading.h" -#include "nsCalTimebarTimeHeading.h" -#include "nsCalTimebarScale.h" -#include "nsCalMultiDayViewCanvas.h" -#include "nsCalMultiUserViewCanvas.h" -#include "nsCalDayViewCanvas.h" -#include "nsCalMonthViewCanvas.h" -#include "nsCalTodoComponentCanvas.h" - -#include "nsCalToolkit.h" - -static NS_DEFINE_IID(kCCalTimeContext, NS_CAL_TIME_CONTEXT_CID); -static NS_DEFINE_IID(kCCalComponent, NS_CAL_COMPONENT_CID); -static NS_DEFINE_IID(kCCalDurationCommand, NS_CAL_DURATION_COMMAND_CID); -static NS_DEFINE_IID(kCCalDayListCommand, NS_CAL_DAYLIST_COMMAND_CID); -static NS_DEFINE_IID(kCCalFetchEventsCommand, NS_CAL_FETCHEVENTS_COMMAND_CID); -static NS_DEFINE_IID(kCCalNewModelCommand, NS_CAL_NEWMODEL_COMMAND_CID); -static NS_DEFINE_IID(kCCalContextController, NS_CAL_CONTEXT_CONTROLLER_CID); -static NS_DEFINE_IID(kCCalTimebarContextController, NS_CAL_TIMEBAR_CONTEXT_CONTROLLER_CID); -static NS_DEFINE_IID(kCCalMonthContextController, NS_CAL_MONTH_CONTEXT_CONTROLLER_CID); - -static NS_DEFINE_IID(kICalTimeContext, NS_ICAL_TIME_CONTEXT_IID); -static NS_DEFINE_IID(kICalContextController, NS_ICAL_CONTEXT_CONTROLLER_IID); - -static NS_DEFINE_IID(kCCalTimebarCanvas, NS_CAL_TIMEBARCANVAS_CID); -static NS_DEFINE_IID(kCCalCanvas, NS_CAL_CANVAS_CID); -static NS_DEFINE_IID(kCCalStatusCanvas, NS_CAL_STATUSCANVAS_CID); -static NS_DEFINE_IID(kCCalCommandCanvas, NS_CAL_COMMANDCANVAS_CID); -static NS_DEFINE_IID(kCCalTimebarComponentCanvas, NS_CAL_TIMEBARCOMPONENTCANVAS_CID); -static NS_DEFINE_IID(kCCalMultiDayViewCanvas, NS_CAL_MULTIDAYVIEWCANVAS_CID); -static NS_DEFINE_IID(kCCalMultiUserViewCanvas, NS_CAL_MULTIUSERVIEWCANVAS_CID); -static NS_DEFINE_IID(kCCalDayViewCanvas, NS_CAL_DAYVIEWCANVAS_CID); -static NS_DEFINE_IID(kCCalMonthViewCanvas, NS_CAL_MONTHVIEWCANVAS_CID); -static NS_DEFINE_IID(kCCalTodoComponentCanvas, NS_CAL_TODOCOMPONENTCANVAS_CID); -static NS_DEFINE_IID(kCCalTimebarHeading, NS_CAL_TIMEBARHEADING_CID); -static NS_DEFINE_IID(kCCalTimebarUserHeading, NS_CAL_TIMEBARUSERHEADING_CID); -static NS_DEFINE_IID(kCCalTimebarTimeHeading, NS_CAL_TIMEBARTIMEHEADING_CID); -static NS_DEFINE_IID(kCCalTimebarScale, NS_CAL_TIMEBARSCALE_CID); - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); - -static NS_DEFINE_IID(kCCalToolkit, NS_CAL_TOOLKIT_CID); - -class nsCalFactory : public nsIFactory -{ - public: - // nsISupports methods - NS_IMETHOD QueryInterface(const nsIID &aIID, - void **aResult); - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - // nsIFactory methods - NS_IMETHOD CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult); - - NS_IMETHOD LockFactory(PRBool aLock); - - nsCalFactory(const nsCID &aClass); - ~nsCalFactory(); - - private: - nsrefcnt mRefCnt; - nsCID mClassID; -}; - -nsCalFactory::nsCalFactory(const nsCID &aClass) -{ - mRefCnt = 0; - mClassID = aClass; -} - -nsCalFactory::~nsCalFactory() -{ - NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); -} - -nsresult nsCalFactory::QueryInterface(const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - // Always NULL result, in case of failure - *aResult = NULL; - - 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; -} - -nsrefcnt nsCalFactory::AddRef() -{ - return ++mRefCnt; -} - -nsrefcnt nsCalFactory::Release() -{ - if (--mRefCnt == 0) { - delete this; - return 0; // Don't access mRefCnt after deleting! - } - return mRefCnt; -} - -nsresult nsCalFactory::CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult) -{ - if (aResult == NULL) { - return NS_ERROR_NULL_POINTER; - } - - *aResult = NULL; - - nsISupports *inst = nsnull; - - if (mClassID.Equals(kCCalTimeContext)) { - inst = (nsISupports *)(nsICalTimeContext *)new nsCalTimeContext(); -#if 0 - nsICalTimeContext * cc = (nsICalTimeContext *)new nsCalTimeContext(); - cc->QueryInterface(kISupportsIID,(void **)&inst); -#endif - } - else if (mClassID.Equals(kCCalComponent)) { - inst = (nsISupports *)new nsCalComponent(); - } - else if (mClassID.Equals(kCCalDurationCommand)) { - inst = (nsISupports *)new nsCalDurationCommand(); - } - else if (mClassID.Equals(kCCalDayListCommand)) { - inst = (nsISupports *)new nsCalDayListCommand(); - } - else if (mClassID.Equals(kCCalFetchEventsCommand)) { - inst = (nsISupports *)new nsCalFetchEventsCommand(); - } - else if (mClassID.Equals(kCCalNewModelCommand)) { - inst = (nsISupports *)new nsCalNewModelCommand(); - } - else if (mClassID.Equals(kCCalContextController)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalContextController(aOuter); - } - else if (mClassID.Equals(kCCalTimebarContextController)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalTimebarContextController(aOuter); - } - else if (mClassID.Equals(kCCalMonthContextController)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalMonthContextController(aOuter); - } - else if (mClassID.Equals(kCCalTimebarCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalTimebarCanvas(aOuter); - } - else if (mClassID.Equals(kCCalCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalCanvas(aOuter); - } - else if (mClassID.Equals(kCCalStatusCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalStatusCanvas(aOuter); - } - else if (mClassID.Equals(kCCalCommandCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalCommandCanvas(aOuter); - } - else if (mClassID.Equals(kCCalTimebarComponentCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalTimebarComponentCanvas(aOuter); - } - else if (mClassID.Equals(kCCalTodoComponentCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalTodoComponentCanvas(aOuter); - } - else if (mClassID.Equals(kCCalTimebarHeading)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalTimebarHeading(aOuter); - } - else if (mClassID.Equals(kCCalTimebarUserHeading)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalTimebarUserHeading(aOuter); - } - else if (mClassID.Equals(kCCalTimebarTimeHeading)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalTimebarTimeHeading(aOuter); - } - else if (mClassID.Equals(kCCalTimebarScale)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalTimebarScale(aOuter); - } - else if (mClassID.Equals(kCCalMultiDayViewCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalMultiDayViewCanvas(aOuter); - } - else if (mClassID.Equals(kCCalMultiUserViewCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalMultiUserViewCanvas(aOuter); - } - else if (mClassID.Equals(kCCalDayViewCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalDayViewCanvas(aOuter); - } - else if (mClassID.Equals(kCCalMonthViewCanvas)) { - inst = (nsISupports *)(nsIXPFCCanvas *)new nsCalMonthViewCanvas(aOuter); - } - else if (mClassID.Equals(kCCalToolkit)) { - inst = (nsISupports *)(nsICalToolkit *)new nsCalToolkit(); - } - - if (inst == NULL) { - return NS_ERROR_OUT_OF_MEMORY; - } - -/* For Agg in Canvas? - if (nsnull != aOuter) { - result = &it->fAggregated; - } else { - result = (nsIProtocolConnection *)it; - } - -*/ - nsresult res = inst->QueryInterface(aIID, aResult); - - if (res != NS_OK) { - // We didn't get the right interface, so clean up - delete inst; - } - - return res; -} - -nsresult nsCalFactory::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; - } - - *aFactory = new nsCalFactory(aClass); - - if (nsnull == aFactory) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); -} - diff --git a/mozilla/calendar/modules/ui/manifest.mn b/mozilla/calendar/modules/ui/manifest.mn deleted file mode 100644 index 9d0fb9b923b..00000000000 --- a/mozilla/calendar/modules/ui/manifest.mn +++ /dev/null @@ -1,26 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../.. -DEPTH = ../../.. - -DIRS = core canvas context controller component command toolkit -DIRS_LIBS = res - -LIBRARY_NAME = calui - -EXPORTS = \ - $(NULL) - -PRIVATE_EXPORTS = \ - $(NULL) - -MODULE = trex - -REQUIRES = xpcom raptor shell trex diff --git a/mozilla/calendar/modules/ui/res/Makefile b/mozilla/calendar/modules/ui/res/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/res/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/res/calui/Makefile b/mozilla/calendar/modules/ui/res/calui/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian.cal b/mozilla/calendar/modules/ui/res/calui/julian.cal deleted file mode 100644 index e06c30a7dac..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian.cal +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian_cal_html.cal b/mozilla/calendar/modules/ui/res/calui/julian_cal_html.cal deleted file mode 100644 index 06df96bbab2..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian_cal_html.cal +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ---> - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian_day.cal b/mozilla/calendar/modules/ui/res/calui/julian_day.cal deleted file mode 100644 index 84993422dec..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian_day.cal +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian_folders.cal b/mozilla/calendar/modules/ui/res/calui/julian_folders.cal deleted file mode 100644 index 445e4578976..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian_folders.cal +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ---> - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian_html.cal b/mozilla/calendar/modules/ui/res/calui/julian_html.cal deleted file mode 100644 index b8fac1351d3..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian_html.cal +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian_html_blank.cal b/mozilla/calendar/modules/ui/res/calui/julian_html_blank.cal deleted file mode 100644 index ec1db1b90c0..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian_html_blank.cal +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian_month.cal b/mozilla/calendar/modules/ui/res/calui/julian_month.cal deleted file mode 100644 index 155ace90d7a..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian_month.cal +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian_month_sum.cal b/mozilla/calendar/modules/ui/res/calui/julian_month_sum.cal deleted file mode 100644 index 907a956eea8..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian_month_sum.cal +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian_multi_user.cal b/mozilla/calendar/modules/ui/res/calui/julian_multi_user.cal deleted file mode 100644 index 95317122869..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian_multi_user.cal +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julian_week.cal b/mozilla/calendar/modules/ui/res/calui/julian_week.cal deleted file mode 100644 index 67acce9d069..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julian_week.cal +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/julianht.cal b/mozilla/calendar/modules/ui/res/calui/julianht.cal deleted file mode 100644 index 213871d4693..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/julianht.cal +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ---> - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/calui/manifest.mn b/mozilla/calendar/modules/ui/res/calui/manifest.mn deleted file mode 100644 index be326db295d..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/manifest.mn +++ /dev/null @@ -1,28 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -GDEPTH = ../../../../.. - -MODULE = trex - -REQUIRES = raptor - -libs:: - $(INSTALL) julian.cal $(DIST)/bin/res/ui - $(INSTALL) julian_folders.cal $(DIST)/bin/res/ui - $(INSTALL) julianht.cal $(DIST)/bin/res/ui - $(INSTALL) julian_day.cal $(DIST)/bin/res/ui - $(INSTALL) julian_week.cal $(DIST)/bin/res/ui - $(INSTALL) julian_multi_user.cal $(DIST)/bin/res/ui - $(INSTALL) julian_month.cal $(DIST)/bin/res/ui - $(INSTALL) julian_month_sum.cal $(DIST)/bin/res/ui - $(INSTALL) julian_html.cal $(DIST)/bin/res/ui - $(INSTALL) julian_html_blank.cal $(DIST)/bin/res/ui - $(INSTALL) test.cal $(DIST)/bin/res/ui diff --git a/mozilla/calendar/modules/ui/res/calui/test.cal b/mozilla/calendar/modules/ui/res/calui/test.cal deleted file mode 100644 index 97ae9e992c7..00000000000 --- a/mozilla/calendar/modules/ui/res/calui/test.cal +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/compose_event.ui b/mozilla/calendar/modules/ui/res/compose_event.ui deleted file mode 100644 index 64aa5b4d816..00000000000 --- a/mozilla/calendar/modules/ui/res/compose_event.ui +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/demo/Makefile b/mozilla/calendar/modules/ui/res/demo/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/res/demo/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/res/demo/julian1.cal b/mozilla/calendar/modules/ui/res/demo/julian1.cal deleted file mode 100644 index 75a9cfba535..00000000000 --- a/mozilla/calendar/modules/ui/res/demo/julian1.cal +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/demo/julian2.cal b/mozilla/calendar/modules/ui/res/demo/julian2.cal deleted file mode 100644 index 2182e0cc88a..00000000000 --- a/mozilla/calendar/modules/ui/res/demo/julian2.cal +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/demo/julian3.cal b/mozilla/calendar/modules/ui/res/demo/julian3.cal deleted file mode 100644 index 3eb8a8ce409..00000000000 --- a/mozilla/calendar/modules/ui/res/demo/julian3.cal +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/demo/julian4.cal b/mozilla/calendar/modules/ui/res/demo/julian4.cal deleted file mode 100644 index 58ce767699a..00000000000 --- a/mozilla/calendar/modules/ui/res/demo/julian4.cal +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/demo/manifest.mn b/mozilla/calendar/modules/ui/res/demo/manifest.mn deleted file mode 100644 index fd182af2665..00000000000 --- a/mozilla/calendar/modules/ui/res/demo/manifest.mn +++ /dev/null @@ -1,23 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -MODULE = trex - -REQUIRES = raptor - -libs:: - $(INSTALL) trex1.ui $(DIST)/bin/res/ui/demo - $(INSTALL) trex2.ui $(DIST)/bin/res/ui/demo - $(INSTALL) trex3.ui $(DIST)/bin/res/ui/demo - $(INSTALL) julian1.cal $(DIST)/bin/res/ui/demo - $(INSTALL) julian2.cal $(DIST)/bin/res/ui/demo - $(INSTALL) julian3.cal $(DIST)/bin/res/ui/demo - $(INSTALL) julian4.cal $(DIST)/bin/res/ui/demo diff --git a/mozilla/calendar/modules/ui/res/demo/trex1.ui b/mozilla/calendar/modules/ui/res/demo/trex1.ui deleted file mode 100644 index 98884e3b677..00000000000 --- a/mozilla/calendar/modules/ui/res/demo/trex1.ui +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/demo/trex2.ui b/mozilla/calendar/modules/ui/res/demo/trex2.ui deleted file mode 100644 index 517bc6a23b3..00000000000 --- a/mozilla/calendar/modules/ui/res/demo/trex2.ui +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/demo/trex3.ui b/mozilla/calendar/modules/ui/res/demo/trex3.ui deleted file mode 100644 index 954aea75f9f..00000000000 --- a/mozilla/calendar/modules/ui/res/demo/trex3.ui +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/images/Makefile b/mozilla/calendar/modules/ui/res/images/Makefile deleted file mode 100644 index 61267ebf415..00000000000 --- a/mozilla/calendar/modules/ui/res/images/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -#! gmake -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# - -####################################################################### -# (1) Include initial platform-independent assignments (MANDATORY). # -####################################################################### - -include manifest.mn - -####################################################################### -# (2) Include "global" configuration information. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/config.mk - -####################################################################### -# (3) Include "component" configuration information. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (4) Include "local" platform-dependent assignments (OPTIONAL). # -####################################################################### - - - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(GDEPTH)/gconfig/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - - - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - - diff --git a/mozilla/calendar/modules/ui/res/images/addrbook_full.gif b/mozilla/calendar/modules/ui/res/images/addrbook_full.gif deleted file mode 100644 index 6d28fab2eb3..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/addrbook_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/agenda_full.gif b/mozilla/calendar/modules/ui/res/images/agenda_full.gif deleted file mode 100644 index ad6dc6ff2cf..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/agenda_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/agenda_hover_full.gif b/mozilla/calendar/modules/ui/res/images/agenda_hover_full.gif deleted file mode 100644 index 62e76909ba4..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/agenda_hover_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/agenda_mini.gif b/mozilla/calendar/modules/ui/res/images/agenda_mini.gif deleted file mode 100644 index a002b5cffd8..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/agenda_mini.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/agenda_pressed_full.gif b/mozilla/calendar/modules/ui/res/images/agenda_pressed_full.gif deleted file mode 100644 index 8920e7a1b89..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/agenda_pressed_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/browser_full.gif b/mozilla/calendar/modules/ui/res/images/browser_full.gif deleted file mode 100644 index f0a1c42a329..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/browser_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/day_full.gif b/mozilla/calendar/modules/ui/res/images/day_full.gif deleted file mode 100644 index 167c93d72ce..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/day_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/day_hover_full.gif b/mozilla/calendar/modules/ui/res/images/day_hover_full.gif deleted file mode 100644 index 70eb06d61ed..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/day_hover_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/day_pressed_full.gif b/mozilla/calendar/modules/ui/res/images/day_pressed_full.gif deleted file mode 100644 index 233fefa2e89..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/day_pressed_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/image.jpg b/mozilla/calendar/modules/ui/res/images/image.jpg deleted file mode 100644 index 18826b6b40e..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/image.jpg and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/inbox_full.gif b/mozilla/calendar/modules/ui/res/images/inbox_full.gif deleted file mode 100644 index 523d18d461e..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/inbox_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/intray_full.gif b/mozilla/calendar/modules/ui/res/images/intray_full.gif deleted file mode 100644 index eca9d739ebb..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/intray_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/intray_hover_full.gif b/mozilla/calendar/modules/ui/res/images/intray_hover_full.gif deleted file mode 100644 index 716b1bc87e0..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/intray_hover_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/intray_pressed_full.gif b/mozilla/calendar/modules/ui/res/images/intray_pressed_full.gif deleted file mode 100644 index 2a19b09c1d4..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/intray_pressed_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/mail_full.gif b/mozilla/calendar/modules/ui/res/images/mail_full.gif deleted file mode 100644 index 41a9434627d..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/mail_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/manifest.mn b/mozilla/calendar/modules/ui/res/images/manifest.mn deleted file mode 100644 index 9788eaa1fcd..00000000000 --- a/mozilla/calendar/modules/ui/res/images/manifest.mn +++ /dev/null @@ -1,56 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../../.. - -DIRS_LIBS = demo - -MODULE = trex - -REQUIRES = raptor - -libs:: - $(INSTALL) image.jpg $(DIST)/bin/res/ui/images - $(INSTALL) agenda_mini.gif $(DIST)/bin/res/ui/images - $(INSTALL) agenda_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) agenda_pressed_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) agenda_hover_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) intray_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) intray_pressed_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) intray_hover_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) tasks_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) tasks_hover_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) tasks_pressed_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) day_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) day_hover_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) day_pressed_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) week_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) week_hover_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) week_pressed_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) month_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) month_hover_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) month_pressed_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) newentry_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) newentry_hover_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) newentry_pressed_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) newtask_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) newtask_hover_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) newtask_pressed_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) print_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) print_hover_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) print_pressed_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) inbox_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) sent_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) outbox_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) trash_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) browser_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) mail_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) addrbook_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) portal_full.gif $(DIST)/bin/res/ui/images - $(INSTALL) trex_full.gif $(DIST)/bin/res/ui/images diff --git a/mozilla/calendar/modules/ui/res/images/month_full.gif b/mozilla/calendar/modules/ui/res/images/month_full.gif deleted file mode 100644 index 14b1f9739f8..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/month_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/month_hover_full.gif b/mozilla/calendar/modules/ui/res/images/month_hover_full.gif deleted file mode 100644 index 4ca9b880450..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/month_hover_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/month_pressed_full.gif b/mozilla/calendar/modules/ui/res/images/month_pressed_full.gif deleted file mode 100644 index fa6f6fcedfa..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/month_pressed_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/newentry_full.gif b/mozilla/calendar/modules/ui/res/images/newentry_full.gif deleted file mode 100644 index 9cf089618ef..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/newentry_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/newentry_hover_full.gif b/mozilla/calendar/modules/ui/res/images/newentry_hover_full.gif deleted file mode 100644 index 1826952f24e..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/newentry_hover_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/newentry_pressed_full.gif b/mozilla/calendar/modules/ui/res/images/newentry_pressed_full.gif deleted file mode 100644 index 3eb34152090..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/newentry_pressed_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/newtask_full.gif b/mozilla/calendar/modules/ui/res/images/newtask_full.gif deleted file mode 100644 index 6f762322d14..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/newtask_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/newtask_hover_full.gif b/mozilla/calendar/modules/ui/res/images/newtask_hover_full.gif deleted file mode 100644 index 9b7d7a1aacc..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/newtask_hover_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/newtask_pressed_full.gif b/mozilla/calendar/modules/ui/res/images/newtask_pressed_full.gif deleted file mode 100644 index d791f234bb9..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/newtask_pressed_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/outbox_full.gif b/mozilla/calendar/modules/ui/res/images/outbox_full.gif deleted file mode 100644 index 523d18d461e..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/outbox_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/portal_full.gif b/mozilla/calendar/modules/ui/res/images/portal_full.gif deleted file mode 100644 index 694b4ca9e21..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/portal_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/print_full.gif b/mozilla/calendar/modules/ui/res/images/print_full.gif deleted file mode 100644 index 5180e6087d0..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/print_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/print_hover_full.gif b/mozilla/calendar/modules/ui/res/images/print_hover_full.gif deleted file mode 100644 index ff1b7d5903c..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/print_hover_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/print_pressed_full.gif b/mozilla/calendar/modules/ui/res/images/print_pressed_full.gif deleted file mode 100644 index 3acf44ad225..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/print_pressed_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/sent_full.gif b/mozilla/calendar/modules/ui/res/images/sent_full.gif deleted file mode 100644 index 523d18d461e..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/sent_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/tasks_full.gif b/mozilla/calendar/modules/ui/res/images/tasks_full.gif deleted file mode 100644 index 48e756741fc..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/tasks_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/tasks_hover_full.gif b/mozilla/calendar/modules/ui/res/images/tasks_hover_full.gif deleted file mode 100644 index f599bd0023a..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/tasks_hover_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/tasks_pressed_full.gif b/mozilla/calendar/modules/ui/res/images/tasks_pressed_full.gif deleted file mode 100644 index 1cf9c510a15..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/tasks_pressed_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/trash_full.gif b/mozilla/calendar/modules/ui/res/images/trash_full.gif deleted file mode 100644 index a32dc13e2a9..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/trash_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/trex_full.gif b/mozilla/calendar/modules/ui/res/images/trex_full.gif deleted file mode 100644 index 2ea017cf348..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/trex_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/week_full.gif b/mozilla/calendar/modules/ui/res/images/week_full.gif deleted file mode 100644 index c94fa8dd186..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/week_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/week_hover_full.gif b/mozilla/calendar/modules/ui/res/images/week_hover_full.gif deleted file mode 100644 index 3a47d90d2f7..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/week_hover_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/images/week_pressed_full.gif b/mozilla/calendar/modules/ui/res/images/week_pressed_full.gif deleted file mode 100644 index 227a070abdd..00000000000 Binary files a/mozilla/calendar/modules/ui/res/images/week_pressed_full.gif and /dev/null differ diff --git a/mozilla/calendar/modules/ui/res/manifest.mn b/mozilla/calendar/modules/ui/res/manifest.mn deleted file mode 100644 index 03b83427757..00000000000 --- a/mozilla/calendar/modules/ui/res/manifest.mn +++ /dev/null @@ -1,23 +0,0 @@ -# -# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF -# NETSCAPE COMMUNICATIONS CORPORATION -# Copyright (C) 1996 Netscape Communications Corporation. All Rights -# Reserved. Use of this Source Code is subject to the terms of the -# applicable license agreement from Netscape Communications Corporation. -# The copyright notice(s) in this Source Code does not indicate actual or -# intended publication of this Source Code. -# -GDEPTH = ../../../.. - -DIRS_LIBS = demo images calui - -MODULE = trex - -REQUIRES = raptor - -libs:: - $(INSTALL) menubar.ui $(DIST)/bin/res/ui - $(INSTALL) toolbar.ui $(DIST)/bin/res/ui - $(INSTALL) test.ui $(DIST)/bin/res/ui - $(INSTALL) trex.ui $(DIST)/bin/res/ui - $(INSTALL) compose_event.ui $(DIST)/bin/res/ui diff --git a/mozilla/calendar/modules/ui/res/menubar.ui b/mozilla/calendar/modules/ui/res/menubar.ui deleted file mode 100644 index 49aa20c38a8..00000000000 --- a/mozilla/calendar/modules/ui/res/menubar.ui +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/test.ui b/mozilla/calendar/modules/ui/res/test.ui deleted file mode 100644 index cd3c8cf9604..00000000000 --- a/mozilla/calendar/modules/ui/res/test.ui +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/mozilla/calendar/modules/ui/res/toolbar.ui b/mozilla/calendar/modules/ui/res/toolbar.ui deleted file mode 100644 index e18874c3837..00000000000 --- a/mozilla/calendar/modules/ui/res/toolbar.ui +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -