diff --git a/mozilla/include/dirprefs.h b/mozilla/include/dirprefs.h index 3cd4eeeff8c..a2ad468b9c9 100644 --- a/mozilla/include/dirprefs.h +++ b/mozilla/include/dirprefs.h @@ -48,8 +48,36 @@ typedef enum custom5 } DIR_AttributeId; +typedef enum +{ + capLdapV3, /* LDAP v3.0 protocol */ + capVirtualListView, /* Virtual list view */ -typedef struct _DIR_ReplicationInfo DIR_ReplicationInfo; + kNumCaps /* must be last capability */ +} DIR_ServerCaps; + +/* The values in this enum control the kind of LDAP filter expression + * we send to the LDAP server to do name completion + */ +typedef enum +{ + acsGivenAndSurname, /* do auto-complete using givenname and sn attributes */ + acsCnForwards, /* do auto-complete assuming cn in F L order */ + acsCnBackwards /* do auto-complete assuming cn in L, F order */ +} DIR_AutoCompleteStyle; + + +typedef struct _DIR_ReplicationInfo +{ + char *description; /* human readable description of replica */ + char *fileName; /* file name of replication database */ + char *filter; /* LDAP filter string which constrains the repl search */ + int32 lastChangeNumber; /* Last change we saw -- start replicating here */ + char *dataVersion; /* LDAP server's scoping of the lastChangeNumber */ + /* this changes when the server's DB gets reloaded from LDIF */ + char **excludedAttributes; /* list of attributes we shouldn't replicate */ + int excludedAttributesCount; /* duh */ +} DIR_ReplicationInfo; typedef struct DIR_Server @@ -67,6 +95,7 @@ typedef struct DIR_Server char *lastSearchString; /* required if saving results */ DirectoryType dirType; uint32 flags; + uint32 refCount; /* Use count for server */ /* site-configurable attributes and filters */ XP_List *customFilters; @@ -96,28 +125,43 @@ typedef struct DIR_Server char *authDn; /* DN to give to authenticate as */ char *password; /* Password for the DN */ - /* replication fields */ + /* Ldap fields */ DIR_ReplicationInfo *replInfo; + char *searchPairList; + + /* auto-complete fields */ + DIR_AutoCompleteStyle autoCompleteStyle; } DIR_Server; XP_BEGIN_PROTOS -/* Return the list of directory servers - * each front end hangs on to the list - */ +/* We are developing a new model for managing DIR_Servers. In the 4.0x world, the FEs managed each list. + Calls to FE_GetDirServer caused the FEs to manage and return the DIR_Server list. In our new view of the + world, the back end does most of the list management so we are going to have the back end create and + manage the list. Replace calls to FE_GetDirServers() with DIR_GetDirServers(). */ + +XP_List * DIR_GetDirServers(void); +int DIR_ShutDown(void); /* FEs should call this when the app is shutting down. It frees all DIR_Servers regardless of ref count values! */ + +int DIR_DecrementServerRefCount (DIR_Server *); +int DIR_IncrementServerRefCount (DIR_Server *); + +/* We are trying to phase out use of FE_GetDirServers. The back end is now managing the dir server list. So you should + be calling DIR_GetDirServers instead. */ + XP_List * FE_GetDirServers(void); /* Since the strings in DIR_Server are allocated, we have bottleneck * routines to help with memory mgmt */ -int DIR_CopyServer (DIR_Server *in, DIR_Server **out); -int DIR_DeleteServer (DIR_Server *); int DIR_InitServer (DIR_Server *); - int DIR_ValidateServer (DIR_Server *); +int DIR_CopyServer (DIR_Server *in, DIR_Server **out); XP_Bool DIR_AreServersSame (DIR_Server *first, DIR_Server *second); + +int DIR_DeleteServer (DIR_Server *); int DIR_DeleteServerList(XP_List *wholeList); int DIR_GetLdapServers (XP_List *wholeList, XP_List *subList); @@ -139,14 +183,13 @@ int DIR_CleanUpServerPreferences(XP_List *deletedList); int DIR_GetPersonalAddressBook (XP_List *wholeList, DIR_Server **pab); int DIR_GetComposeNameCompletionAddressBook (XP_List *wholeList, DIR_Server **cab); -#else - /* Returns an allocated list of all personal address books, excluding * LDAP directories, replicated directories, and CABs */ -XP_List *DIR_GetPersonalAddressBooks (XP_List *wholeList); -XP_List *DIR_GetAddressBooksForCompletion (XP_List *wholeList); +int DIR_GetPersonalAddressBooks (XP_List *wholeList, XP_List * subList); +#else +XP_List *DIR_GetAddressBooksForCompletion (XP_List *wholeList); #endif void DIR_GetServerFileName(char** filename, const char* leafName); @@ -161,6 +204,7 @@ const char *DIR_GetAttributeName (DIR_Server *server, DIR_AttributeId id); const char **DIR_GetAttributeStrings (DIR_Server *server, DIR_AttributeId id); const char *DIR_GetFirstAttributeString (DIR_Server *server, DIR_AttributeId id); const char *DIR_GetFilterString (DIR_Server *server); +const char *DIR_GetReplicationFilter (DIR_Server *server); const char *DIR_GetTokenSeparators (DIR_Server *server); XP_Bool DIR_RepeatFilterForTokens (DIR_Server *server, const char *filter); XP_Bool DIR_SubstStarsForSpaces (DIR_Server *server, const char *filter); @@ -179,27 +223,26 @@ void DIR_SetPassword (DIR_Server *s, const char *password); char *DIR_Unescape (const char *src, XP_Bool makeHtml); XP_Bool DIR_IsEscapedAttribute (DIR_Server *s, const char *attrib); -/* APIs for replication */ -int DIR_ValidateRootDSE (DIR_Server *s, int32 gen, int32 first, int32 last); - /* API for building a URL */ char *DIR_BuildUrl (DIR_Server *s, const char *dn, XP_Bool forAddToAB); +/* Walks the list enforcing the rule that only one LDAP server can be configured for autocomplete */ +void DIR_SetAutoCompleteEnabled (XP_List *list, DIR_Server *server, XP_Bool enabled); + /* Flags manipulation */ -#define DIR_AUTO_COMPLETE_ENABLED 0x00000001 -#define DIR_ENABLE_AUTH 0x00000002 +#define DIR_AUTO_COMPLETE_ENABLED 0x00000001 /* Directory is configured for autocomplete addressing */ +#define DIR_ENABLE_AUTH 0x00000002 /* Directory is configured for LDAP simple authentication */ #define DIR_SAVE_PASSWORD 0x00000004 #define DIR_UTF8_DISABLED 0x00000008 /* not used by the FEs */ #define DIR_IS_SECURE 0x00000010 #define DIR_SAVE_RESULTS 0x00000020 /* not used by the FEs */ #define DIR_EFFICIENT_WILDCARDS 0x00000040 /* not used by the FEs */ -#define DIR_LDAPV3_SUPPORTED 0x00000080 /* not used by the FEs */ -#define DIR_LDAPV3_NOT_SUPPORTED 0x00000100 /* not used by the FEs */ -#define DIR_VIRTUAL_LISTBOX_SUPPORTED 0x00000200 /* not used by the FEs */ -#define DIR_VIRTUAL_LISTBOX_NOT_SUPPORTED 0x00000400 /* not used by the FEs */ - -void DIR_SetAutoCompleteEnabled (XP_List *list, DIR_Server *server, XP_Bool onOrOff); +#define DIR_REPLICATION_ENABLED 0x00000080 /* Directory is configured for offline use */ +#define DIR_LDAP_PUBLIC_DIRECTORY 0x00000100 /* not used by the FEs */ +#define DIR_LDAP_VERSION3 0x00000200 /* not used by the FEs */ +#define DIR_LDAP_VIRTUALLISTVIEW 0x00000400 /* not used by the FEs */ +#define DIR_LDAP_ROOTDSE_PARSED 0x00000800 /* not used by the FEs */ XP_Bool DIR_TestFlag (DIR_Server *server, uint32 flag); void DIR_SetFlag (DIR_Server *server, uint32 flag); @@ -213,7 +256,12 @@ char *DIR_ConvertFromServerCharSet (DIR_Server *s, char *src, int16 dstCsid); /* Does the LDAP client lib work for SSL */ #include "ldap.h" -int DIR_SetupSecureConnection (LDAP *ld); + +int DIR_SetupSecureConnection (LDAP *l); + +/* APIs for replication */ +int DIR_ValidateRootDSE (DIR_Server *s, char *version, int32 first, int32 last); +int DIR_ParseRootDSE (DIR_Server *s, LDAP *ld, LDAPMessage *message); #endif /* MOZ_LDAP */ diff --git a/mozilla/include/fe_proto.h b/mozilla/include/fe_proto.h index d61fddd9799..cb0ccb40311 100644 --- a/mozilla/include/fe_proto.h +++ b/mozilla/include/fe_proto.h @@ -144,6 +144,12 @@ extern void FE_ClearConnectSelect(MWContext * win_id, int fd); extern void FE_SetFileReadSelect(MWContext * win_id, int fd); extern void FE_ClearFileReadSelect(MWContext * win_id, int fd); +#if defined(XP_UNIX) +/* Are we in CallNetlibAllTheTime mode? Called by security only + */ +extern XP_Bool XFE_IsCallNetlibAllTheTime(); +#endif + /* tell the front end to call ProcessNet as often as possible * This superseeds FE_SetCallNetlibAllTheTime */ @@ -304,6 +310,10 @@ extern void FE_Progress (MWContext *context, const char * Msg); extern void FE_Alert (MWContext * context, const char * Msg); +#ifdef XP_UNIX +extern void FE_Alert_modal (MWContext * context, const char * Msg); +#endif + #if defined(XP_MAC)||defined(XP_UNIX) extern void FE_Message (MWContext * context, const char * Msg); #else @@ -1271,11 +1281,6 @@ extern int WFE_DoCompuserveAuthenticate(MWContext *context, extern char *WFE_BuildCompuserveAuthString(URL_Struct *URL_s); -/* Way to attempt to keep the application messages flowing - * when need to block a return value. - */ -extern void FEU_StayingAlive(void); - /* convert logical pixels to device pixels */ extern int32 FE_LPtoDPoint(MWContext * context, int32 logicalPoint); @@ -1294,6 +1299,11 @@ extern void FE_MochaImageGroupObserver(XP_Observable observable, */ MWContext * FE_GetInitContext(void); +/* Way to attempt to keep the application messages flowing + * when need to block a return value. + */ +extern void FEU_StayingAlive(void); + #ifdef XP_UNIX /* Get the dimensions of an icon in pixels for the PostScript front end. */ extern void diff --git a/mozilla/include/garray.h b/mozilla/include/garray.h index 7bf74983011..000d51425e5 100644 --- a/mozilla/include/garray.h +++ b/mozilla/include/garray.h @@ -37,6 +37,7 @@ #define TEMPLATE_SUPPORT 1 #endif +#include "prtypes.h" class CXP_GrowableArray { protected: @@ -107,7 +108,7 @@ public: if( nIndex < m_iSize ) { - iLowerLimit = max(1, nIndex); + iLowerLimit = PR_MAX(1, nIndex); /* Shuffle pointers at and above insert index up */ for( int i = m_iSize; i >= iLowerLimit; i-- ) { diff --git a/mozilla/include/imap.h b/mozilla/include/imap.h index a86087cb683..4b5c90f843e 100644 --- a/mozilla/include/imap.h +++ b/mozilla/include/imap.h @@ -55,10 +55,24 @@ typedef enum { kPersonalNamespace = 0, kOtherUsersNamespace, kPublicNamespace, - kDefaultNamespace, kUnknownNamespace } EIMAPNamespaceType; +typedef enum { + kCapabilityUndefined = 0x00000000, + kCapabilityDefined = 0x00000001, + kHasAuthLoginCapability = 0x00000002, + kHasXNetscapeCapability = 0x00000004, + kHasXSenderCapability = 0x00000008, + kIMAP4Capability = 0x00000010, /* RFC1734 */ + kIMAP4rev1Capability = 0x00000020, /* RFC2060 */ + kIMAP4other = 0x00000040, /* future rev?? */ + kNoHierarchyRename = 0x00000080, /* no hierarchy rename */ + kACLCapability = 0x00000100, /* ACL extension */ + kNamespaceCapability = 0x00000200, /* IMAP4 Namespace Extension */ + kMailboxDataCapability = 0x00000400, /* MAILBOXDATA SMTP posting extension */ + kXServerInfoCapability = 0x00000800 /* XSERVERINFO extension for admin urls */ +} eIMAPCapabilityFlag; typedef int32 imap_uid; @@ -101,6 +115,7 @@ struct mailbox_spec { XP_Bool discoveredFromLsub; const char *smtpPostAddress; + XP_Bool onlineVerified; }; typedef struct mailbox_spec mailbox_spec; @@ -118,10 +133,12 @@ enum ImapOnlineCopyState { kSuccessfulDelete, kFailedDelete, kReadyForAppendData, - kFailedAppend + kFailedAppend, + kInterruptedState }; struct folder_rename_struct { + char *fHostName; char *fOldName; char *fNewName; }; @@ -342,9 +359,23 @@ char *CreateIMAPRefreshACLForAllFoldersURL(const char *imapHost); /* Run the auto-upgrade to IMAP Subscription */ char *CreateIMAPUpgradeToSubscriptionURL(const char *imapHost, XP_Bool subscribeToAll); -NET_StreamClass *CreateIMAPDownloadMessageStream(ImapActiveEntry *ce, uint32 msgSize); +/* do a status command for the folder */ +char *CreateIMAPStatusFolderURL(const char *imapHost, const char *mailboxName, char hierarchySeparator); + +/* refresh the imap folder urls for the folder */ +char *CreateIMAPRefreshFolderURLs(const char *imapHost, const char *mailboxName); + +/* create a URL to force an all-parts reload of the fetch URL given in url. */ +char *IMAP_CreateReloadAllPartsUrl(const char *url); + +/* Explicitly LIST a given mailbox, and refresh its flags in the folder list */ +char *CreateIMAPListFolderURL(const char *imapHost, const char *mailboxName); + +NET_StreamClass *CreateIMAPDownloadMessageStream(ImapActiveEntry *ce, uint32 size, + const char *content_type, XP_Bool content_modified); void UpdateIMAPMailboxInfo(mailbox_spec *adoptedBoxSpec, MWContext *currentContext); +void UpdateIMAPMailboxStatus(mailbox_spec *adoptedBoxSpec, MWContext *currentContext); #define kUidUnknown -1 int32 GetUIDValidityForSpecifiedImapFolder(const char *hostName, const char *canonicalimapName, MWContext *currentContext); @@ -356,10 +387,11 @@ enum EMailboxDiscoverStatus { eNewServerDirectory, eCancelled }; -enum EMailboxDiscoverStatus DiscoverIMAPMailbox(mailbox_spec *adoptedBoxSpec, MSG_Master *master, MWContext *currentContext); +enum EMailboxDiscoverStatus DiscoverIMAPMailbox(mailbox_spec *adoptedBoxSpec, MSG_Master *master, + MWContext *currentContext, XP_Bool broadcastDiscovery); void ReportSuccessOfOnlineCopy(MWContext *currentContext, enum ImapOnlineCopyState copyState); -void ReportSuccessOfOnlineDelete(MWContext *currentContext, const char *mailboxName); +void ReportSuccessOfOnlineDelete(MWContext *currentContext, const char *hostName, const char *mailboxName); void ReportFailureOfOnlineCreate(MWContext *currentContext, const char *mailboxName); void ReportSuccessOfOnlineRename(MWContext *currentContext, folder_rename_struct *names); void ReportMailboxDiscoveryDone(MWContext *currentContext, URL_Struct *URL_s); @@ -385,7 +417,7 @@ void IMAP_DownLoadMessageBodieForMailboxSelect(TNavigatorImapConnection *connect void IMAP_BodyIdMonitor(TNavigatorImapConnection *connection, XP_Bool enter); -const char *IMAP_GetCurrentConnectionUrl(TNavigatorImapConnection *connection); +char *IMAP_GetCurrentConnectionUrl(TNavigatorImapConnection *connection); void IMAP_UploadAppendMessageSize(TNavigatorImapConnection *connection, uint32 msgSize, imapMessageFlagsType flags); void IMAP_ResetAnyCachedConnectionInfo(); @@ -409,7 +441,7 @@ void IMAP_FreeBoxSpec(mailbox_spec *victim); const char *IMAP_GetPassword(); void IMAP_SetPassword(const char *password); - +void IMAP_SetPasswordForHost(const char *host, const char *password); /* called once only by MSG_InitMsgLib */ void IMAP_StartupImap(); @@ -425,7 +457,7 @@ XP_Bool IMAP_HaveWeBeenAuthenticated(); /* used by libmsg when creating an imap message display stream */ int IMAP_InitializeImapFeData (ImapActiveEntry * ce); MSG_Pane *IMAP_GetActiveEntryPane(ImapActiveEntry * ce); -NET_StreamClass *IMAP_CreateDisplayStream(ImapActiveEntry * ce, XP_Bool clearCacheBit, uint32 msgSize); +NET_StreamClass *IMAP_CreateDisplayStream(ImapActiveEntry * ce, XP_Bool clearCacheBit, uint32 size, const char *content_type); /* used by libmsg when a new message is loaded to interrupt the load of the previous message */ void IMAP_PseudoInterruptFetch(MWContext *context); @@ -475,6 +507,19 @@ extern XP_Bool MSG_IsFolderACLInitialized(MSG_Master *master, const char *folder extern char *IMAP_SerializeNamespaces(char **prefixes, int len); extern int IMAP_UnserializeNamespaces(const char *str, char **prefixes, int len); +extern XP_Bool IMAP_SetHostIsUsingSubscription(const char *hostname, XP_Bool using_subscription); + +/* Returns the runtime capabilities of the given host, or 0 if the host doesn't exist or if + they are uninitialized so far */ +extern uint32 IMAP_GetCapabilityForHost(const char *hostName); + +/* Causes a libmsg MSG_IMAPHost to refresh its capabilities based on new runtime info */ +extern void MSG_CommitCapabilityForHost(const char *hostName, MSG_Master *master); + +/* Returns TRUE if the given folder is \Noselect. Returns FALSE if it's not or if we don't + know about it. */ +extern XP_Bool MSG_IsFolderNoSelect(MSG_Master *master, const char *folderName, const char *hostName); + XP_END_PROTOS #endif diff --git a/mozilla/include/libi18n.h b/mozilla/include/libi18n.h index 4056eb8a5df..282814e5b7d 100644 --- a/mozilla/include/libi18n.h +++ b/mozilla/include/libi18n.h @@ -2114,6 +2114,52 @@ PUBLIC XP_Bool INTL_StrEndWith( unsigned char* str2 ); +/** + * Decode, convert and create a message header. Then create and return a collatable string. + * + * If the message header contains an RFC 2047 encoded-word, that word is + * decoded. Then it performs charset conversion to window charset ID. + * Finally, it creates and returns a machine collatable string (calls INTL_CreateCollationKeyByDefaultLocale) + * which can be compared by INTL_Compare_CollationKey. + * + * @param header Specifies the message string to be decoded/converted. + * @param wincsid Specifies the target window charset ID. + * @param collation_flag For future enhancement, pass 0 for now. + * @return A null terminated string collatable by INTL_Compare_CollationKey. + * The caller must free the output buffer by calling XP_FREE when it is no longer needed. + * @see INTL_DECODE_MIME_PART_II,INTL_Compare_CollationKey,INTL_CreateCollationKeyByDefaultLocale + */ +char *INTL_DecodeMimePartIIAndCreateCollationKey(const char *header, int16 wincsid, int32 collation_flag); + +/** + * Create a collation key using default sytem locale. + * + * By using default system locale, this creates and returns a machine collatable string + * which can be compared by INTL_Compare_CollationKey. + * + * @param in_string Input string for a key generation. + * @param wincsid Specifies the target window charset ID. + * @param collation_flag For future enhancement, pass 0 for now. + * @return A null terminated string collatable by INTL_Compare_CollationKey. + * The caller must free the output buffer by calling XP_FREE when it is no longer needed. + * @see INTL_DecodeMimePartIIAndCreateCollationKey,INTL_Compare_CollationKey + */ +char *INTL_CreateCollationKeyByDefaultLocale(const char *in_string, int16 wincsid, int32 collation_flag); + +/** + * Compare two collation keys. + * + * Compare two collation keys generated by INTL_CreateCollationKeyByDefaultLocale. + * + * @param key1 Null terminated string. + * @param key2 Null terminated string. + * @return <0 if key1 less than key2 + * 0 if key1 equals to key2 + * >0 if key1 greater than key2 + * @see INTL_DecodeMimePartIIAndCreateCollationKey,INTL_Compare_CollationKey + */ +int INTL_Compare_CollationKey(const char *key1, const char *key2); + /** * Return a (hacky) XPAT pattern for NNTP server for searching pre * RFC 1522 message header. diff --git a/mozilla/include/libmime.h b/mozilla/include/libmime.h index 9a39c3a2148..16092719af7 100644 --- a/mozilla/include/libmime.h +++ b/mozilla/include/libmime.h @@ -98,9 +98,21 @@ extern char *MimeHeaders_get(MimeHeaders *hdrs, would return "us-ascii". Returns NULL if there is no match, or if there is an allocation failure. + + RFC2231 - MIME Parameter Value and Encoded Word Extensions: Character Sets, + Languages, and Continuations + + RFC2231 has added the character sets, languages, and continuations mechanism. + charset, and language information may also be returned to the caller. + For example, + MimeHeaders_get_parameter("text/plain; name*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A", "name") + MimeHeaders_get_parameter("text/plain; name*0*=us-ascii'en-us'This%20is%20; CRLFLWSPname*1*=%2A%2A%2Afun%2A%2A%2A", "name") + would return "This is ***fun***" and *charset = "us-ascii", *language = "en-us" */ extern char *MimeHeaders_get_parameter (const char *header_value, - const char *parm_name); + const char *parm_name, + char **charset, + char **language); extern MimeHeaders *MimeHeaders_copy (MimeHeaders *srcHeaders); @@ -449,6 +461,9 @@ struct MimeDisplayOptions evil people from writing javascript code to hack it. */ + XP_Bool missing_parts; /* Whether or not this message is going to contain + missing parts (from IMAP Mime Parts On Demand) */ + }; diff --git a/mozilla/include/mime.h b/mozilla/include/mime.h index e97a092889e..22dc4fc3f95 100644 --- a/mozilla/include/mime.h +++ b/mozilla/include/mime.h @@ -110,6 +110,8 @@ NET_MimeMakePartialEncodingConverterStream (int format_out, extern int MIME_HasAttachments(MWContext *context); +#define IMAP_EXTERNAL_CONTENT_HEADER "X-Mozilla-IMAP-Part" + XP_END_PROTOS #endif /* mime.h */ diff --git a/mozilla/include/msg_filt.h b/mozilla/include/msg_filt.h index cf3a389d84c..8d2ef9c70c7 100644 --- a/mozilla/include/msg_filt.h +++ b/mozilla/include/msg_filt.h @@ -101,6 +101,7 @@ XP_BEGIN_PROTOS */ MSG_FilterError MSG_OpenFilterList(MSG_Master *master, MSG_FilterType type, MSG_FilterList **filterList); MSG_FilterError MSG_OpenFolderFilterList(MSG_Pane *pane, MSG_FolderInfo *folder, MSG_FilterType type, MSG_FilterList **filterList); +MSG_FilterError MSG_OpenFolderFilterListFromMaster(MSG_Master *master, MSG_FolderInfo *folder, MSG_FilterType type, MSG_FilterList **filterList); MSG_FilterError MSG_CloseFilterList(MSG_FilterList *filterList); MSG_FilterError MSG_SaveFilterList(MSG_FilterList *filterList); /* save without deleting */ MSG_FilterError MSG_CancelFilterList(MSG_FilterList *filterList); diff --git a/mozilla/include/msg_srch.h b/mozilla/include/msg_srch.h index 4488799841a..999b389a585 100644 --- a/mozilla/include/msg_srch.h +++ b/mozilla/include/msg_srch.h @@ -49,6 +49,7 @@ typedef enum SearchError_InvalidOperator, /* specified op not in enum */ SearchError_InvalidSearchTerm, /* cookie for search term is bogus */ + SearchError_InvalidSearchType, /* search type is bogus */ SearchError_InvalidScopeTerm, /* cookie for scope term is bogus */ SearchError_InvalidResultElement, /* cookie for result element is bogus */ SearchError_InvalidPane, /* context probably bogus */ @@ -59,10 +60,12 @@ typedef enum SearchError_HostNotFound, /* couldn't connect to server */ SearchError_Timeout, /* network didn't respond */ SearchError_DBOpenFailed, /* couldn't open off-line msg db */ + SearchError_Busy, /* operation can not be performed now */ SearchError_NotAMatch, /* used internally for term eval */ SearchError_ScopeDone, /* used internally for scope list eval */ + SearchError_ValueRequired, /* string to search for not provided */ SearchError_Unknown, /* some random error */ SearchError_Last /* no functions return this; just for bookkeeping */ @@ -77,13 +80,10 @@ typedef enum scopeAllSearchableGroups } MSG_ScopeAttribute; -/* NB: If you add elements to this enum, add only to the end, since - * RULES.DAT stores enum values persistently - */ typedef enum { - attribSender = 0, /* mail and news */ - attribSubject, + attribSubject = 0, /* mail and news */ + attribSender, attribBody, attribDate, @@ -165,10 +165,19 @@ typedef enum widgetText, widgetDate, widgetMenu, - widgetInt, /* added to account for age in days which requires an integer field */ + widgetInt, /* added to account for age in days which requires an integer field */ widgetNone } MSG_SearchValueWidget; +/* Used to specify type of search to be performed */ +typedef enum +{ + searchNone, + searchRootDSE, + searchNormal, + searchLdapVLV +} MSG_SearchType; + /* Use this to specify the value of a search term */ typedef struct MSG_SearchValue { @@ -279,6 +288,18 @@ MSG_SearchError MSG_AddAllScopes ( /* begin execution of the search */ MSG_SearchError MSG_Search ( MSG_Pane *searchPane); /* So we know how to work async */ +MSG_SearchError MSG_InterruptSearchViaPane ( + MSG_Pane *searchPane); /* ptr to pane with search to interrupt */ +void *MSG_GetSearchParam ( + MSG_Pane *pane); /* ptr to pane to retrieve param from */ +MSG_SearchType MSG_GetSearchType ( + MSG_Pane *pane); /* ptr to pane to retrieve search type from*/ +MSG_SearchError MSG_SetSearchParam ( + MSG_Pane *searchPane, /* ptr to pane to add search param */ + MSG_SearchType type, /* type of specialized search to perform */ + void *param); /* extended search parameter */ +uint32 MSG_GetNumResults ( /* ptr to pane to retrieve get # results */ + MSG_Pane *pane); /* manage elements in list of search hits */ MSG_SearchError MSG_GetResultElement ( @@ -441,7 +462,6 @@ extern char *MSG_UnEscapeSearchUrl (const char *value); extern int MSG_ProcessSearch (MWContext *context); extern int MSG_InterruptSearch (MWContext *context); - XP_END_PROTOS #endif /* _MSG_SRCH_H */ diff --git a/mozilla/include/msgcom.h b/mozilla/include/msgcom.h index 4e14e8d7057..15dbc9823f1 100644 --- a/mozilla/include/msgcom.h +++ b/mozilla/include/msgcom.h @@ -23,6 +23,7 @@ #ifndef _MSGCOM_H_ #define _MSGCOM_H_ +#include "rosetta.h" #include "libmime.h" #define SUBSCRIBE_USE_OLD_API @@ -68,10 +69,6 @@ #include "ntypes.h" #include "msgtypes.h" - - - - /* =========================================================================== COMMAND NUMBERS =========================================================================== @@ -211,16 +208,19 @@ typedef enum MSG_Redo, /* ftm: Redoes the last undone operation. */ - MSG_DeleteMessage, /* tm, mm: Causes the given messages to be + MSG_Delete, + + MSG_DeleteMessage = MSG_Delete, /* tm, mm: Causes the given messages to be deleted. */ - MSG_DeleteFolder, /* fm, tm: Causes the given folders to be + MSG_DeleteFolder /* = MSG_Delete */, /* fm, tm: Causes the given folders to be deleted. */ MSG_CancelMessage, /* tn, mn: Causes the given messages to be cancelled, if possible. */ - MSG_DeleteMessageNoTrash, /* tm, mm: Causes the given messages to be + MSG_DeleteNoTrash, + MSG_DeleteMessageNoTrash = MSG_DeleteNoTrash, /* tm, mm: Causes the given messages to be deleted w/o getting copied to trash. */ /* MESSAGE MENU @@ -245,8 +245,13 @@ typedef enum MSG_ReplyToAll, /* t,m: E-mail (& possibly post) a reply to everyone who saw this message. */ MSG_ForwardMessage, /* t,m: Forward these messages to someone. */ + MSG_ForwardMessageAttachment, /* t,m: Forward these messages as attachment + to someone. */ MSG_ForwardMessageQuoted, /* t,m: Forward this message, quoting it inline. */ + MSG_ForwardMessageInline, /* t,m: Forward this message inline including + inline attaachments if possible*/ + MSG_MarkMessagesRead, /* t,m: Mark the message as read. */ MSG_MarkMessagesUnread, /* t,m: Mark the message as unread. */ MSG_ToggleMessageRead, /* t,m: Toggle whether the message has been @@ -470,13 +475,29 @@ typedef enum have some overlap, but all the indices are invalid. The "where" and "num" parameters are unused. */ - MSG_NotifyAll /* Everything changed. We're now not + MSG_NotifyAll, /* Everything changed. We're now not displaying anything like what we were; we probably opened a new folder or something. The FE needs to forget anything it ever knew about what was being displayed, and start over. The "where" and "num" parameters are unused. */ + MSG_NotifyLDAPTotalContentChanged, + /* Introduced for the address book to support + virtual list views. The total number of + entries on the LDAP directory has changed + and the FE must update its scrollbar. The + "num" parameter contains the total number of + entries on the LDAP server. */ + MSG_NotifyNewTopIndex /* Introduced for the address book to support + virtual list views. The virtual list view + cache data has changed and the FE view may + be out of date. The view should be updated + so that the first/top index in the view is + the index in the "where" parameter. The + scrollbar should be updated to match the new + position. */ + } MSG_NOTIFY_CODE; /* How has a pane changed? Used in calls to FE_PaneChanged. If the @@ -518,6 +539,8 @@ typedef enum MSG_PaneNotifyNewFolderFailed, /* Sent when a new folder creation attempt fails */ + MSG_PaneNotifySafeToSelectFolder, /* sent to a folder pane when a folder operation has + finished and it's safe to select another folder */ MSG_PaneNotifyIMAPClosed, /* Sent to a folder or message pane when the IMAP connection with which it is associated is closing. */ @@ -526,7 +549,14 @@ typedef enum selection in order to prevent interruption */ MSG_PaneChanged, /* Introduced for the 2 pane Address Book. Contents have changed through another pane. This pane's data is no longer up to date */ - MSG_PaneClose /* Introduced for the 2 pane AB. This pane needs to be closed */ + MSG_PaneClose, /* Introduced for the 2 pane AB. This pane needs to be closed */ + MSG_PaneNotifyTypeDownCompleted, /* Introduced for the 2 pane AB. The type down asynch operation requested on this + pane has been completed. The attached int32 is a MSG_ViewIndex which corresponds to + the type down index result value */ + MSG_PaneNotifyStartSearching, /* Introduced for new address book. FEs should mark the pane as searching, add any appropriate UI + work such as a cylon, etc. */ + MSG_PaneNotifyStopSearching /* Introduced for new address book. FEs should mark the pane as no longer searching and turn off any + search related UI stuff such as a cylon, etc. */ } MSG_PANE_CHANGED_NOTIFY_CODE; @@ -908,7 +938,8 @@ typedef enum { AB_CONTAINERPANE, AB_ABPANE, AB_MAILINGLISTPANE, - AB_PERSONENTRYPANE + AB_PERSONENTRYPANE, + AB_PICKERPANE } MSG_PaneType; @@ -993,6 +1024,13 @@ class MSG_Host; typedef struct MSG_Host *MSG_Host; #endif /* XP_CPLUSPLUS */ +/* used by Address Book to describe a particular address book */ + +#ifdef XP_CPLUSPLUS +class AB_ContainerInfo; +#else +typedef struct AB_ContainerInfo AB_ContainerInfo; +#endif /* used in MWContext to communicate IMAP stuff between libmsg and libnet */ @@ -1090,15 +1128,8 @@ typedef struct MSG_AttachedFile uint32 null_count; uint32 max_line_length; - XP_Bool decrypted_p; /* S/MIME -- when attaching a message that was - encrypted, it's necessary to decrypt it first - (since nobody but the original recipient can read - it -- if you forward it to someone in the raw, it - will be useless to them.) This flag indicates - whether decryption occurred, so that libmsg can - issue appropriate warnings about doing a cleartext - forward of a message that was originally encrypted. - */ + HG68452 + } MSG_AttachedFile; @@ -1322,7 +1353,7 @@ void MSG_CleanupFolders(MSG_Pane *pane); void MSG_OnIdle(void); -int32 MSG_SetLibNeoCacheSize(int32 newCacheSize); +int32 MSG_SetDBCacheSize(int32 newCacheSize); /* Initialize the mail/news universe. A MSG_Master* object must be created before anything else can be done. Only one MSG_Master* object can exist at @@ -1491,11 +1522,24 @@ extern void* MSG_GetFEData(MSG_Pane* pane); extern XP_Bool FE_IsAltMailUsed(MWContext * context); -/* Routine to bring up the IMAP Subscription Upgrade dialog box */ -/* Return value based on selection: Automatic = 0, Custom = 1 */ +typedef enum { + MSG_IMAPUpgradeAutomatic, /* automatically try to upgrade */ + MSG_IMAPUpgradeCustom, /* the user will select folders manually */ + MSG_IMAPUpgradeDont /* Cancel or error - don't upgrade now */ +} MSG_IMAPUpgradeType; -extern int FE_PromptIMAPSubscriptionUpgrade (MWContext * context); +#if defined(XP_WIN) || defined (XP_MAC) || defined(XP_UNIX) +#define FE_IMPLEMENTS_IMAP_SUBSCRIBE_UPGRADE +#endif +#ifdef FE_IMPLEMENTS_IMAP_SUBSCRIBE_UPGRADE + +/* Routine to bring up the IMAP Subscription Upgrade dialog box. + context is the context of the parent of this dialog box; + hostName is the name of the IMAP host which will be upgraded. +*/ +extern MSG_IMAPUpgradeType FE_PromptIMAPSubscriptionUpgrade (MWContext * context, const char *hostName); +#endif /* This function is called by the backend to notify the frontend details about new mail state so that the FE can notify the stand-alone biff that something @@ -1512,6 +1556,13 @@ typedef enum { extern uint32 FE_SetBiffInfo(MSG_BiffInfoType type, uint32 data); #endif +/* The imap delete model */ +typedef enum { + MSG_IMAPDeleteIsIMAPDelete, /* delete with a big red x */ + MSG_IMAPDeleteIsMoveToTrash, /* delete moves message to the trash */ + MSG_IMAPDeleteIsDeleteNoTrash /* delete is shift delete - don't create or use trash */ +} MSG_IMAPDeleteModel; + /* run the url in the given pane. This will set the msg_pane member in url, interrupt the context, and then call FE_GetURL */ extern int MSG_GetURL(MSG_Pane *pane, URL_Struct* url); @@ -1551,6 +1602,11 @@ extern MWContext* MSG_GetContext(MSG_Pane* pane); extern MSG_Prefs* MSG_GetPrefs(MSG_Pane* pane); +/* This function MUST be called by the startup wizard. It writes out the correct "profile age" + value into this user's pref file. This value determines which upgrade steps still need to be + done. */ + +extern void MSG_WriteNewProfileAge(); /* Returns the MSG_Prefs* object that is being used to determine the preferences for this master object. */ @@ -1657,8 +1713,26 @@ extern void MSG_StoreNavigatorIMAPConnectionInMoveState(MWContext *context, extern XP_Bool MSG_DisplayingRecipients(MSG_Pane* threadpane); +/* For the new AB stuff, we need to know which address book we are adding the senders to. + Because we are adding this extra argument, we had to pull it out of MSG_Command + and make a new API */ +extern int MSG_AddToAddressBook(MSG_Pane* pane, + MSG_CommandType command, + MSG_ViewIndex* indices, + int32 numIndices, + AB_ContainerInfo * destAB); +/* We also provide a status function to support this command */ +extern int MSG_AddToAddressBookStatus(MSG_Pane* pane, + MSG_CommandType command, + MSG_ViewIndex* indices, + int32 numIndices, + XP_Bool *selectable_p, + MSG_COMMAND_CHECK_STATE *selected_p, + const char **display_string, + XP_Bool *plural_p, + AB_ContainerInfo * destAB); /* The msg library calls FE_ListChangeStarting() to tell the front end that the contents of the message or folder list are about to change. It means that @@ -1857,6 +1931,7 @@ extern int MSG_ResultsRecipients(MSG_Pane* composepane, extern void MSG_SetPostDeliveryActionInfo (MSG_Pane* pane, void *actionInfo); +extern uint32 MSG_GetActionInfoFlags (void *actionInfo); /* Setting the preloaded attachments to a compose window. Drafts only */ extern int MSG_SetPreloadedAttachments ( MSG_Pane *composepane, @@ -1926,7 +2001,7 @@ extern XP_Bool MSG_GetNoInlineAttachments(MSG_Prefs* prefs); 1 pane or 2 Configured for off-line use I think these can be represented with bits. If wrong, we'll have - to change this. They should be stored in the database, NeoFolderInfo obj, + to change this. They should be stored in the database, DBFolderInfo obj, and cached in MSG_FolderInfo. */ #define MSG_FOLDER_PREF_OFFLINE 0x00000001 @@ -1960,6 +2035,8 @@ extern int32 MSG_GetFolderPrefFlags(MSG_FolderInfo *info); */ extern void MSG_SetFolderCSID(MSG_FolderInfo *info, int16 csid); extern int16 MSG_GetFolderCSID(MSG_FolderInfo *info); +extern void MSG_SetLastMessageLoaded(MSG_FolderInfo *info, MessageKey lastMessageLoaded); +extern MessageKey MSG_GetLastMessageLoaded(MSG_FolderInfo *info); typedef enum MSG_AdminURLType { @@ -2011,13 +2088,15 @@ typedef enum { MSG_Drag_Not_Allowed = 0x00000000 , MSG_Require_Copy = 0x00000001 , MSG_Require_Move = 0x00000002 -, MSG_Default_Drag = 0xFFFFFFFF +, MSG_Default_Drag = -1 /* used to be 0xFFFFFFF but this broke HP Unix build...*/ } MSG_DragEffect; /* Status calls. Caller passes in requested action. If it's a required action, the returned value will be the request value, or MSG_Drag_Not_Allowed. If it's a default drag request, - the returned value will show whether the drag should be interpreted as a move or copy. */ + the returned value will show whether the drag should be interpreted as a move or copy. + If numIndices is 0, this simply returns the status when trying to drop an arbitrary message + on the given destination folder. */ extern MSG_DragEffect MSG_DragMessagesStatus(MSG_Pane* pane, const MSG_ViewIndex* indices, int32 numindices, const char *folder, MSG_DragEffect request); extern MSG_DragEffect MSG_DragMessagesIntoFolderStatus(MSG_Pane* pane, @@ -2085,7 +2164,8 @@ extern MSG_NewsHost* MSG_GetNewsHostFromMSGHost(MSG_Host *host); if it is a MSG_IMAPHost. Otherwise, returns NULL. */ extern MSG_IMAPHost* MSG_GetIMAPHostFromMSGHost(MSG_Host *host); - +extern MSG_IMAPHost* MSG_GetIMAPHostByName(MSG_Master *master, const char *hostName); +extern void MSG_ReorderIMAPHost(MSG_Master *master, MSG_IMAPHost *host, MSG_IMAPHost *afterHost /* NULL = pos 0 */); /* this should be in msgnet.h, but winfe uses it - this is dangerous in a multiple host world. @@ -2144,6 +2224,7 @@ extern MSG_IMAPHost* MSG_GetDefaultIMAPHost(MSG_Master* master); this operation before making this call. */ extern int MSG_DeleteIMAPHost(MSG_Master* master, MSG_IMAPHost* host); +extern int MSG_DeleteIMAPHostByName(MSG_Master* master, const char *hostname); /* Get info about a host. */ @@ -2303,8 +2384,9 @@ extern void MSG_GetHeaderPurgingInfo(MSG_FolderInfo *newsGroup, for those folders so configured. */ extern int MSG_DownloadForOffline(MSG_Master *master, MSG_Pane *pane); -extern int MSG_GoOffline(MSG_Master *master, MSG_Pane *pane, XP_Bool downloadDiscussions, XP_Bool getNewMail, XP_Bool sendOutbox); +extern int MSG_GoOffline(MSG_Master *master, MSG_Pane *pane, XP_Bool downloadDiscussions, XP_Bool getNewMail, XP_Bool sendOutbox, XP_Bool getDirectories); extern int MSG_DownloadFolderForOffline(MSG_Master *master, MSG_Pane *pane, MSG_FolderInfo *folder); +extern int MSG_SynchronizeOffline(MSG_Master *master, MSG_Pane *pane, XP_Bool downloadDiscussions, XP_Bool getNewMail, XP_Bool sendOutbox, XP_Bool getDirectories, XP_Bool goOffline); /* =========================================================================== @@ -2353,7 +2435,21 @@ extern MSG_ViewIndex MSG_GetFolderIndexForInfo(MSG_Pane *folderpane, extern MSG_FolderInfo* MSG_GetFolderInfo(MSG_Pane* folderpane, MSG_ViewIndex index); + +#if defined(XP_WIN) || defined(XP_MAC) || defined(XP_UNIX) +#define FE_IMPLEMENTS_NEW_GET_FOLDER_INFO +#endif + +#ifdef FE_IMPLEMENTS_NEW_GET_FOLDER_INFO +/* Returns a MSG_FolderInfo* given a URL for that folder. + Pass in TRUE for forGetUrl if this call is being used to get a MSG_FolderInfo* for opening it. + Otherwise (if just getting the MSG_FolderInfo* for information, such as in the preferences), + pass in FALSE. + */ +extern MSG_FolderInfo* MSG_GetFolderInfoFromURL(MSG_Master* master, const char *url, XP_Bool forGetUrl); +#else extern MSG_FolderInfo* MSG_GetFolderInfoFromURL(MSG_Master* master, const char *url); +#endif /* returns folder info of host owning this folder*/ MSG_FolderInfo* GetHostFolderInfo(MSG_FolderInfo* info); @@ -2480,7 +2576,14 @@ extern int MSG_CreateMailFolderWithPane (MSG_Pane *invokingPane, MSG_Master *mas Returns the MSG_FolderInfo for the suggested parent, given the currently selected folder or host. Returns NULL if current is NULL. */ -extern MSG_FolderInfo *MSG_SuggestNewFolderParent(MSG_FolderInfo *current); +extern MSG_FolderInfo *MSG_SuggestNewFolderParent(MSG_FolderInfo *current, MSG_Master *master); + + +/* FEs should call this to determine if a given folder (f) can contain subfolders. + This can be called with an arbitrary MSG_FolderInfo, but only (currently) really does anything + interesting if it is a mail folder. */ +extern XP_Bool MSG_GetCanCreateSubfolderOfFolder(MSG_FolderInfo *f); + /* Call this from the new folder properties UI */ extern int MSG_RenameMailFolder (MSG_Pane *folderPane, MSG_FolderInfo *folder, @@ -2541,59 +2644,46 @@ typedef enum MSG_BIFF_Unknown /* We dunno whether there is new mail. */ } MSG_BIFF_STATE; +/* START OBSOLETE Biff functions, NIKI dawg took charge here to do multi-server biffing + These will be removed soon so do not use */ /* Register and unregister biff callback functions */ typedef void (*MSG_BIFF_CALLBACK)(MSG_BIFF_STATE oldState, MSG_BIFF_STATE newState); - extern void MSG_RegisterBiffCallback( MSG_BIFF_CALLBACK cb ); - extern void MSG_UnregisterBiffCallback(); - /* Get and set the current biff state */ - extern MSG_BIFF_STATE MSG_GetBiffState(); - extern void MSG_SetBiffStateAndUpdateFE(MSG_BIFF_STATE newState); - - /* Set the preference of how often to run biff. If zero is passed in, then never check. */ - extern void MSG_SetBiffInterval(int32 seconds); - - - #ifdef XP_UNIX /* Set the file to stat, instead of using pop3. This is for the Unix movemail nonsense. If the filename is NULL (the default), then use pop3. */ extern void MSG_SetBiffStatFile(const char* filename); #endif - - - -/* Initialize the biff context. Note that biff contexts exist entirely - independent of mail contexts; it's up to the FE to decide what order they - get created and stuff. */ - -extern int MSG_BiffInit(MWContext* context, MSG_Prefs* prefs); - - -/* The biff context is about to go away. The FE must call this first to - clean up. */ - -extern int MSG_BiffCleanupContext(MWContext* context); - - /* Causes a biff check to occur immediately. This gets caused automatically by MSG_SetBiffInterval or whenever libmsg gets new mail. */ - extern void MSG_BiffCheckNow(MWContext* context); - - /* Tell the FE to render in all the right places this latest knowledge as to whether we have new mail waiting. */ extern void FE_UpdateBiff(MSG_BIFF_STATE state); +/* END OBSOLETE functions */ +/* The following functions are still used to initialize and kill the Biff Master */ + +/* + Initialize the biff master object (MSG_Biff_Master). As folders are created we + add these as NikiBiff objects to the Biff master. Niki is my Old English Sheepdog, but + other than being a dog has nothing else to do with Biff. + The biff master takes care of the objects, their timers and so on. The objects + are used to see if new mail is available at a particular server or folder. +*/ + +extern int MSG_BiffInit(MWContext* context, MSG_Prefs* prefs); +extern int MSG_BiffCleanupContext(MWContext* context); /* cleanup */ +extern void MSG_Biff_Master_FE_Progress(MWContext *context, char *msg); +extern XP_Bool MSG_Biff_Master_NikiCallingGetNewMail(); /* =========================================================================== @@ -2611,15 +2701,10 @@ extern XP_Bool MSG_RequiresNewsWindow (const char *url); extern XP_Bool MSG_RequiresBrowserWindow (const char *url); extern XP_Bool MSG_RequiresComposeWindow (const char *url); -/* If this URL requires a particular kind of window, and this is not - that kind of window, then we need to find or create one. - */ -extern XP_Bool MSG_NewWindowRequired (MWContext *context, const char *url); - /* If this URL requires a particular kind of window, and this is not that kind of window, then we need to find or create one. This routine takes a URL_Struct, which allows it to be smarter than - the above routine. + the obsolete routine which takes a url string. */ extern XP_Bool MSG_NewWindowRequiredForURL (MWContext *context, URL_Struct *urlStruct); @@ -2639,6 +2724,10 @@ extern MSG_PaneType MSG_PaneTypeForURL(const char *url); is - this is so we know whether there is room to incorporate new mail. */ extern uint32 FE_DiskSpaceAvailable (MWContext* context, const char* dir); +/* Counts bytes for a POP3 message being downloaded and returns TRUE if it is + too early to have a message ended because we found CRLF.CRLF +*/ +extern XP_Bool NET_POP3TooEarlyForEnd(int32 len); /* =========================================================================== SECURE MAIL @@ -2721,8 +2810,7 @@ extern MSG_Pane* MSG_ComposeMessage(MWContext *old_context, const char *attachment, const char *newspost_url, const char *body, - XP_Bool encrypt_p, - XP_Bool sign_p, + HG00282 XP_Bool force_plain_text, const char* html_part); @@ -2741,9 +2829,8 @@ extern MSG_CompositionFields* MSG_CreateCompositionFields( const char *other_random_headers, const char *priority, const char *attachment, - const char *newspost_url, - XP_Bool encrypt_p, - XP_Bool sign_p); + const char *newspost_url + HG66663); extern void MSG_DestroyCompositionFields(MSG_CompositionFields *fields); @@ -3080,9 +3167,14 @@ extern char * MSG_ReformatRFC822Addresses (const char *line); Addresses are considered to be the same if they contain the same mailbox part (case-insensitive.) Real names and other comments are not compared. + + removeAliasesToMe allows the address parser to use the preference which + contains regular expressions which also mean 'me' for the purpose of + stripping the user's email address(es) out of addrs */ extern char *MSG_RemoveDuplicateAddresses (const char *addrs, - const char *other_addrs); + const char *other_addrs, + XP_Bool removeAliasesToMe); /* Given an e-mail address and a person's name, cons them together into a @@ -3110,6 +3202,35 @@ extern MWContext* FE_GetAddressBookContext(MSG_Pane* pane, XP_Bool viewnow); extern int MSG_NotifyChangeDirectoryServers(); +/* Given a folder info, returns a newly allocated string containing a description + of the folder rights for a given folder. It is the caller's responsibility + to free this string. + Returns NULL if we could not get ACL rights information for this folder. + */ + +extern char *MSG_GetACLRightsStringForFolder(MSG_FolderInfo *folder); + + +/* Given a folder info, returns a newly allocated string with the folder + type name. For instance, "Personal Folder", "Public Folder", etc. + It is the caller's responsibility to free this string. + Returns NULL if we could not get the a type for this folder. + */ + +extern char *MSG_GetFolderTypeName(MSG_FolderInfo *folder); + +/* Given a folder info, returns a newly allocated string containing a description + of the folder type. For instance, "This is a personal mail folder that you have shared." + It is the caller's responsibility to free this string. + Returns NULL if we could not get the a type for this folder. + */ + +extern char *MSG_GetFolderTypeDescription(MSG_FolderInfo *folder); + +/* Returns TRUE if the given IMAP host supports the sharing of folders. */ + +extern XP_Bool MSG_GetHostSupportsSharing(MSG_IMAPHost *host); + XP_END_PROTOS diff --git a/mozilla/include/msgmapi.h b/mozilla/include/msgmapi.h index e6ad3f8c288..fbf91bdbabb 100644 --- a/mozilla/include/msgmapi.h +++ b/mozilla/include/msgmapi.h @@ -62,7 +62,7 @@ char * AB_MAPI_GetFullName(AB_ContainerInfo * ctr, ABID id); char * AB_MAPI_ConvertToDescription(AB_ContainerInfo * ctr); -AB_ContainerInfo * AB_MAPI_ConvertToContainer(char * description); +AB_ContainerInfo * AB_MAPI_ConvertToContainer(MWContext * context, char * description); int AB_MAPI_CreatePropertySheetPane( MWContext * context, diff --git a/mozilla/include/msgnet.h b/mozilla/include/msgnet.h index 6c6e8af7586..5a98b321a4e 100644 --- a/mozilla/include/msgnet.h +++ b/mozilla/include/msgnet.h @@ -21,6 +21,7 @@ #ifndef _MSGNET_H_ #define _MSGNET_H_ #include "msgcom.h" +#include "dirprefs.h" XP_BEGIN_PROTOS @@ -35,6 +36,7 @@ extern void MSG_RecordImapMessageFlags(MSG_Pane* pane, /* notify libmsg of deleted messages */ extern void MSG_ImapMsgsDeleted(MSG_Pane *urlPane, const char *onlineMailboxName, + const char *hostName, XP_Bool deleteAllMsgs, const char *doomedKeyString); @@ -53,6 +55,9 @@ extern void MSG_InterruptImapFolderLoad(MSG_Pane *urlPane, const char *hostName, /* find a reference or NULL to the specified imap folder */ extern MSG_FolderInfo* MSG_FindImapFolder(MSG_Pane *urlPane, const char *hostName, const char *onlineFolderPath); +/* Used to kill connections after removing them from the cache so biff wont hang around them */ +extern void MSG_IMAP_KillConnection(TNavigatorImapConnection *imapConnection); + /* If there is a cached connection, for this folder, uncache it and return it */ extern TNavigatorImapConnection* MSG_UnCacheImapConnection(MSG_Master* master, const char *host, const char *folderName); @@ -71,6 +76,9 @@ extern void MSG_SetUserAuthenticated (MSG_Master* master, XP_Bool bAuthenticated extern XP_Bool MSG_IsUserAuthenticated (MSG_Master* master); extern void MSG_SetMailAccountURL(MSG_Master* master, const char *urlString); +extern void MSG_SetHostMailAccountURL(MSG_Master* master, const char *hostName, const char *urlString); +extern void MSG_SetHostManageListsURL(MSG_Master* master, const char *hostName, const char *urlString); +extern void MSG_SetHostManageFiltersURL(MSG_Master* master, const char *hostName, const char *urlString); extern const char *MSG_GetMailAccountURL(MSG_Master* master); @@ -103,8 +111,11 @@ extern const char *MSG_GetIMAPHostPassword(MSG_Master *master, const char *hostN extern void MSG_SetIMAPHostPassword(MSG_Master *master, const char *hostName, const char *password); extern int MSG_GetIMAPHostIsUsingSubscription(MSG_Master *master, const char *hostName, XP_Bool *usingSubscription); extern XP_Bool MSG_GetIMAPHostDeleteIsMoveToTrash(MSG_Master *master, const char *hostName); +extern MSG_FolderInfo *MSG_GetTrashFolderForHost(MSG_IMAPHost *host); extern int IMAP_AddIMAPHost(const char *hostName, XP_Bool usingSubscription, XP_Bool overrideNamespaces, - const char *personalNamespacePrefix, const char *publicNamespacePrefixes, const char *otherUsersNamespacePrefixes); + const char *personalNamespacePrefix, const char *publicNamespacePrefixes, + const char *otherUsersNamespacePrefixes, XP_Bool haveAdminUrl); +extern XP_Bool MSG_GetIMAPHostIsSecure(MSG_Master *master, const char *hostName); typedef enum { MSG_NotRunning = 0x00000000 @@ -145,6 +156,9 @@ extern MSG_Pane* MSG_GetParentPane(MSG_Pane* progresspane); /* do an imap biff of the imap inbox */ extern void MSG_ImapBiff(MWContext* context, MSG_Prefs* prefs); +extern MWContext *MSG_GetBiffContext(); + +extern void MSG_SetFolderAdminURL(MSG_Master *master, const char *hostName, const char*mailboxName, const char *url); /* The NNTP module of netlib calls these to feed XOVER data to the message library, in response to a news:group.name URL having been opened. @@ -485,6 +499,10 @@ extern int NET_parse_news_url (const char *url, extern char *MSG_GetArbitraryHeadersForHost(MSG_Master *master, const char *hostName); +/* Directory Server Replication + */ +extern XP_Bool NET_ReplicateDirectory(MSG_Pane *pane, DIR_Server *server); + XP_END_PROTOS diff --git a/mozilla/include/net.h b/mozilla/include/net.h index 644d39ba3c1..f068033b2d5 100644 --- a/mozilla/include/net.h +++ b/mozilla/include/net.h @@ -442,7 +442,17 @@ struct URL_Struct_ { load_background, /* Load in the "background". Suppress thermo, progress, etc. */ - mailto_post; /* is this a mailto: post? */ + mailto_post, /* is this a mailto: post? */ + allow_content_change, /* Set to TRUE if we are allowed to change the + content that it is displayed to the user. + Currently only used for IMAP partial fetches. */ + content_modified, /* TRUE if the content of this URL has been modified + internally. Used for IMAP partial fetches. */ + open_new_window_specified, /* TRUE if the invoker of the URL has specifically + set the open_new_window bit - otherwise, msg_GetURL + will clear it. */ + open_new_window; /* TRUE if the invoker of the URL wants a new window + to open */ #ifdef XP_CPLUSPLUS class MSG_Pane *msg_pane; #else @@ -577,6 +587,7 @@ typedef struct _cdata { Bool is_new; /* indicate if this is added by user via helper */ char* src_string; /* For output use */ + char* pref_name; /* If the mimetype came from preferences */ } NET_cdataStruct; @@ -672,6 +683,7 @@ typedef struct _mdata { #define SUN_ATTACHMENT "x-sun-attachment" #define TEXT_ENRICHED "text/enriched" +#define TEXT_CALENDAR "text/calendar" #define TEXT_HTML "text/html" #define TEXT_MDL "text/mdl" #define TEXT_PLAIN "text/plain" @@ -940,6 +952,15 @@ NET_ProxyAutoConfig(int fmt, void *data_obj, URL_Struct *URL_s, MWContext *w); */ extern void NET_SetMailRelayHost(char * host); + +/* Silly utility routine to send a message without user interaction. */ + +extern int +NET_SendMessageUnattended(MWContext* context, char* to, char* subject, + char* otherheaders, char* body); + + + /* add coordinates to the URL address * in the form url?x,y * @@ -1288,6 +1309,33 @@ extern int FE_StartAsyncDNSLookup(MWContext *context, char * host_port, void ** hoststruct_ptr_ptr, int sock); #endif +extern void NET_DownloadAutoAdminCfgFile(); + +#ifdef MOZ_LI + +/* LDAP METHOD IDs for URL_s->method */ +#define LDAP_SEARCH_METHOD 100 /* Address book search */ +#define LDAP_LI_SEARCH_METHOD 101 /* Get LDAPMessage* results from a LDAP URL to search */ +#define LDAP_LI_ADD_METHOD 102 /* Add an entry given LDAPMods */ +#define LDAP_LI_MOD_METHOD 103 /* Modify an entry given LDAPMods */ +#define LDAP_LI_DEL_METHOD 104 /* Delete an entry given the DN */ +#define LDAP_LI_PUTFILE_METHOD 105 /* Put a file into a given DN and attribute, given a local path */ +#define LDAP_LI_GETFILE_METHOD 106 /* Retreive an attribute into a local file, given DN and attribute */ +#define LDAP_LI_ADDGLM_METHOD 107 /* Add an entry, then return the result + * of a search for the modified entry's + * modifyTimeStamp attribute + */ +#define LDAP_LI_MODGLM_METHOD 108 /* Modify an entry, then return the result + * of a search for the modified entry's + * modifyTimeStamp attribute + */ +#define LDAP_LI_GETLASTMOD_METHOD 109 /* Return an entry's modifyTimeStamp attribute. + * Any attributes specified in the URL will be ignored + */ +#define LDAP_LI_BIND_METHOD 110 /* Bind as a particular user DN to an ldap server. + */ +#endif + /* * NET_GetURL is called to begin the transfer of a URL * @@ -1583,11 +1631,28 @@ extern void NET_CleanupFileFormat(char *filename); extern void NET_CleanupFileFormat(void); #endif +/* reads HTTP cookies from disk + * + * on entry pass in the name of the file to read + * + * returns 0 on success -1 on failure. + * + */ +extern int NET_ReadCookies(char * filename); + +/* removes all cookies structs from the cookie list */ +extern void +NET_RemoveAllCookies(); /* initialize the netlibrary */ extern int NET_InitNetLib(int socket_buffer_size, int max_number_of_connections); +/* +finish the netlib startup stuff - needed if li is on +*/ +extern void NET_FinishInitNetLib(); + /* reads a mailcap file and adds entries to the * external viewers converter list */ @@ -2038,6 +2103,9 @@ extern void NET_PlusToSpace(char *str); #define MARIMBA_TYPE_URL 37 #define INTERNAL_CERTLDAP_TYPE_URL 38 #define ADDRESS_BOOK_LDAP_TYPE_URL 39 +#define LDAP_REPLICATION_TYPE_URL 40 +#define LDAP_QUERY_DSE_TYPE_URL 41 +#define CALLBACK_TYPE_URL 42 #define LAST_URL_TYPE 40 /* defines the max number of URL types there are */ diff --git a/mozilla/include/np.h b/mozilla/include/np.h index 1d8a2b52008..70f5f349b74 100644 --- a/mozilla/include/np.h +++ b/mozilla/include/np.h @@ -18,7 +18,7 @@ /* - * np.h $Revision: 3.2 $ + * np.h $Revision: 3.3 $ * Prototypes for functions exported by libplugin and called by the FEs or other XP libs. * Prototypes for functions exported by the FEs and called by libplugin are in nppg.h. */ @@ -118,6 +118,10 @@ extern void NPL_Abort(NET_StreamClass *stream, int status); extern XP_Bool NPL_IsEmbedWindowed(NPEmbeddedApp *app); extern void NPL_URLExit(URL_Struct *urls, int status, MWContext *cx); +#ifdef XP_MAC +extern XP_Bool NPL_IsForcingRedraw(); +#endif + #ifdef ANTHRAX extern char** NPL_FindAppletsForType(const char* typeToFind); extern char* NPL_FindAppletEnabledForMimetype(const char* mimetype); diff --git a/mozilla/include/proto.h b/mozilla/include/proto.h index 0191e436ea6..db4289970ca 100644 --- a/mozilla/include/proto.h +++ b/mozilla/include/proto.h @@ -447,6 +447,14 @@ extern void XP_UpdateParentContext(MWContext * context); extern int XP_GetSecurityStatus(MWContext *pContext); extern int XP_ContextCount(MWContextType cxType, XP_Bool bTopLevel); +extern char *XP_PromptPassword(MWContext *pContext, const char *pMessage); +extern char *XP_Prompt(MWContext *pContext, const char *pMessage, const char * pDef); +extern PRBool XP_PromptUsernameAndPassword (MWContext * window_id, + const char * message, + char ** username, + char ** password); +extern PRBool XP_Confirm( MWContext * c, const char * msg); + XP_END_PROTOS # endif /* _PROTO_H_ */ diff --git a/mozilla/include/resdef.h b/mozilla/include/resdef.h index dcde283108b..24b0b9c4819 100644 --- a/mozilla/include/resdef.h +++ b/mozilla/include/resdef.h @@ -21,8 +21,11 @@ #include "xp_core.h" +#ifdef XP_MAC +#define RES_OFFSET 4000 +#else #define RES_OFFSET 7000 - +#endif #ifndef RESOURCE_STR diff --git a/mozilla/include/vobject.h b/mozilla/include/vobject.h index f06d48d8bde..4b6b69d1f5c 100644 --- a/mozilla/include/vobject.h +++ b/mozilla/include/vobject.h @@ -391,9 +391,9 @@ VObject* nextVObject(VObjectIterator *i); extern void printVObject(XP_File fp,VObject *o); void printVObject_(XP_File fp, VObject *o, int level); extern void writeVObject(XP_File fp, VObject *o); -void writeVObject_(OFile *fp, VObject *o, XP_Bool expandSpaces); +void writeVObject_(OFile *fp, VObject *o); char* writeMemVObject(char *s, int *len, VObject *o); -char* writeMemVObjects(char *s, int *len, VObject *list, XP_Bool expandSpaces); +char* writeMemVObjects(char *s, int *len, VObject *list); const char* lookupStr(const char *s); diff --git a/mozilla/include/xp_file.h b/mozilla/include/xp_file.h index 49507a721a3..82a6cf5cb56 100644 --- a/mozilla/include/xp_file.h +++ b/mozilla/include/xp_file.h @@ -90,9 +90,9 @@ Conversion: XP_FILE_NATIVE_PATH -> XP_FILE_URL_PATH Call: XP_PlatformFileToURL(name) - Example: Windows: XP_PlatformFileToURL("C:\tmp\myName") -> "C|/tmp/myName" - Unix: XP_PlatformFileToURL(/u/tmp/myName") -> "/u/tmp/myName" - Mac: XP_PlatformFileToURL("Mac HD:Temporary folder:myName") -> "Mac%20HD/Temporary%20folder/myName" + Example: Windows: XP_PlatformFileToURL("C:\tmp\myName") -> "file:///C|/tmp/myName" + Unix: XP_PlatformFileToURL(/u/tmp/myName") -> "file:///u/tmp/myName" + Mac: XP_PlatformFileToURL("Mac HD:Temporary folder:myName") -> "file:///Mac%20HD/Temporary%20folder/myName" You cannot convert anything into arbitrary TheXP_FileSpec, but you can use the XP_FILE_URL_PATH in combination with xpURL enum. @@ -257,7 +257,8 @@ typedef enum XP_FileType { xpHTTPSingleSignon, #endif xpLIClientDB, - xpLIPrefs + xpLIPrefs, + xpJSConfig /* Javascript 'jsc' config cache file */ } XP_FileType; diff --git a/mozilla/include/xp_help.h b/mozilla/include/xp_help.h index eb0d4d45789..843876d0738 100644 --- a/mozilla/include/xp_help.h +++ b/mozilla/include/xp_help.h @@ -157,6 +157,23 @@ NET_LoadNetHelpTopic(MWContext *pContext, const char *topic); #define HELP_HTML_MAIL_QUESTION "messengr:HTML_MAIL_QUESTION" #define HELP_HTML_MAIL_QUESTION_RECIPIENT "messengr:HTML_MAIL_QUESTION_RECIPIENT" +#ifdef MOZ_MAIL_NEWS +#define HELP_SEARCH_MAILNEWS_OPTIONS "messengr:SEARCH_MAILNEWS_OPTIONS" +#define HELP_SEARCH_MAILNEWS_HEADERS "messengr:SEARCH_MAILNEWS_HEADERS" +#define HELP_SEARCH_LDAP_BASIC "messengr:SEARCH_LDAP_BASIC" +#define HELP_SEARCH_LDAP_ADVANCED "messengr:SEARCH_LDAP_ADVANCED" +#define HELP_FILTER_RULES_ADVANCED "messengr:FILTER_RULES_ADVANCED" +#define HELP_MAIL_FOLDER_PROPERTIES_SHARING "messengr:MAIL_FOLDER_PROPERTIES_SHARING" +#define HELP_MAIL_FOLDER_PROPERTIES_DOWNLOAD "messengr:MAIL_FOLDER_PROPERTIES_DOWNLOAD" +#define HELP_MAILNEWS_SYNCHRONIZE "messengr:MAILNEWS_SYNCHRONIZE" +#define HELP_MAILNEWS_SELECT_ITEMS "messengr:MAILNEWS_SELECT_ITEMS" +#define HELP_MAILSERVER_PROPERTY_GENERAL "messengr:MAILSERVER_PROPERTY_GENERAL" +#define HELP_MAILSERVER_PROPERTY_POP "messengr:MAILSERVER_PROPERTY_POP" +#define HELP_MAILSERVER_PROPERTY_IMAP "messengr:MAILSERVER_PROPERTY_IMAP" +#define HELP_MAILSERVER_PROPERTY_ADVANCED "messengr:MAILSERVER_PROPERTY_ADVANCED" +#define HELP_IMAP_UPGRADE "messengr:IMAP_UPGRADE" +#endif + /* Main Preferences: Appearance */ #define HELP_PREFS_APPEARANCE "navigatr:PREFERENCES_APPEARANCE" @@ -177,6 +194,12 @@ NET_LoadNetHelpTopic(MWContext *pContext, const char *topic); #define HELP_PREFS_MAILNEWS_MAILSERVER "messengr:PREFERENCES_MAILNEWS_MAILSERVER" #define HELP_PREFS_MAILNEWS_GROUPSERVER "messengr:PREFERENCES_MAILNEWS_GROUPSERVER" #define HELP_PREFS_MAILNEWS_DIRECTORY "messengr:PREFERENCES_MAILNEWS_DIRECTORY" +#ifdef MOZ_MAIL_NEWS +#define HELP_PREFS_MAILNEWS_ADDRESSING "messengr:PREFERENCES_MAILNEWS_ADDRESSING" +#define HELP_PREFS_MAILNEWS_COPIES "messengr:PREFERENCES_MAILNEWS_COPIES" +#define HELP_PREFS_MAILNEWS_FORMATTING "messengr:PREFERENCES_MAILNEWS_FORMATTING" +#define HELP_PREFS_MAILNEWS_RECEIPTS "messengr:PREFERENCES_MAILNEWS_RECEIPTS" +#endif #define HELP_MAILNEWS_EDIT_CARD "messengr:MAILNEWS_EDIT_CARD" #define HELP_MAILNEWS_EDIT_CARD_NAME_TAB "messengr:ADD_USER_PROPERTIES" #define HELP_MAILNEWS_EDIT_CARD_CONTACT_TAB "messengr:ADD_USER_CONTACT" diff --git a/mozilla/include/xp_mem.h b/mozilla/include/xp_mem.h index 6c73b389518..019d6a9fe30 100644 --- a/mozilla/include/xp_mem.h +++ b/mozilla/include/xp_mem.h @@ -71,19 +71,10 @@ XP_END_PROTOS #define XP_ALLOC(size) WIN16_malloc(size) #else -#if defined(DEBUG) && defined(MOZILLA_CLIENT) -/* Check that we never allocate anything greater than 64K. If we ever tried, - Win16 would choke, and we'd like to find out about it on some other platform - (like, one where we have a working debugger). */ -/* This code used to call abort. Unfortunately, on Windows, abort() doesn't - * go to the debugger. Instead, it silently quits the program. - * So use XP_ASSERT(FALSE) instead. - */ - -#define XP_CHECK_ALLOC_SIZE(size) ((size) <= 0xFFFF ? size : (XP_ASSERT(FALSE), (size))) -#else +/* this used to check for < 64K for win16, but we don't need it anymore! + I'll leave the define in case someone else has another check they want to try. +*/ #define XP_CHECK_ALLOC_SIZE(size) size -#endif #define XP_REALLOC(ptr, size) realloc(ptr, XP_CHECK_ALLOC_SIZE(size)) #define XP_ALLOC(size) malloc(XP_CHECK_ALLOC_SIZE(size)) diff --git a/mozilla/js/jsj/jsStubs.c b/mozilla/js/jsj/jsStubs.c index 370b6a3bdc2..8e6ef9672cf 100644 --- a/mozilla/js/jsj/jsStubs.c +++ b/mozilla/js/jsj/jsStubs.c @@ -32,6 +32,7 @@ #include "prthread.h" #include "prlog.h" +#ifdef JAVA #define IMPLEMENT_netscape_javascript_JSObject #include "netscape_javascript_JSObject.h" #ifndef XP_MAC @@ -39,6 +40,7 @@ #else #include "n_javascript_JSException.h" #endif +#endif #ifdef NSPR20 diff --git a/mozilla/lib/layout/editor.cpp b/mozilla/lib/layout/editor.cpp index 96a0e7f1295..a08c8749ceb 100644 --- a/mozilla/lib/layout/editor.cpp +++ b/mozilla/lib/layout/editor.cpp @@ -24,6 +24,7 @@ #ifdef EDITOR #include "editor.h" +#include "rosetta.h" #include "fsfile.h" // For XP Strings @@ -678,8 +679,10 @@ ED_FileError EDT_PublishFile( MWContext * pContext, if( bSavePassword ){ // PROBLEM: If password was wrong, user may have // enterred it in prompted dialog, but we dont know that one! - PREF_SetCharPref("editor.publish_last_pass",SECNAV_MungeString(pPassword)); + char * pass = HG99875(pPassword); + PREF_SetCharPref("editor.publish_last_pass",pass); PREF_SetBoolPref("editor.publish_save_password",TRUE); + XP_FREE(pass); } else { PREF_SetBoolPref("editor.publish_save_password",FALSE); } diff --git a/mozilla/lib/layout/edtutil.cpp b/mozilla/lib/layout/edtutil.cpp index 3dfbd032ba2..b7211cbf32d 100644 --- a/mozilla/lib/layout/edtutil.cpp +++ b/mozilla/lib/layout/edtutil.cpp @@ -24,6 +24,7 @@ #ifdef EDITOR #include "editor.h" +#include "rosetta.h" typedef struct PA_AmpEsc_struct { char *str; @@ -5547,7 +5548,7 @@ char * EDT_GetDefaultPublishURL(MWContext * pMWContext, char **ppFilename, char } if( pPassword && *pPassword ){ - *ppPassword = SECNAV_UnMungeString(pPassword); + *ppPassword = HG99879(pPassword); XP_FREE(pPassword); } } @@ -5596,7 +5597,7 @@ EDT_GetPublishingHistory(unsigned n, XP_SPRINTF(prefname, "editor.publish_password_%d", n); if (PREF_CopyCharPref(prefname, &prefvalue) != -1 && prefvalue && *prefvalue) { - *password_r = SECNAV_UnMungeString(prefvalue); + *password_r = HG99879(prefvalue); } else { *password_r = NULL; } diff --git a/mozilla/lib/layout/layrelay.c b/mozilla/lib/layout/layrelay.c index d29c7f89e5c..44779ec85f3 100644 --- a/mozilla/lib/layout/layrelay.c +++ b/mozilla/lib/layout/layrelay.c @@ -527,14 +527,14 @@ lo_rl_InitDocState( MWContext *context, lo_DocState *state, int32 width, int32 h state->list_stack = lo_DefaultList(state); if (state->list_stack == NULL) { - /* +#if 0 XP_FREE_BLOCK(state->line_array); #ifdef XP_WIN16 XP_FREE_BLOCK(state->larray_array); -#endif /* XP_WIN16 */ - /* +#endif /* XP_WIN16 */ + XP_DELETE(state->font_stack); - */ +#endif return(NULL); } diff --git a/mozilla/lib/layout/laytable.c b/mozilla/lib/layout/laytable.c index 3b72fed47a3..40e4c90e52a 100644 --- a/mozilla/lib/layout/laytable.c +++ b/mozilla/lib/layout/laytable.c @@ -2925,7 +2925,7 @@ lo_RelayoutCaptionSubdoc(MWContext *context, lo_DocState *state, lo_TableCaption lo_cleanup_state(context, old_state); */ -#if 0 /* Doesn't need to happen any more because we do non-destructive reflow +#if 0 /* Doesn't need to happen any more because we do non-destructive reflow */ /* * Save our parent's state levels */ @@ -5179,7 +5179,7 @@ lo_BeginTableAttributes(MWContext *context, table->backdrop.url = NULL; table->backdrop.tile_mode = LO_TILE_BOTH; - /* Copied to lo_InitTableRecord() + /* Copied to lo_InitTableRecord() */ /* table->rows = 0; table->cols = 0; diff --git a/mozilla/lib/libi18n/Makefile b/mozilla/lib/libi18n/Makefile index c29068b0ff9..464e4ec3351 100644 --- a/mozilla/lib/libi18n/Makefile +++ b/mozilla/lib/libi18n/Makefile @@ -57,6 +57,7 @@ CSRCS = autokr.c \ dblower.c \ kinsokud.c \ kinsokuf.c \ + katakana.c \ $(NULL) REQUIRES = i18n dbm nspr img util layer pref js diff --git a/mozilla/lib/libi18n/doc_ccc.c b/mozilla/lib/libi18n/doc_ccc.c index 0ed7c32b49d..f6876bd8063 100644 --- a/mozilla/lib/libi18n/doc_ccc.c +++ b/mozilla/lib/libi18n/doc_ccc.c @@ -21,6 +21,7 @@ #include "xp.h" #include "intl_csi.h" #include "libi18n.h" +#include "katakana.h" int16 PeekMetaCharsetTag (char *, uint32); @@ -277,6 +278,9 @@ INTL_CreateDocToMailConverter(iDocumentContext context, XP_Bool isHTML, unsigned { CCCDataObject selfObj; int16 p_doc_csid = CS_DEFAULT; +#if defined(MOZ_MAIL_NEWS) + int16 mail_news_csid; +#endif CCCFunc cvtfunc; INTL_CharSetInfo c = LO_GetDocumentCharacterSetInfo(context); @@ -368,6 +372,10 @@ INTL_CreateDocToMailConverter(iDocumentContext context, XP_Bool isHTML, unsigned } } } +#if defined(MOZ_MAIL_NEWS) + mail_news_csid = (intl_message_to_newsgroup ? INTL_DefaultNewsCharSetID(p_doc_csid) : + INTL_DefaultMailCharSetID(p_doc_csid)); +#endif /* Now, we get the converter */ (void) INTL_GetCharCodeConverter(p_doc_csid, #ifdef MOZ_MAIL_NEWS @@ -378,6 +386,17 @@ INTL_CreateDocToMailConverter(iDocumentContext context, XP_Bool isHTML, unsigned INTL_DefaultMailCharSetID(p_doc_csid), #endif /* MOZ_MAIL_NEWS */ selfObj); +#if defined(MOZ_MAIL_NEWS) + /* If we sending JIS then listen the pref setting and decide if we convert + * hankaku (1byte) to zenkaku (2byte) kana. The flag to be checked in + * euc2jis and sjis2jis. + */ + if (CS_JIS == mail_news_csid && INTL_GetSendHankakuKana()) + { + INTL_SetCCCCvtflag_SendHankakuKana(selfObj, TRUE); + } +#endif + /* If the cvtfunc == NULL, we don't need to do conversion */ cvtfunc = INTL_GetCCCCvtfunc(selfObj); if(! (cvtfunc) ) diff --git a/mozilla/lib/libi18n/euc2jis.c b/mozilla/lib/libi18n/euc2jis.c index 153d9fcf425..1b644c71b51 100644 --- a/mozilla/lib/libi18n/euc2jis.c +++ b/mozilla/lib/libi18n/euc2jis.c @@ -18,7 +18,7 @@ /* euc2jis.c */ #include "intlpriv.h" -#ifdef XP_MAC +#if defined(MOZ_MAIL_NEWS) #include "katakana.h" #endif @@ -80,9 +80,9 @@ mz_euc2jis( CCCDataObject obj, register unsigned char *tobufep, *eucep; /* end of buffers */ int32 uncvtlen; unsigned char *uncvtbuf = INTL_GetCCCUncvtbuf(obj); -#ifdef FEATURE_KATAKANA - unsigned char outbuf[2]; /* for 1 byte katakana */ - uint32 byteused; /* for 1 byte katakana */ +#if defined(MOZ_MAIL_NEWS) + unsigned char kanabuf[4]; /* for half-width kana */ + uint32 byteused; /* for half-width kana */ #endif /* Allocate a dest buffer: */ @@ -130,20 +130,26 @@ WHILELOOP: } *tobufp++ = *eucp++; } else if (*eucp == SS2) { /* Half-width Katakana */ -#ifdef FEATURE_KATAKANA if (eucp+1 > eucep) /* No 2nd byte in EUC buffer? */ break; - if (INTL_GetCCCJismode(obj) != JIS_208_83) { - Ins208_83_ESC(tobufp, obj); +#if defined(MOZ_MAIL_NEWS) + if (!INTL_GetCCCCvtflag_SendHankakuKana(obj)) { + if (INTL_GetCCCJismode(obj) != JIS_208_83) { + Ins208_83_ESC(tobufp, obj); + } + INTL_SjisHalf2FullKana(eucp, (uint32)eucep - (uint32)eucp + 1, kanabuf, &byteused); + *tobufp++ = kanabuf[0] & 0x7F; + *tobufp++ = kanabuf[1] & 0x7F; + eucp += byteused; + } else { + if (INTL_GetCCCJismode(obj) != JIS_HalfKana) { + InsHalfKana_ESC(tobufp, obj); + } + eucp++; /* skip SS2 */ + *tobufp++ = *eucp & 0x7F; + eucp++; } - eucp++; /* skip SS2 */ - INTL_EucHalf2FullKana(eucp, (uint32)eucep - (uint32)eucp + 1, outbuf, &byteused); - *tobufp++ = outbuf[0] & 0x7F; - *tobufp++ = outbuf[1] & 0x7F; - eucp += byteused; #else - if (eucp+1 > eucep) /* No 2nd byte in EUC buffer? */ - break; if (INTL_GetCCCJismode(obj) != JIS_HalfKana) { InsHalfKana_ESC(tobufp, obj); } diff --git a/mozilla/lib/libi18n/fe_ccc.c b/mozilla/lib/libi18n/fe_ccc.c index 27d3bab3507..015109d23c3 100644 --- a/mozilla/lib/libi18n/fe_ccc.c +++ b/mozilla/lib/libi18n/fe_ccc.c @@ -78,6 +78,8 @@ PRIVATE int16 intl_CharLen_SingleByte(unsigned char ch); #define INTL_CHARLEN_CNS_8BIT 3 #define INTL_CHARLEN_UTF8 4 #define INTL_CHARLEN_SINGLEBYTE 5 +/* a conversion flag for JIS, set if converting hankaku (1byte) kana to zenkaku (2byte) */ +#define INTL_SEND_HANKAKU_KANA 128 PRIVATE intl_CharLenFunc intl_char_len_func[]= { @@ -1193,3 +1195,26 @@ int INTL_MenuFontID() { } #endif /* XP_OS2 */ + + +#if defined(MOZ_MAIL_NEWS) +/* + * Access a conversion flag for hankaku->zenkaku kana conversion for mail. + */ +XP_Bool INTL_GetCCCCvtflag_SendHankakuKana(CCCDataObject obj) +{ + return ((CS_JIS == (INTL_GetCCCToCSID(obj) & ~CS_AUTO)) && + (INTL_SEND_HANKAKU_KANA & INTL_GetCCCCvtflag(obj))); +} + +void INTL_SetCCCCvtflag_SendHankakuKana(CCCDataObject obj, XP_Bool flag) +{ + int32 cvtflag; + if (CS_JIS == (INTL_GetCCCToCSID(obj) & ~CS_AUTO)) + { + cvtflag = INTL_GetCCCCvtflag(obj); + cvtflag = flag ? (INTL_SEND_HANKAKU_KANA | cvtflag) : (~INTL_SEND_HANKAKU_KANA & cvtflag); + INTL_SetCCCCvtflag(obj, cvtflag); + } +} +#endif /* MOZ_MAIL_NEWS */ diff --git a/mozilla/lib/libi18n/intlcomp.c b/mozilla/lib/libi18n/intlcomp.c index c94e7666dec..cd1e7bb6fc1 100644 --- a/mozilla/lib/libi18n/intlcomp.c +++ b/mozilla/lib/libi18n/intlcomp.c @@ -25,6 +25,9 @@ */ #include "intlpriv.h" #include "pintlcmp.h" +#if defined(XP_MAC) +#include +#endif #define CHECK_CSID_AND_ASSERT(csid) \ { \ @@ -373,6 +376,259 @@ PUBLIC XP_Bool INTL_StrEndWith( } +#ifdef MOZ_MAIL_NEWS + + +#if defined(XP_WIN32) +/* + * Set locale to the system default locale. + */ +static char *system_default_locale_string = NULL; +static void SetLocaleToSystemDefaultLocale(void) +{ + char *str; + + if (system_default_locale_string == NULL) + { + if (system_default_locale_string = (char *) malloc(128)) + GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SENGLANGUAGE, system_default_locale_string, 128); + } + str = setlocale(LC_COLLATE, system_default_locale_string); +} +#endif /* XP_WIN32 */ + +#if defined(XP_WIN32) +static char *FEINTL_CreateCollationKeyUsingOS(const char *in_string, int16 wincsid) +{ + char *out_string = NULL; + size_t tmp_len; + + /* Currently only supports Latin1. */ + if (wincsid != CS_ASCII && wincsid != CS_LATIN1 && wincsid != CS_DEFAULT) + return NULL; + + /* Prepare a larger buffer for a sort key. */ + tmp_len = XP_STRLEN(in_string)*4; + + /* Set up the system defualt locale */ + SetLocaleToSystemDefaultLocale(); + + if (out_string = (unsigned char *) XP_ALLOC(tmp_len)) + { + size_t rt; + *out_string = '\0'; + rt = strxfrm(out_string, in_string, tmp_len); + + /* Realloc the buffer if it's smaller and try again. */ + if (rt > tmp_len) + { + tmp_len = rt; + if (out_string = (unsigned char *) XP_REALLOC((void *) out_string, tmp_len)) + rt = strxfrm(out_string, in_string, tmp_len); + } + + /* Return the output of strxfrm if success. */ + if (rt != (size_t)-1 && *out_string) + out_string = out_string; + else + XP_FREEIF(out_string); + } + + return out_string; +} +#endif /* XP_WIN32 */ +#if defined(XP_MAC) +static char *FEINTL_CreateCollationKeyUsingOS(const char *in_string, int16 wincsid) +{ + char *out_string = NULL; + char *temp_string; + int in_string_len = XP_STRLEN(in_string); + int i; + + /* Currently only supports Latin1. */ + if (wincsid != CS_ASCII && wincsid != CS_LATIN1 && wincsid != CS_DEFAULT) + return NULL; + + /* INTL_ConvertLineWithoutAutoDetect may alter input string. */ + temp_string = XP_STRDUP(in_string); + if (temp_string != NULL) + { + /* Convert to MacRoman. */ + out_string = (char *) INTL_ConvertLineWithoutAutoDetect (wincsid, CS_MAC_ROMAN, (unsigned char *) temp_string, in_string_len); + /* Set the converted string if conversion was applied and the input string was not altered. */ + if (out_string != NULL && out_string != temp_string) + { + XP_FREE(temp_string); + temp_string = out_string; + } + out_string = (char *) XP_ALLOC(in_string_len * 2 + 1); + if (out_string != NULL) + { + /* Copy original string. */ + for (i = 0; i < in_string_len; i++) + out_string[i*2+1] = temp_string[i]; + UppercaseStripDiacritics(temp_string, in_string_len, FontToScript(1)); + /* Copy uppercased string. */ + for (i = 0; i < in_string_len; i++) + out_string[i*2] = temp_string[i]; + /* Terminate the string. */ + out_string[in_string_len * 2] = '\0'; + } + XP_FREE(temp_string); + } + + return out_string; +} +#endif /* XP_MAC */ +#if defined(XP_UNIX) +static char *FEINTL_CreateCollationKeyUsingOS(const char *in_string, int16 wincsid) +{ + return NULL; +} +#endif /* XP_UNIX */ + +static char *INTL_CreateCollationKeyUsingOS(const char *in_string, int16 wincsid) +{ + char *out_string; + unsigned char *tmp; + + /* Create a collatable string */ + if (INTL_CharSetType(wincsid) == SINGLEBYTE) + { + /* Front End call to create a collation key. */ + out_string = FEINTL_CreateCollationKeyUsingOS(in_string, wincsid); + if (out_string) + return out_string; + + /* Otherwise just lowercase the string. */ + out_string = XP_STRDUP(in_string); + tmp = (unsigned char *) out_string; + while (*tmp) + { + *tmp = (unsigned char) XP_TO_LOWER((int)*tmp); + tmp++; + } + } + else if (wincsid & MULTIBYTE) + { + out_string = XP_STRDUP(in_string); + tmp = (unsigned char *) out_string; + while (*tmp) + { + /* Lower case for Ascii */ + if (*tmp < 128) + { + *tmp = (unsigned char) XP_TO_LOWER((int)*tmp); + tmp++; + } + else + { + int bytes = INTL_CharLen(wincsid, tmp); + /* ShiftJIS specific, shift hankaku kana in front of zenkaku. */ + if (wincsid == CS_SJIS) + { + if (*tmp >= 0xA0 && *tmp < 0xE0) + { + *tmp -= (0xA0 - 0x81); + } + else if (*tmp >= 0x81 && *tmp < 0xA0) + { + *tmp += (0xA0 - 0x81); + } + } + tmp += bytes; + } + } + } + + return out_string; +} + +#if defined(LIBNLS_COLLATE) +static Collation *collation = NULL; +static char *INTL_CreateCollationKeyUsingLibNLS(const char *in_string, int16 wincsid) +{ + return NULL; +} +#endif /* LIBNLS_COLLATE */ + +/* + * Create a collation key using default system locale. + */ +PUBLIC char *INTL_CreateCollationKeyByDefaultLocale(const char *in_string, int16 wincsid, int32 collation_flag) +{ + char *out_string; + + /* For future enhancement */ + collation_flag = 0; + + /* CS_DEFAULT is not accepted by i18n unicode converter. + * In future, this should be taken care by the caller. + */ + if (CS_DEFAULT == wincsid) + wincsid = CS_LATIN1; + + /* Create a collation key. */ +#if defined(LIBNLS_COLLATE) + out_string = INTL_CreateCollationKeyUsingLibNLS(in_string); +#else + out_string = INTL_CreateCollationKeyUsingOS(in_string, wincsid); +#endif + + return out_string; +} + +/* + * Compare two collation keys. + */ +PUBLIC int INTL_Compare_CollationKey(const char *key1, const char *key2) +{ + return XP_MEMCMP((const void *) key1, (const void *) key2, XP_STRLEN(key1)); +} + +/* + * Decode, convert and create a message header. Then create and return a collatable string. + */ +PUBLIC char *INTL_DecodeMimePartIIAndCreateCollationKey(const char *header, int16 wincsid, int32 collation_flag) +{ + char *temp_string; + char *decoded_string; + char *out_string; + + /* For future enhancement */ + collation_flag = 0; + + /* Allocate the temp string because INTL_DecodeMimePartIIStr may alter input string. */ + temp_string = XP_STRDUP(header); + if (temp_string == NULL) + return NULL; + + /* Decode and Convert */ + decoded_string = INTL_DecodeMimePartIIStr(temp_string, wincsid, FALSE); + + /* Free the temp string. */ + if (decoded_string != temp_string) + XP_FREE(temp_string); + /* No decode or conversion done, allocate for out string. */ + if (decoded_string == NULL) + decoded_string = XP_STRDUP(header); + if (decoded_string == NULL) + return NULL; + + /* Create a collation key. */ + out_string = INTL_CreateCollationKeyByDefaultLocale(decoded_string, wincsid, collation_flag); + + /* Return decoded string in case no collation key created. */ + if (out_string != NULL) + XP_FREE(decoded_string); + else + out_string = decoded_string; + + + return out_string; +} + +#endif /* MOZ_MAIL_NEWS */ diff --git a/mozilla/lib/libi18n/intlpriv.h b/mozilla/lib/libi18n/intlpriv.h index 20d018af975..4cbb99c5526 100644 --- a/mozilla/lib/libi18n/intlpriv.h +++ b/mozilla/lib/libi18n/intlpriv.h @@ -303,6 +303,31 @@ int16 FE_WinCSID(iDocumentContext ); int16 *intl_GetFontCharSets(void); +/** + * Access a conversion flag for hankaku->zenkaku kana conversion for mail. + * + * The conversion flag for JIS, set if converting hankaku (1byte) kana to zenkaku (2byte). + * The flag is needed in order to control the conversion. Kana conversion should be applied + * only when sending a mail and converters do not know if they are called for mail sending. + * + * @param obj Character code converter. + * @return TRUE if convert to zenkaku (2byte). + * @see INTL_SetCCCCvtflag_SendHankakuKana + */ +MODULE_PRIVATE XP_Bool INTL_GetCCCCvtflag_SendHankakuKana(CCCDataObject obj); +/** + * Access a conversion flag for hankaku->zenkaku kana conversion for mail. + * + * The conversion flag for JIS, set if converting hankaku (1byte) kana to zenkaku (2byte). + * The flag is needed in order to control the conversion. Kana conversion should be applied + * only when sending a mail and converters do not know if they are called for mail sending. + * + * @param obj Character code converter. + * @see INTL_GetCCCCvtflag_SendHankakuKana + */ +MODULE_PRIVATE void INTL_SetCCCCvtflag_SendHankakuKana(CCCDataObject obj, XP_Bool flag); + + XP_END_PROTOS diff --git a/mozilla/lib/libi18n/katakana.c b/mozilla/lib/libi18n/katakana.c index 28ed09f4acb..7294beb7abc 100644 --- a/mozilla/lib/libi18n/katakana.c +++ b/mozilla/lib/libi18n/katakana.c @@ -16,6 +16,137 @@ * Reserved. */ -#ifdef FEATURE_KATAKANA -#include "katakana.i" -#endif +/* + * katakana.c + * + * Half- to Full-width Katakana Conversion for SJIS and EUC. + * based on the book of Ken Lunde + * (Understanding Japanese Information Processing, Published by O'Reilly; 09/1993; ISBN: 1565920430). +*/ + + +#if defined(MOZ_MAIL_NEWS) + +#include "intlpriv.h" +#include "prefapi.h" +#include "katakana.h" + +#define ISMARU(A) (A >= 202 && A <= 206) +#define ISNIGORI(A) ((A >= 182 && A <= 196) || (A >= 202 && A <= 206) || (A == 179)) +#define HANKATA(c) (c >= 161 && c <= 223) /* 0xa1 - 0xdf */ + +/* pref related prototype and variables */ +PUBLIC int PR_CALLBACK intl_SetSendHankakuKana(const char * newpref, void * data); + +static XP_Bool pref_callback_installed = FALSE; +static XP_Bool send_hankaku_kana = FALSE; +static const char *pref_send_hankaku_kana = "mailnews.send_hankaku_kana"; + + +static void han2zen(XP_Bool insjis, unsigned char *inbuf, uint32 inlen, + unsigned char *outbuf, XP_Bool *composite) +{ + unsigned char c1 = *inbuf++; + unsigned char c2; + unsigned char tmp = c1; + unsigned char junk; + XP_Bool maru = FALSE; + XP_Bool nigori = FALSE; + unsigned char mtable[][2] = { + {129,66},{129,117},{129,118},{129,65},{129,69},{131,146},{131,64}, + {131,66},{131,68},{131,70},{131,72},{131,131},{131,133},{131,135}, + {131,98},{129,91},{131,65},{131,67},{131,69},{131,71},{131,73}, + {131,74},{131,76},{131,78},{131,80},{131,82},{131,84},{131,86}, + {131,88},{131,90},{131,92},{131,94},{131,96},{131,99},{131,101}, + {131,103},{131,105},{131,106},{131,107},{131,108},{131,109}, + {131,110},{131,113},{131,116},{131,119},{131,122},{131,125}, + {131,126},{131,128},{131,129},{131,130},{131,132},{131,134}, + {131,136},{131,137},{131,138},{131,139},{131,140},{131,141}, + {131,143},{131,147},{131,74},{129,75} + }; + + if (inlen > 1) + { + if (insjis) + { + c2 = *inbuf; + if (c2 == 222 && ISNIGORI(c1)) + nigori = TRUE; + if (c2 == 223 && ISMARU(c1)) + maru = TRUE; + } + else /* EUC */ + { + junk = *inbuf++; + c2 = *inbuf; + if (junk == SS2) /* If the variable junk is SS2, we have another half- + width katakana. */ + { + if (c2 == 222 && ISNIGORI(c1)) + nigori = TRUE; + if (c2 == 223 && ISMARU(c1)) + maru = TRUE; + } + } + } + if (HANKATA(tmp)) /* Check to see if tmp is in half-width katakana range. */ + { + c1 = mtable[tmp - 161][0]; /* Calculate first byte using mapping table */ + c2 = mtable[tmp - 161][1]; /* Calculate second byte using mapping table */ + } + if (nigori) + { + if ((c2 >= 74 && c2 <= 103) || (c2 >= 110 && c2 <= 122)) + c2++; + else if (c1 == 131 && c2 == 69) + c2 = 148; + } + else if (maru && c2 >= 110 && c2 <= 122) + c2 += 2; + + *outbuf++ = c1; + *outbuf = c2; + *composite = maru || nigori; +} + +/* + * Half to full Katakana conversion for SJIS. Caller need to allocate outbuf (x2 of inbuf). + */ +MODULE_PRIVATE void INTL_SjisHalf2FullKana(unsigned char *inbuf, uint32 inlen, unsigned char *outbuf, uint32 *byteused) +{ + XP_Bool composite; + + han2zen(TRUE, inbuf, inlen, outbuf, &composite); + *byteused = composite ? 2 : 1; +} + +/* + * Half to full Katakana conversion for EUC. Caller need to allocate outbuf (x3 of inbuf). + */ +MODULE_PRIVATE void INTL_EucHalf2FullKana(unsigned char *inbuf, uint32 inlen, unsigned char *outbuf, uint32 *byteused) +{ + XP_Bool composite; + + han2zen(FALSE, inbuf, inlen, outbuf, &composite); + *byteused = composite ? 3 : 1; /* 2 chars plus SS2 or 1 char */ +} + +/* callback routine invoked by prefapi when the pref value changes */ +PUBLIC int PR_CALLBACK intl_SetSendHankakuKana(const char * newpref, void * data) +{ + return PREF_GetBoolPref(pref_send_hankaku_kana, &send_hankaku_kana); +} + +MODULE_PRIVATE XP_Bool INTL_GetSendHankakuKana() +{ + if (!pref_callback_installed) + { + PREF_GetBoolPref(pref_send_hankaku_kana, &send_hankaku_kana); + PREF_RegisterCallback(pref_send_hankaku_kana, intl_SetSendHankakuKana, NULL); + pref_callback_installed = TRUE; + } + + return send_hankaku_kana; +} + +#endif /* MOZ_MAIL_NEWS */ diff --git a/mozilla/lib/libi18n/katakana.h b/mozilla/lib/libi18n/katakana.h index 798bb99d503..446dfb21fb3 100644 --- a/mozilla/lib/libi18n/katakana.h +++ b/mozilla/lib/libi18n/katakana.h @@ -23,5 +23,6 @@ MODULE_PRIVATE void INTL_SjisHalf2FullKana(unsigned char *inbuf, uint32 inlen, unsigned char *outbuf, uint32 *byteused); MODULE_PRIVATE void INTL_EucHalf2FullKana(unsigned char *inbuf, uint32 inlen, unsigned char *outbuf, uint32 *byteused); +MODULE_PRIVATE XP_Bool INTL_GetSendHankakuKana(void); #endif /* KATAKANA_H */ diff --git a/mozilla/lib/libi18n/mime2fun.c b/mozilla/lib/libi18n/mime2fun.c index a0b2acb64ed..63d8b69389e 100644 --- a/mozilla/lib/libi18n/mime2fun.c +++ b/mozilla/lib/libi18n/mime2fun.c @@ -162,8 +162,6 @@ PUBLIC int16 INTL_DefaultMailCharSetID(int16 csid) intlmime_init_csidmap(); retcsid = intlmime_map_csid(cs_mime_csidmap_tbl, csid); - if(retcsid == CS_KSC_8BIT) - retcsid = CS_2022_KR; return retcsid; } @@ -173,6 +171,8 @@ PUBLIC int16 INTL_DefaultNewsCharSetID(int16 csid) if (csid == 0) csid = INTL_DefaultDocCharSetID(0); csid &= ~CS_AUTO; + if (csid == CS_KSC_8BIT) + return CS_KSC_8BIT; intlmime_init_csidmap(); return intlmime_map_csid(cs_mime_csidmap_tbl, csid); } @@ -226,24 +226,6 @@ PRIVATE void intlmime_update_csidmap(int16 csid_key, int16 csid_target) mapp->csid_target = csid_target; } } - -#if 0 -/* callback routine invoked by prefapi when the pref value changes */ -MODULE_PRIVATE -int PR_CALLBACK intlmime_get_mail_strictly_mime(const char * newpref, void * data) -{ - XP_Bool mail_strictly_mime = FALSE; - - if (PREF_NOERROR == PREF_GetBoolPref("mail.strictly_mime", &mail_strictly_mime)) - { - intlmime_update_csidmap(CS_UTF8, mail_strictly_mime ? CS_UTF7 : CS_UTF8); - intlmime_update_csidmap(CS_UCS2, mail_strictly_mime ? CS_UTF7 : CS_UTF8); - intlmime_update_csidmap(CS_UCS2_SWAP, mail_strictly_mime ? CS_UTF7 : CS_UTF8); - } - - return PREF_NOERROR; -} -#endif #endif /* MOZ_MAIL_NEWS */ #if defined(MOZ_MAIL_COMPOSE) || defined(MOZ_MAIL_NEWS) @@ -254,53 +236,39 @@ intlmime_init_csidmap() if(initialized) return; - -#if 0 /* UTF-8 is sent as UTF-8 regardless of the pref setting. */ - { - XP_Bool mail_strictly_mime; - /* modify csidmap for UTF-8 if the pref is not strictly mime */ - if (PREF_NOERROR == PREF_GetBoolPref("mail.strictly_mime", &mail_strictly_mime)) - { - intlmime_update_csidmap(CS_UTF8, mail_strictly_mime ? CS_UTF7 : CS_UTF8); - intlmime_update_csidmap(CS_UCS2, mail_strictly_mime ? CS_UTF7 : CS_UTF8); - intlmime_update_csidmap(CS_UCS2_SWAP, mail_strictly_mime ? CS_UTF7 : CS_UTF8); - /* to detect pref change */ - PREF_RegisterCallback("mail.strictly_mime", intlmime_get_mail_strictly_mime, NULL); - } - } -#endif /* Speical Hack for Cyrllic */ /* We need to know wheater we should send KOI8-R or ISO-8859-5 */ { - cs_csid_map_t * mapp; static const char* pref_mailcharset_cyrillic = "intl.mailcharset.cyrillic"; - char *mailcharset_cyrillic = NULL; - int16 mailcsid_cyrillic = CS_UNKNOWN; + static const char* pref_mailcharset_korean = "intl.mailcharset.korean"; + char *mailcharset_pref = NULL; + int16 mailcsid_pref = CS_UNKNOWN; if( PREF_NOERROR == PREF_CopyCharPref(pref_mailcharset_cyrillic, - &mailcharset_cyrillic)) + &mailcharset_pref)) { - mailcsid_cyrillic = INTL_CharSetNameToID(mailcharset_cyrillic); - XP_FREE(mailcharset_cyrillic); + mailcsid_pref = INTL_CharSetNameToID(mailcharset_pref); + XP_FREE(mailcharset_pref); - if(CS_UNKNOWN != mailcsid_cyrillic) + if(CS_UNKNOWN != mailcsid_pref) { - for(mapp = cs_mime_csidmap_tbl ; - mapp->csid_key != 0 ; - mapp++) - { - if ( - (mapp->csid_key == CS_KOI8_R) || - (mapp->csid_key == CS_8859_5) || - (mapp->csid_key == CS_MAC_CYRILLIC) || - (mapp->csid_key == CS_CP_1251) - ) - { - mapp->csid_target = mailcsid_cyrillic; - } - } + intlmime_update_csidmap(CS_KOI8_R, mailcsid_pref); + intlmime_update_csidmap(CS_8859_5, mailcsid_pref); + intlmime_update_csidmap(CS_MAC_CYRILLIC, mailcsid_pref); + intlmime_update_csidmap(CS_CP_1251, mailcsid_pref); + } + } + if( PREF_NOERROR == PREF_CopyCharPref(pref_mailcharset_korean, + &mailcharset_pref)) + { + mailcsid_pref = INTL_CharSetNameToID(mailcharset_pref); + XP_FREE(mailcharset_pref); + + if(CS_UNKNOWN != mailcsid_pref) + { + intlmime_update_csidmap(CS_KSC_8BIT, mailcsid_pref); } } } @@ -556,6 +524,9 @@ PRIVATE XP_Bool intlmime_is_mime_part2_header(const char *header) } extern char *strip_continuations(char *original); +extern unsigned char *XP_WordWrapWithPrefix(int charset, unsigned char *str, + int maxColumn, int checkQuoting, + const char *prefix, int addCRLF); PRIVATE char *intl_decode_mime_part2_str(const char *header, int wincsid, XP_Bool dontConvert) @@ -1045,6 +1016,23 @@ PRIVATE char * intlmime_encode_mail_address(int wincsid, const char *src, CCCDat if( len > iThreshold ) len = ResetLen( iThreshold, begin, (int16)wincsid ); + if ( iThreshold <= 1 ) + { + /* Certain trashed mailboxes were causing an + ** infinite loop at this point, so we need a way of + ** getting out of trouble. + ** + ** BEFORE: iThreshold was becoming 1, then 0, and + ** we were looping indefinitely. + ** AFTER: Now, first there will be + ** an assert in the previous call to ResetLen, + ** then we'll do that again on the repeat pass, + ** then we'll exit more or less gracefully. + ** - bug #83204, an oldie but goodie. + ** - jrm 98/03/25 + */ + return NULL; + } buf1 = (char *) cvtfunc(obj, (unsigned char *)begin, len); iBufLen = XP_STRLEN( buf1 ); XP_ASSERT( iBufLen > 0 ); @@ -1253,7 +1241,8 @@ char *intl_EncodeMimePartIIStr(char *subject, int16 wincsid, XP_Bool bUseMime, i /* check to see if subject are all ascii or not */ if(intlmime_only_ascii_str(subject)) - return NULL; + return (char *) XP_WordWrapWithPrefix(mail_csid, (unsigned char *) + subject, maxLineLen, 0, " ", 1); if (mail_csid != wincsid) { @@ -1287,6 +1276,16 @@ char *intl_EncodeMimePartIIStr(char *subject, int16 wincsid, XP_Bool bUseMime, i buf = (unsigned char *)cvtfunc(obj, (unsigned char*)newbuf, iSrcLen); if(buf != (unsigned char*)newbuf) XP_FREE(newbuf); + /* time for wrapping long line */ + if (buf) + { + newbuf = (char*) buf; + buf = XP_WordWrapWithPrefix(mail_csid, (unsigned char *) + newbuf, maxLineLen, 0, " ", 1); + + if (buf != (unsigned char*) newbuf) + XP_FREE(newbuf); + } } } } diff --git a/mozilla/lib/libi18n/sjis2jis.c b/mozilla/lib/libi18n/sjis2jis.c index 01853e93aee..2e061d41e83 100644 --- a/mozilla/lib/libi18n/sjis2jis.c +++ b/mozilla/lib/libi18n/sjis2jis.c @@ -18,7 +18,7 @@ /* sjis2jis.c */ #include "intlpriv.h" -#ifdef XP_MAC +#if defined(MOZ_MAIL_NEWS) #include "katakana.h" #endif @@ -82,8 +82,8 @@ mz_sjis2jis( CCCDataObject obj, register unsigned char *sjisep, *toep; /* end of buffers */ int32 uncvtlen; unsigned char *uncvtbuf = INTL_GetCCCUncvtbuf(obj); -#ifdef FEATURE_KATAKANA - unsigned char outbuf[2]; /* for half-width kana */ +#if defined(MOZ_MAIL_NEWS) + unsigned char kanabuf[2]; /* for half-width kana */ uint32 byteused; /* for half-width kana */ #endif @@ -153,18 +153,26 @@ WHILELOOP: } else if (*sjisp < 0xE0) { /* SJIS half-width katakana */ -#ifdef FEATURE_KATAKANA - if (INTL_GetCCCJismode(obj) != JIS_208_83) { - Ins208_83_ESC(tobufp, obj); - } - INTL_SjisHalf2FullKana(sjisp, (uint32)sjisep - (uint32)sjisp + 1, outbuf, &byteused); - /* SJIS Katakana is 0x8340-0x8396 */ - *tobufp++ = ((outbuf[0] - 0x70) << 1) - 1; /* assign 1st byte */ - if (outbuf[1] > 0x7F) - *tobufp++ = outbuf[1] - 0x20; - else - *tobufp++ = outbuf[1] - 0x1F; - sjisp += byteused; +#if defined(MOZ_MAIL_NEWS) + if (!INTL_GetCCCCvtflag_SendHankakuKana(obj)) { + if (INTL_GetCCCJismode(obj) != JIS_208_83) { + Ins208_83_ESC(tobufp, obj); + } + INTL_SjisHalf2FullKana(sjisp, (uint32)sjisep - (uint32)sjisp + 1, kanabuf, &byteused); + /* SJIS Katakana is 0x8340-0x8396 */ + *tobufp++ = ((kanabuf[0] - 0x70) << 1) - 1; /* assign 1st byte */ + if (kanabuf[1] > 0x7F) + *tobufp++ = kanabuf[1] - 0x20; + else + *tobufp++ = kanabuf[1] - 0x1F; + sjisp += byteused; + } else { + if (INTL_GetCCCJismode(obj) != JIS_HalfKana) { + InsHalfKana_ESC(tobufp, obj); + } + *tobufp++ = *sjisp & 0x7F; + sjisp++; + } #else if (INTL_GetCCCJismode(obj) != JIS_HalfKana) { InsHalfKana_ESC(tobufp, obj); diff --git a/mozilla/lib/libmime/Makefile b/mozilla/lib/libmime/Makefile index 5b984204bd5..18db37bcf05 100644 --- a/mozilla/lib/libmime/Makefile +++ b/mozilla/lib/libmime/Makefile @@ -20,7 +20,8 @@ DEPTH = ../.. MODULE = mime LIBRARY_NAME = mime -CSRCS = mimecont.c \ +CSRCS = \ + mimecont.c \ mimedrft.c \ mimeebod.c \ mimeenc.c \ @@ -49,16 +50,9 @@ CSRCS = mimecont.c \ mimetric.c \ mimeunty.c \ mimevcrd.c \ - mimecryp.c \ $(NULL) -ifndef NO_SECURITY -CSRCS += mimempkc.c \ - mimepkcs.c \ - $(NULL) -endif - -REQUIRES = nspr dbm img util layer security pref js +REQUIRES = mime nspr dbm img util layer security pref js julian nls include $(DEPTH)/config/rules.mk @@ -66,9 +60,11 @@ FILT_SRCS = mimefilt.c mimestub.c FILT_OBJS = $(addprefix $(OBJDIR)/,$(FILT_SRCS:.c=.o)) ifndef NO_SECURITY -INCLUDES += $(DEPTH)/../ns_include/libmime +INCLUDES += -I$(DEPTH)/lib/libmime -I$(DIST)/public/security endif +INCLUDES += ./ + # # Building the "mimefilt" executable, which reads a message from stdin and # writes HTML to stdout diff --git a/mozilla/lib/libmime/mimedisp.h b/mozilla/lib/libmime/mimedisp.h new file mode 100644 index 00000000000..39de77c53a4 --- /dev/null +++ b/mozilla/lib/libmime/mimedisp.h @@ -0,0 +1,84 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef __mimedisp_h +#define __mimedisp_h + +/* Interface between netlib and the top-level message/rfc822 parser: + MIME_MessageConverter() + */ + +struct mime_stream_data { /* This struct is the state we pass around + amongst the various stream functions + used by MIME_MessageConverter(). + */ + + URL_Struct *url; /* The URL this is all coming from. */ + int format_out; + MWContext *context; + NET_StreamClass *stream; /* The stream to which we write output */ + NET_StreamClass *istream; /* The stream we're writing out image data, + if any. */ + MimeObject *obj; /* The root parser object */ + MimeDisplayOptions *options; /* Data for communicating with libmime.a */ + + /* These are used by FO_QUOTE_HTML_MESSAGE stuff only: */ + int16 lastcsid; /* csid corresponding to above. */ + int16 outcsid; /* csid passed to EDT_PasteQuoteINTL */ + +#ifndef MOZILLA_30 + uint8 rand_buf[6]; /* Random number used in the MATCH + attribute of the ILAYER tag + pair that encapsulates a + text/html part. (The + attributes must match on the + ILAYER and the closing + /ILAYER.) This is used to + prevent stray layer tags (or + maliciously placed ones) inside + an email message allowing the + message to escape from its + encapsulated environment. */ +#endif /* MOZILLA_30 */ + +#ifdef DEBUG_terry + XP_File logit; /* Temp file to put generated HTML into. */ +#endif +}; + + +struct MimeDisplayData { /* This struct is what we hang off of + MWContext->mime_data, to remember info + about the last MIME object we've + parsed and displayed. See + MimeGuessURLContentName() below. + */ + MimeObject *last_parsed_object; + char *last_parsed_url; + +#ifdef LOCK_LAST_CACHED_MESSAGE + char *previous_locked_url; +#endif /* LOCK_LAST_CACHED_MESSAGE */ + +#ifndef MOZILLA_30 + MSG_Pane* last_pane; +#endif /* MOZILLA_30 */ +}; + +#endif + diff --git a/mozilla/lib/libmime/mimedrft.c b/mozilla/lib/libmime/mimedrft.c index 6509e818bba..43c9bb1c333 100644 --- a/mozilla/lib/libmime/mimedrft.c +++ b/mozilla/lib/libmime/mimedrft.c @@ -17,6 +17,7 @@ */ #include "xp.h" +#include "xpgetstr.h" #include "libi18n.h" #include "xp_time.h" #include "msgcom.h" @@ -28,7 +29,14 @@ extern int MK_UNABLE_TO_OPEN_TMP_FILE; extern int MK_MIME_ERROR_WRITING_FILE; - +extern int MK_MIMEHTML_DISP_SUBJECT; +extern int MK_MIMEHTML_DISP_DATE; +extern int MK_MIMEHTML_DISP_FROM; +extern int MK_MIMEHTML_DISP_ORGANIZATION; +extern int MK_MIMEHTML_DISP_TO; +extern int MK_MIMEHTML_DISP_CC; +extern int MK_MIMEHTML_DISP_NEWSGROUPS; +extern int MK_MIMEHTML_DISP_BCC; int mime_decompose_file_init_fn ( void *stream_closure, @@ -43,6 +51,9 @@ mime_decompose_file_output_fn ( char *buf, int mime_decompose_file_close_fn ( void *stream_closure ); +extern char * +strip_continuations(char *original); + /* This struct is the state we used in MIME_ToDraftConverter() */ struct mime_draft_data { URL_Struct *url; /* original url */ @@ -179,6 +190,76 @@ mime_draft_process_attachments ( struct mime_draft_data *mdd, } +static void mime_fix_up_html_address( char **addr) +{ + /* We need to replace paired <> they are treated as HTML tag */ + if (addr && *addr && + XP_STRCHR(*addr, '<') && XP_STRCHR(*addr, '>')) + { + char *lt = NULL; + int32 newLen = 0; + do + { + newLen = XP_STRLEN(*addr) + 3 + 1; + *addr = (char *) XP_REALLOC(*addr, newLen); + XP_ASSERT (*addr); + lt = XP_STRCHR(*addr, '<'); + XP_ASSERT(lt); + XP_MEMCPY(lt+4, lt+1, newLen - 4 - (lt - *addr)); + *lt++ = '&'; + *lt++ = 'l'; + *lt++ = 't'; + *lt = ';'; + } while (XP_STRCHR(*addr, '<')); + } +} + +static void mime_intl_mimepart_2_str(char **str, int16 mcsid) +{ + if (str && *str) + { + char *newStr = (char *) IntlDecodeMimePartIIStr + (*str, INTL_DocToWinCharSetID(mcsid), FALSE); + if (newStr && newStr != *str) + { + FREEIF(*str); + *str = newStr; + } + else + { + strip_continuations(*str); + } + } +} + +static void mime_intl_insert_message_header(char **body, char**hdr_value, + char *hdr_str, + int html_hdr_id, + int16 mailcsid, + XP_Bool htmlEdit) +{ + const char *newName = NULL; + + if (!body || !hdr_value || !hdr_str) + return; + mime_intl_mimepart_2_str(hdr_value, mailcsid); + if (htmlEdit) + StrAllocCat(*body, LINEBREAK "
"); + else + StrAllocCat(*body, LINEBREAK); + newName = XP_GetStringForHTML(html_hdr_id, mailcsid, hdr_str); + if (!newName) + newName = hdr_str; + StrAllocCat(*body, newName); + if (htmlEdit) + StrAllocCat(*body, ": "); + else + StrAllocCat(*body, ": "); + StrAllocCat(*body, *hdr_value); +} + + + static void mime_parse_stream_complete (NET_StreamClass *stream) { @@ -241,122 +322,48 @@ mime_parse_stream_complete (NET_StreamClass *stream) /* time to bring up the compose windows with all the info gathered */ - if ( mdd->headers ) { - char *newString = NULL; - - repl = MimeHeaders_get(mdd->headers, HEADER_REPLY_TO, FALSE, FALSE); + if ( mdd->headers ) + { subj = MimeHeaders_get(mdd->headers, HEADER_SUBJECT, FALSE, FALSE); + repl = MimeHeaders_get(mdd->headers, HEADER_REPLY_TO, FALSE, FALSE); to = MimeHeaders_get(mdd->headers, HEADER_TO, FALSE, TRUE); cc = MimeHeaders_get(mdd->headers, HEADER_CC, FALSE, TRUE); bcc = MimeHeaders_get(mdd->headers, HEADER_BCC, FALSE, TRUE); - + /* These headers should not be RFC-1522-decoded. */ grps = MimeHeaders_get(mdd->headers, HEADER_NEWSGROUPS, FALSE, TRUE); foll = MimeHeaders_get(mdd->headers, HEADER_FOLLOWUP_TO, FALSE, TRUE); + + host = MimeHeaders_get(mdd->headers, HEADER_X_MOZILLA_NEWSHOST, FALSE, FALSE); + if (!host) + host = MimeHeaders_get(mdd->headers, HEADER_NNTP_POSTING_HOST, FALSE, FALSE); + id = MimeHeaders_get(mdd->headers, HEADER_MESSAGE_ID, FALSE, FALSE); refs = MimeHeaders_get(mdd->headers, HEADER_REFERENCES, FALSE, TRUE); priority = MimeHeaders_get(mdd->headers, HEADER_X_PRIORITY, FALSE, FALSE); - host = MimeHeaders_get(mdd->headers, HEADER_X_MOZILLA_NEWSHOST, FALSE, FALSE); - if (!host) - host = MimeHeaders_get(mdd->headers, HEADER_NNTP_POSTING_HOST, FALSE, FALSE); - - { - if (repl) - { - newString = (char *)IntlDecodeMimePartIIStr( - repl, INTL_DocToWinCharSetID(mdd->mailcsid), FALSE); - if (newString && newString != repl) - { - FREEIF (repl); - repl = newString; - } - } - if (subj) - { - newString = (char *)IntlDecodeMimePartIIStr( - subj, INTL_DocToWinCharSetID(mdd->mailcsid), FALSE); - if (newString && newString != repl) - { - FREEIF (subj); - subj = newString; - } - } - if (to) - { - newString = (char *)IntlDecodeMimePartIIStr( - to, INTL_DocToWinCharSetID(mdd->mailcsid), FALSE); - if (newString && newString != repl) - { - FREEIF (to); - to = newString; - } - } - if (cc) - { - newString = (char *)IntlDecodeMimePartIIStr( - cc, INTL_DocToWinCharSetID(mdd->mailcsid), FALSE); - if (newString && newString != cc) - { - FREEIF (cc); - cc = newString; - } - } - if (bcc) - { - newString = (char *)IntlDecodeMimePartIIStr( - bcc, INTL_DocToWinCharSetID(mdd->mailcsid), FALSE); - if (newString && newString != bcc) - { - FREEIF (bcc); - bcc = newString; - } - } - if (grps) - { - newString = (char *)IntlDecodeMimePartIIStr( - grps, INTL_DocToWinCharSetID(mdd->mailcsid), FALSE); - if (newString && newString != grps) - { - FREEIF (grps); - grps = newString; - } - } - if (foll) - { - newString = (char *)IntlDecodeMimePartIIStr( - foll, INTL_DocToWinCharSetID(mdd->mailcsid), FALSE); - if (newString && newString != foll) - { - FREEIF (foll); - foll = newString; - } - } - if (host) - { - newString = (char *)IntlDecodeMimePartIIStr( - host, INTL_DocToWinCharSetID(mdd->mailcsid), FALSE); - if (newString && newString != host) - { - FREEIF (host); - repl = newString; - } - } - } + mime_intl_mimepart_2_str(&repl, mdd->mailcsid); + mime_intl_mimepart_2_str(&to, mdd->mailcsid); + mime_intl_mimepart_2_str(&cc, mdd->mailcsid); + mime_intl_mimepart_2_str(&bcc, mdd->mailcsid); + mime_intl_mimepart_2_str(&grps, mdd->mailcsid); + mime_intl_mimepart_2_str(&foll, mdd->mailcsid); + mime_intl_mimepart_2_str(&host, mdd->mailcsid); if (host) { char *secure = NULL; - + secure = strcasestr(host, "secure"); if (secure) { *secure = 0; news_host = PR_smprintf ("snews://%s", host); } else { - news_host = PR_smprintf ("news://%s", host); + news_host = PR_smprintf ("news://%s", host); } } - + + mime_intl_mimepart_2_str(&subj, mdd->mailcsid); fields = MSG_CreateCompositionFields( from, repl, to, cc, bcc, fcc, grps, foll, org, subj, refs, 0, priority, 0, news_host, @@ -365,13 +372,17 @@ mime_parse_stream_complete (NET_StreamClass *stream) draftInfo = MimeHeaders_get(mdd->headers, HEADER_X_MOZILLA_DRAFT_INFO, FALSE, FALSE); if (draftInfo && fields) { char *parm = 0; - parm = MimeHeaders_get_parameter(draftInfo, "vcard"); + parm = MimeHeaders_get_parameter(draftInfo, "vcard", NULL, NULL); if (parm && !XP_STRCMP(parm, "1")) - MSG_SetCompFieldsBoolHeader(fields, MSG_ATTACH_VCARD_BOOL_HEADER_MASK, TRUE); + MSG_SetCompFieldsBoolHeader(fields, + MSG_ATTACH_VCARD_BOOL_HEADER_MASK, + TRUE); else - MSG_SetCompFieldsBoolHeader(fields, MSG_ATTACH_VCARD_BOOL_HEADER_MASK, FALSE); + MSG_SetCompFieldsBoolHeader(fields, + MSG_ATTACH_VCARD_BOOL_HEADER_MASK, + FALSE); FREEIF(parm); - parm = MimeHeaders_get_parameter(draftInfo, "receipt"); + parm = MimeHeaders_get_parameter(draftInfo, "receipt", NULL, NULL); if (parm && !XP_STRCMP(parm, "0")) MSG_SetCompFieldsBoolHeader(fields, MSG_RETURN_RECEIPT_BOOL_HEADER_MASK, @@ -386,17 +397,21 @@ mime_parse_stream_complete (NET_StreamClass *stream) MSG_SetCompFieldsReceiptType(fields, (int32) receiptType); } FREEIF(parm); - parm = MimeHeaders_get_parameter(draftInfo, "uuencode"); + parm = MimeHeaders_get_parameter(draftInfo, "uuencode", NULL, NULL); if (parm && !XP_STRCMP(parm, "1")) - MSG_SetCompFieldsBoolHeader(fields, MSG_UUENCODE_BINARY_BOOL_HEADER_MASK, TRUE); + MSG_SetCompFieldsBoolHeader(fields, + MSG_UUENCODE_BINARY_BOOL_HEADER_MASK, + TRUE); else - MSG_SetCompFieldsBoolHeader(fields, MSG_UUENCODE_BINARY_BOOL_HEADER_MASK, FALSE); + MSG_SetCompFieldsBoolHeader(fields, + MSG_UUENCODE_BINARY_BOOL_HEADER_MASK, + FALSE); FREEIF(parm); - parm = MimeHeaders_get_parameter(draftInfo, "html"); + parm = MimeHeaders_get_parameter(draftInfo, "html", NULL, NULL); if (parm) sscanf(parm, "%d", &htmlAction); FREEIF(parm); - parm = MimeHeaders_get_parameter(draftInfo, "linewidth"); + parm = MimeHeaders_get_parameter(draftInfo, "linewidth", NULL, NULL); if (parm) sscanf(parm, "%d", &lineWidth); FREEIF(parm); @@ -404,57 +419,69 @@ mime_parse_stream_complete (NET_StreamClass *stream) } if (mdd->messageBody) { - char *body; - XP_StatStruct st; - XP_File file; - MSG_EditorType editorType = MSG_DEFAULT; + char *body; + XP_StatStruct st; + uint32 bodyLen = 0; + XP_File file; + MSG_EditorType editorType = MSG_DEFAULT; - st.st_size = 0; - XP_Stat (mdd->messageBody->file_name, &st, xpFileToPost); - body = XP_ALLOC (st.st_size + 1); - XP_MEMSET (body, 0, st.st_size+1); - - file = XP_FileOpen (mdd->messageBody->file_name, xpFileToPost, XP_FILE_READ_BIN); - XP_FileRead (body, st.st_size+1, file); - XP_FileClose(file); - - if (mdd->messageBody->type && *mdd->messageBody->type) - { - if( XP_STRSTR(mdd->messageBody->type, "text/html") != NULL ) - editorType = MSG_HTML_EDITOR; - else if ( XP_STRSTR(mdd->messageBody->type, "text/plain") != NULL ) - editorType = MSG_PLAINTEXT_EDITOR; - } - - { - CCCDataObject conv = INTL_CreateCharCodeConverter(); - if(conv) { - if (INTL_GetCharCodeConverter(mdd->mailcsid, INTL_DocToWinCharSetID(mdd->mailcsid), conv)) { - char *newBody = NULL; - newBody = (char *)INTL_CallCharCodeConverter( - conv, (unsigned char *) body, (int32) st.st_size+1); - if (newBody) { - /* CharCodeConverter return the char* to the orginal string - we don't want to free body in that case */ - if( newBody != body) - FREEIF(body); - body = newBody; + st.st_size = 0; + XP_Stat (mdd->messageBody->file_name, &st, xpFileToPost); + bodyLen = st.st_size; + body = XP_ALLOC (bodyLen + 1); + if (body) + { + XP_MEMSET (body, 0, bodyLen+1); + + file = XP_FileOpen (mdd->messageBody->file_name, xpFileToPost, + XP_FILE_READ_BIN); + XP_FileRead (body, bodyLen, file); + XP_FileClose(file); + + if (mdd->messageBody->type && *mdd->messageBody->type) + { + if( XP_STRSTR(mdd->messageBody->type, "text/html") != NULL ) + editorType = MSG_HTML_EDITOR; + else if ( XP_STRSTR(mdd->messageBody->type, "text/plain") != NULL ) + editorType = MSG_PLAINTEXT_EDITOR; + } + else + { + editorType = MSG_PLAINTEXT_EDITOR; + } + + { + CCCDataObject conv = INTL_CreateCharCodeConverter(); + if(conv) { + if (INTL_GetCharCodeConverter(mdd->mailcsid, + INTL_DocToWinCharSetID(mdd->mailcsid), conv)) + { + char *newBody = NULL; + newBody = (char *)INTL_CallCharCodeConverter( + conv, (unsigned char *) body, (int32) bodyLen); + if (newBody) { + /* CharCodeConverter return the char* to the orginal string + we don't want to free body in that case */ + if( newBody != body) + FREEIF(body); + body = newBody; + } + } + INTL_DestroyCharCodeConverter(conv); } } - INTL_DestroyCharCodeConverter(conv); } - } - - cpane = FE_CreateCompositionPane (mdd->context, fields, body, editorType); - - XP_FREE (body); - mime_free_attachments (mdd->messageBody, 1); + + cpane = FE_CreateCompositionPane (mdd->context, fields, body, editorType); + + XP_FREE (body); + mime_free_attachments (mdd->messageBody, 1); } else { cpane = FE_CreateCompositionPane(mdd->context, fields, NULL, MSG_DEFAULT); } - + if (cpane) { /* clear the message body in case someone store the signature string in it */ @@ -462,23 +489,24 @@ mime_parse_stream_complete (NET_StreamClass *stream) MSG_SetHTMLAction(cpane, (MSG_HTMLComposeAction) htmlAction); if (lineWidth > 0) MSG_SetLineWidth(cpane, lineWidth); - + if ( mdd->attachments_count) - mime_draft_process_attachments (mdd, cpane); + mime_draft_process_attachments (mdd, cpane); } } else { fields = MSG_CreateCompositionFields( from, repl, to, cc, bcc, fcc, grps, foll, - org, subj, refs, 0, priority, 0, news_host, - MSG_GetMailEncryptionPreference(), + org, subj, refs, 0, priority, 0, news_host, + MSG_GetMailEncryptionPreference(), MSG_GetMailSigningPreference()); if (fields) - cpane = FE_CreateCompositionPane(mdd->context, fields, NULL, MSG_DEFAULT); + cpane = FE_CreateCompositionPane(mdd->context, fields, NULL, MSG_DEFAULT); } - - if (cpane) { - if ( mdd->url->fe_data && (mdd->format_out != FO_CMDLINE_ATTACHMENTS) ) + + if (cpane && mdd->url->fe_data) + { + if ( mdd->format_out != FO_CMDLINE_ATTACHMENTS ) { MSG_SetPostDeliveryActionInfo (cpane, mdd->url->fe_data); } @@ -487,20 +515,20 @@ mime_parse_stream_complete (NET_StreamClass *stream) MSG_SetAttachmentList ( cpane, (MSG_AttachmentData*)(mdd->url->fe_data)); } } - - + + if ( mdd->headers ) - MimeHeaders_free ( mdd->headers ); - + MimeHeaders_free ( mdd->headers ); + if (mdd->attachments) - /* do not call mime_free_attachments just use FREEIF() */ - FREEIF ( mdd->attachments ); - + /* do not call mime_free_attachments just use FREEIF() */ + FREEIF ( mdd->attachments ); + if (fields) MSG_DestroyCompositionFields(fields); - + XP_FREE (mdd); - + FREEIF(host); FREEIF(to_and_cc); FREEIF(re_subject); @@ -516,7 +544,7 @@ mime_parse_stream_complete (NET_StreamClass *stream) FREEIF(foll); FREEIF(priority); FREEIF(draftInfo); - + } static void @@ -614,7 +642,7 @@ mime_decompose_file_init_fn ( void *stream_closure, char *charset = NULL, *contentType = NULL; contentType = MimeHeaders_get(headers, HEADER_CONTENT_TYPE, FALSE, FALSE); if (contentType) { - charset = MimeHeaders_get_parameter(contentType, "charset"); + charset = MimeHeaders_get_parameter(contentType, "charset", NULL, NULL); mdd->mailcsid = INTL_CharSetNameToID(charset); FREEIF(charset); FREEIF(contentType); @@ -684,15 +712,15 @@ mime_decompose_file_init_fn ( void *stream_closure, if (parm_value) { char *boundary = NULL; char *tmp_value = NULL; - boundary = MimeHeaders_get_parameter(parm_value, "boundary"); + boundary = MimeHeaders_get_parameter(parm_value, "boundary", NULL, NULL); if (boundary) tmp_value = PR_smprintf("; boundary=\"%s\"", boundary); if (tmp_value) StrAllocCat(newAttachment->type, tmp_value); newAttachment->x_mac_type = - MimeHeaders_get_parameter(parm_value, "x-mac-type"); + MimeHeaders_get_parameter(parm_value, "x-mac-type", NULL, NULL); newAttachment->x_mac_creator = - MimeHeaders_get_parameter(parm_value, "x-mac-creator"); + MimeHeaders_get_parameter(parm_value, "x-mac-creator", NULL, NULL); FREEIF(parm_value); FREEIF(boundary); FREEIF(tmp_value); diff --git a/mozilla/lib/libmime/mimeebod.c b/mozilla/lib/libmime/mimeebod.c index 7a231d3c8a9..709e42e4831 100644 --- a/mozilla/lib/libmime/mimeebod.c +++ b/mozilla/lib/libmime/mimeebod.c @@ -155,7 +155,11 @@ MimeExternalBody_make_url(const char *ct, const char *svr, const char *subj, const char *body) { char *s; - if (!strcasecomp(at, "ftp") || !strcasecomp(at, "anon-ftp")) + if (!at) + { + return 0; + } + else if (!strcasecomp(at, "ftp") || !strcasecomp(at, "anon-ftp")) { if (!site || !name) return 0; @@ -281,17 +285,17 @@ MimeExternalBody_parse_eof (MimeObject *obj, XP_Bool abort_p) if (!ct) return MK_OUT_OF_MEMORY; - at = MimeHeaders_get_parameter(ct, "access-type"); - exp = MimeHeaders_get_parameter(ct, "expiration"); - size = MimeHeaders_get_parameter(ct, "size"); - perm = MimeHeaders_get_parameter(ct, "permission"); - dir = MimeHeaders_get_parameter(ct, "directory"); - mode = MimeHeaders_get_parameter(ct, "mode"); - name = MimeHeaders_get_parameter(ct, "name"); - site = MimeHeaders_get_parameter(ct, "site"); - svr = MimeHeaders_get_parameter(ct, "server"); - subj = MimeHeaders_get_parameter(ct, "subject"); - url = MimeHeaders_get_parameter(ct, "url"); + at = MimeHeaders_get_parameter(ct, "access-type", NULL, NULL); + exp = MimeHeaders_get_parameter(ct, "expiration", NULL, NULL); + size = MimeHeaders_get_parameter(ct, "size", NULL, NULL); + perm = MimeHeaders_get_parameter(ct, "permission", NULL, NULL); + dir = MimeHeaders_get_parameter(ct, "directory", NULL, NULL); + mode = MimeHeaders_get_parameter(ct, "mode", NULL, NULL); + name = MimeHeaders_get_parameter(ct, "name", NULL, NULL); + site = MimeHeaders_get_parameter(ct, "site", NULL, NULL); + svr = MimeHeaders_get_parameter(ct, "server", NULL, NULL); + subj = MimeHeaders_get_parameter(ct, "subject", NULL, NULL); + url = MimeHeaders_get_parameter(ct, "url", NULL, NULL); FREEIF(ct); /* the *internal* content-type */ @@ -498,7 +502,7 @@ MimeExternalBody_displayable_inline_p (MimeObjectClass *class, MimeHeaders *hdrs) { char *ct = MimeHeaders_get (hdrs, HEADER_CONTENT_TYPE, FALSE, FALSE); - char *at = MimeHeaders_get_parameter(ct, "access-type"); + char *at = MimeHeaders_get_parameter(ct, "access-type", NULL, NULL); XP_Bool inline_p = FALSE; if (!at) diff --git a/mozilla/lib/libmime/mimeeobj.c b/mozilla/lib/libmime/mimeeobj.c index 0bbaaac5329..b861872e746 100644 --- a/mozilla/lib/libmime/mimeeobj.c +++ b/mozilla/lib/libmime/mimeeobj.c @@ -115,15 +115,27 @@ MimeExternalObject_parse_begin (MimeObject *obj) char *id = 0; char *id_url = 0; char *id_name = 0; + char *id_imap = 0; XP_Bool all_headers_p = obj->options->headers == MimeHeadersAll; id = mime_part_address (obj); + if (obj->options->missing_parts) + id_imap = mime_imap_part_address (obj); if (! id) return MK_OUT_OF_MEMORY; if (obj->options && obj->options->url) { const char *url = obj->options->url; - id_url = mime_set_url_part(url, id, TRUE); + if (id_imap && id) + { + /* if this is an IMAP part. */ + id_url = mime_set_url_imap_part(url, id_imap, id); + } + else + { + /* This is just a normal MIME part as usual. */ + id_url = mime_set_url_part(url, id, TRUE); + } if (!id_url) { XP_FREE(id); diff --git a/mozilla/lib/libmime/mimehdrs.c b/mozilla/lib/libmime/mimehdrs.c index 8d94d8735ce..ecbf03f28dd 100644 --- a/mozilla/lib/libmime/mimehdrs.c +++ b/mozilla/lib/libmime/mimehdrs.c @@ -24,9 +24,11 @@ #include "mimei.h" #include "xpgetstr.h" #include "libi18n.h" +#include "mime.h" #ifndef MOZILLA_30 # include "msgcom.h" +#include "imap.h" #include "prefapi.h" #endif /* !MOZILLA_30 */ @@ -38,6 +40,7 @@ extern int MK_MSG_USER_WROTE; extern int MK_MSG_UNSPECIFIED_TYPE; extern int MK_MSG_XSENDER_INTERNAL; extern int MK_MSG_ADDBOOK_MOUSEOVER_TEXT; +extern int MK_MSG_SHOW_ATTACHMENT_PANE; extern int MK_MIMEHTML_DISP_SUBJECT; extern int MK_MIMEHTML_DISP_RESENT_COMMENTS; @@ -61,6 +64,9 @@ extern int MK_MIMEHTML_DISP_MESSAGE_ID; extern int MK_MIMEHTML_DISP_RESENT_MESSAGE_ID; extern int MK_MIMEHTML_DISP_BCC; extern int MK_MIMEHTML_SHOW_SECURITY_ADVISOR; +extern int MK_MIMEHTML_VERIFY_SIGNATURE; +extern int MK_MIMEHTML_DOWNLOAD_STATUS_HEADER; +extern int MK_MIMEHTML_DOWNLOAD_STATUS_NOT_DOWNLOADED; extern int MK_MIMEHTML_ENC_AND_SIGNED; extern int MK_MIMEHTML_SIGNED; @@ -70,8 +76,12 @@ extern int MK_MIMEHTML_ENC_SIGNED_BAD; extern int MK_MIMEHTML_SIGNED_BAD; extern int MK_MIMEHTML_ENCRYPTED_BAD; extern int MK_MIMEHTML_CERTIFICATES_BAD; +extern int MK_MIMEHTML_SIGNED_UNVERIFIED; +char * +strip_continuations(char *original); + @@ -477,9 +487,11 @@ MimeHeaders_get (MimeHeaders *hdrs, const char *header_name, } char * -MimeHeaders_get_parameter (const char *header_value, const char *parm_name) +MimeHeaders_get_parameter (const char *header_value, const char *parm_name, + char **charset, char **language) { const char *str; + char *s = NULL; /* parm value to be returned */ int32 parm_len; if (!header_value || !parm_name || !*header_value || !*parm_name) return 0; @@ -488,6 +500,9 @@ MimeHeaders_get_parameter (const char *header_value, const char *parm_name) [ ';' '=' ]* */ + if (charset) *charset = NULL; + if (language) *language = NULL; + str = header_value; parm_len = XP_STRLEN(parm_name); @@ -552,12 +567,101 @@ MimeHeaders_get_parameter (const char *header_value, const char *parm_name) if (token_end - token_start == parm_len && !strncasecomp(token_start, parm_name, parm_len)) { - char *s = (char *) XP_ALLOC ((value_end - value_start) + 1); + s = (char *) XP_ALLOC ((value_end - value_start) + 1); if (! s) return 0; /* MK_OUT_OF_MEMORY */ XP_MEMCPY (s, value_start, value_end - value_start); s [value_end - value_start] = 0; + /* if the parameter spans across multiple lines we have to strip out the + line continuation -- jht 4/29/98 */ + strip_continuations(s); return s; } + else if (token_end - token_start > parm_len && + !strncasecomp(token_start, parm_name, parm_len) && + *(token_start+parm_len) == '*') + { + /* RFC2231 - The legitimate parm format can be: + title*=us-ascii'en-us'This%20is%20weired. + or + title*0*=us-ascii'en'This%20is%20weired.%20We + title*1*=have%20to%20support%20this. + title*3="Else..." + or + title*0="Hey, what you think you are doing?" + title*1="There is no charset and language info." + */ + const char *cp = token_start+parm_len+1; /* 1st char pass '*' */ + XP_Bool needUnescape = *(token_end-1) == '*'; + if ((*cp == '0' && needUnescape) || (token_end-token_start == parm_len+1)) + { + const char *s_quote1 = XP_STRCHR(value_start, 0x27); + const char *s_quote2 = s_quote1 ? XP_STRCHR(s_quote1+1, 0x27) : NULL; + XP_ASSERT(s_quote1 && s_quote2); + if (charset && s_quote1 > value_start && s_quote1 < value_end) + { + *charset = (char *) XP_ALLOC(s_quote1-value_start+1); + if (*charset) + { + XP_MEMCPY(*charset, value_start, s_quote1-value_start); + *(*charset+(s_quote1-value_start)) = 0; + } + } + if (language && s_quote1 && s_quote2 && s_quote2 > s_quote1+1 && + s_quote2 < value_end) + { + *language = (char *) XP_ALLOC(s_quote2-(s_quote1+1)+1); + if (*language) + { + XP_MEMCPY(*language, s_quote1+1, s_quote2-(s_quote1+1)); + *(*language+(s_quote2-(s_quote1+1))) = 0; + } + } + if (s_quote2 && s_quote2+1 < value_end) + { + XP_ASSERT(!s); + s = (char *) XP_ALLOC(value_end-(s_quote2+1)+1); + if (s) + { + XP_MEMCPY(s, s_quote2+1, value_end-(s_quote2+1)); + *(s+(value_end-(s_quote2+1))) = 0; + if (needUnescape) + { + NET_UnEscape(s); + if (token_end-token_start == parm_len+1) + return s; /* we done; this is the simple case of + encoding charset and language info + */ + } + } + } + } + else if (XP_IS_DIGIT(*cp)) + { + int32 len = 0; + char *ns = NULL; + if (s) + { + len = XP_STRLEN(s); + ns = (char *) XP_REALLOC(s, len+(value_end-value_start)+1); + if (!ns) + FREEIF(s); + else if (ns != s) + s = ns; + } + else if (*cp == '0') /* must be; otherwise something is wrong */ + { + s = (char *) XP_ALLOC(value_end-value_start+1); + } + /* else {} something is really wrong; out of memory */ + if (s) + { + XP_MEMCPY(s+len, value_start, value_end-value_start); + *(s+len+(value_end-value_start)) = 0; + if (needUnescape) + NET_UnEscape(s+len); + } + } + } /* str now points after the end of the value. skip over whitespace, ';', whitespace. */ @@ -565,7 +669,7 @@ MimeHeaders_get_parameter (const char *header_value, const char *parm_name) if (*str == ';') str++; while (XP_IS_SPACE (*str)) str++; } - return 0; + return s; } @@ -615,16 +719,24 @@ MimeHeaders_default_mailto_link_generator (const char *dest, void *closure, static char *mime_escape_quotes (char *src) { - /* Make sure any single or double quote is escaped with a backslash */ + /* Make sure quotes are escaped with a backslash */ char *dst = XP_ALLOC((2 * XP_STRLEN(src)) + 1); if (dst) { char *walkDst = dst; while (*src) { - if (*src == '\'' || *src == '\"' ) /* is it a quote? */ + /* here's a big hack. double quotes, even if escaped, produce JS errors, + * so we'll just whack a double quote into a single quote. This string + * is just eye candy anyway. + */ + if (*src == '\"') + *src = '\''; + + if (*src == '\'') /* is it a quote? */ if (walkDst == dst || *(src-1) != '\\') /* is it escaped? */ *walkDst++ = '\\'; + *walkDst++ = *src++; } *walkDst = '\0'; @@ -817,6 +929,9 @@ MimeHeaders_write_random_header_1 (MimeHeaders *hdrs, char *converted = 0; int32 converted_length = 0; + XP_ASSERT(hdrs); + if (!hdrs) return -1; + if (!contents && subject_p) contents = ""; else if (!contents) @@ -964,6 +1079,8 @@ MimeHeaders_write_grouped_header_1 (MimeHeaders *hdrs, const char *name, int32 contents_length; char *converted = 0; char *out; + const char* orig_name = name; + if (!contents) return 0; @@ -1121,7 +1238,7 @@ MimeHeaders_write_grouped_header_1 (MimeHeaders *hdrs, const char *name, arg = 0; #else /* !MOZILLA_30 */ fn = MimeHeaders_default_addbook_link_generator; - arg = NULL; /* ###phil fix this &extraAnchorText; */ + arg = &extraAnchorText; #endif /* !MOZILLA_30 */ } else @@ -1195,7 +1312,7 @@ MimeHeaders_write_grouped_header_1 (MimeHeaders *hdrs, const char *name, XP_FREE (extraAnchorText); #ifndef MOZILLA_30 /* Begin hack of out of envelope XSENDER info */ - if (name && !strcasecomp(name, HEADER_FROM)) { + if (orig_name && !strcasecomp(orig_name, HEADER_FROM)) { char * statusLine = MimeHeaders_get (hdrs, HEADER_X_MOZILLA_STATUS, FALSE, FALSE); uint16 flags =0; @@ -1277,6 +1394,10 @@ MimeHeaders_write_id_header_1 (MimeHeaders *hdrs, const char *name, int status = 0; int32 contents_length; char *out; + + XP_ASSERT(hdrs); + if (!hdrs) return -1; + if (!contents) return 0; @@ -1463,7 +1584,12 @@ MimeHeaders_write_id_header (MimeHeaders *hdrs, const char *name, XP_Bool show_ids, MimeDisplayOptions *opt) { int status = 0; - char *contents = MimeHeaders_get (hdrs, name, FALSE, TRUE); + char *contents = NULL; + + XP_ASSERT(hdrs); + if (!hdrs) return -1; + + contents = MimeHeaders_get (hdrs, name, FALSE, TRUE); if (!contents) return 0; status = MimeHeaders_write_id_header_1 (hdrs, name, contents, show_ids, opt); XP_FREE(contents); @@ -1526,6 +1652,9 @@ MimeHeaders_write_interesting_headers (MimeHeaders *hdrs, XP_Bool did_from = FALSE; XP_Bool did_resent_from = FALSE; + XP_ASSERT(hdrs); + if (!hdrs) return -1; + status = MimeHeaders_grow_obuffer (hdrs, 200); if (status < 0) return status; @@ -1665,6 +1794,9 @@ MimeHeaders_write_all_headers (MimeHeaders *hdrs, MimeDisplayOptions *opt) int i; XP_Bool wrote_any_p = FALSE; + XP_ASSERT(hdrs); + if (!hdrs) return -1; + /* One shouldn't be trying to read headers when one hasn't finished parsing them yet... but this can happen if the message ended prematurely, and has no body at all (as opposed to a null body, @@ -1969,6 +2101,8 @@ MimeHeaders_write_microscopic_headers (MimeHeaders *hdrs, if (status < 0) goto FAIL; status = MimeHeaders_write_address_header (hdrs, HEADER_CC, opt); if (status < 0) goto FAIL; + status = MimeHeaders_write_address_header (hdrs, HEADER_BCC, opt); + if (status < 0) goto FAIL; status = MimeHeaders_write_news_header (hdrs, HEADER_NEWSGROUPS, opt); if (status < 0) goto FAIL; } @@ -1992,6 +2126,9 @@ MimeHeaders_write_citation_headers (MimeHeaders *hdrs, MimeDisplayOptions *opt) char *converted = 0; int32 converted_length = 0; + XP_ASSERT(hdrs); + if (!hdrs) return -1; + if (!opt || !opt->output_fn) return 0; @@ -2144,11 +2281,14 @@ MimeHeaders_write_headers_html (MimeHeaders *hdrs, MimeDisplayOptions *opt) int status = 0; XP_Bool wrote_any_p = FALSE; + XP_ASSERT(hdrs); + if (!hdrs) return -1; + if (!opt || !opt->output_fn) return 0; FREEIF(hdrs->munged_subject); - status = MimeHeaders_grow_obuffer (hdrs, 210); + status = MimeHeaders_grow_obuffer (hdrs, /*210*/ 750); if (status < 0) return status; if (opt->fancy_headers_p) { @@ -2194,14 +2334,16 @@ MimeHeaders_write_headers_html (MimeHeaders *hdrs, MimeDisplayOptions *opt) if (!opt->nice_html_only_p && opt->fancy_links_p) { if (opt->attachment_icon_layer_id == 0) { static int32 randomid = 1; /* Not very random. ### */ + char *mouseOverStatusString = XP_GetString(MK_MSG_SHOW_ATTACHMENT_PANE); opt->attachment_icon_layer_id = randomid; XP_SPRINTF(hdrs->obuffer + XP_STRLEN(hdrs->obuffer), "" "" - "" + "" "" "", - (long) randomid, (long) randomid); + (long) randomid, (long) randomid, + mouseOverStatusString); randomid++; } } @@ -2236,7 +2378,22 @@ MimeHeaders_write_headers_html (MimeHeaders *hdrs, MimeDisplayOptions *opt) } - +/* Returns TRUE if we should show colored tags on attachments. + Useful for IMAP MIME parts on demand, because it shows a different + color for undownloaded parts. */ +static XP_Bool +MimeHeaders_getShowAttachmentColors() +{ + static XP_Bool gotPref = FALSE; + static XP_Bool showColors = FALSE; + if (!gotPref) + { + PREF_GetBoolPref("mailnews.color_tag_attachments", &showColors); + gotPref = TRUE; + } + return showColors; +} + /* For drawing the tables that represent objects that can't be displayed inline. */ @@ -2251,12 +2408,18 @@ MimeHeaders_write_attachment_box(MimeHeaders *hdrs, const char *body) { int status = 0; - char *type = 0, *desc = 0, *enc = 0, *icon = 0, *type_desc = 0; + char *type = 0, *desc = 0, *enc = 0, *icon = 0, *type_desc = 0, *partColor = 0; + XP_Bool downloaded = TRUE; + + XP_ASSERT(hdrs); + if (!hdrs) return -1; type = (content_type ? XP_STRDUP(content_type) : MimeHeaders_get(hdrs, HEADER_CONTENT_TYPE, TRUE, FALSE)); + downloaded = opt->missing_parts ? (MimeHeaders_get(hdrs, IMAP_EXTERNAL_CONTENT_HEADER, FALSE, FALSE) == NULL) : TRUE; + if (type && *type && opt) { if (opt->type_icon_name_fn) @@ -2288,8 +2451,18 @@ MimeHeaders_write_attachment_box(MimeHeaders *hdrs, XP_STRLEN(hdrs->obuffer)); \ if (status < 0) goto FAIL; } while (0) - PUT_STRING ("" - "
"); + PUT_STRING (""); + if (MimeHeaders_getShowAttachmentColors()) + { + /* For IMAP MIME parts on demand */ + partColor = downloaded ? "#00CC00" : "#FFCC00"; + + PUT_STRING (""); + } + PUT_STRING ("
"); + PUT_STRING ("
"); if (icon) { @@ -2414,6 +2587,18 @@ MimeHeaders_write_attachment_box(MimeHeaders *hdrs, FREEIF(desc); PUT_STRING(HEADER_END_JUNK); } + + if (!downloaded) + { + const char *downloadStatus_hdr = XP_GetString(MK_MIMEHTML_DOWNLOAD_STATUS_HEADER); + const char *downloadStatus = XP_GetString(MK_MIMEHTML_DOWNLOAD_STATUS_NOT_DOWNLOADED); + PUT_STRING(HEADER_START_JUNK); + PUT_STRING(downloadStatus_hdr); + PUT_STRING(HEADER_MIDDLE_JUNK); + PUT_STRING(downloadStatus); + PUT_STRING(HEADER_END_JUNK); + } + PUT_STRING ("
"); } if (body) PUT_STRING(body); @@ -2460,13 +2645,14 @@ char * MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p, XP_Bool signed_p, XP_Bool good_p, + XP_Bool unverified_p, XP_Bool close_parent_stamp_p, const char *stamp_url) { const char *open = ("%s" "

" "

" - "" + "
" "" "
" "%s\"S/MIME\"%s" @@ -2490,10 +2676,18 @@ MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p, const char *parent_close_early = 0; const char *parent_close_late = 0; char *result = 0; - /* Neither encrypted nor signed means "certs only". */ - if (encrypted_p && signed_p && good_p) /* 111 */ + if (unverified_p) + { + /* an unverified signature can never occur with an encrypted + message; by nature, an unverified signature implies + that not all parts were downloaded. Therefore, the + message could not have been encrypted. */ + middle_key = MK_MIMEHTML_SIGNED_UNVERIFIED; + img_src = "internal-smime-signed-bad"; + } + else if (encrypted_p && signed_p && good_p) /* 111 */ { middle_key = MK_MIMEHTML_ENC_AND_SIGNED; img_src = "internal-smime-encrypted-signed"; @@ -2562,7 +2756,11 @@ MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p, if (stamp_url) { - const char *stamp_text = XP_GetString(MK_MIMEHTML_SHOW_SECURITY_ADVISOR); + const char *stamp_text = 0; + if (unverified_p) + stamp_text = XP_GetString(MK_MIMEHTML_VERIFY_SIGNATURE); + else + stamp_text = XP_GetString(MK_MIMEHTML_SHOW_SECURITY_ADVISOR); href_open = PR_smprintf("", @@ -2700,7 +2898,7 @@ MimeHeaders_get_name(MimeHeaders *hdrs) s = MimeHeaders_get(hdrs, HEADER_CONTENT_DISPOSITION, FALSE, FALSE); if (s) { - name = MimeHeaders_get_parameter(s, HEADER_PARM_FILENAME); + name = MimeHeaders_get_parameter(s, HEADER_PARM_FILENAME, NULL, NULL); XP_FREE(s); } @@ -2709,7 +2907,7 @@ MimeHeaders_get_name(MimeHeaders *hdrs) s = MimeHeaders_get(hdrs, HEADER_CONTENT_TYPE, FALSE, FALSE); if (s) { - name = MimeHeaders_get_parameter(s, HEADER_PARM_NAME); + name = MimeHeaders_get_parameter(s, HEADER_PARM_NAME, NULL, NULL); XP_FREE(s); } } diff --git a/mozilla/lib/libmime/mimehdrs.h b/mozilla/lib/libmime/mimehdrs.h index fc904767ea8..bab3939cebb 100644 --- a/mozilla/lib/libmime/mimehdrs.h +++ b/mozilla/lib/libmime/mimehdrs.h @@ -84,6 +84,7 @@ extern char *MimeHeaders_close_crypto_stamp(void); extern char *MimeHeaders_make_crypto_stamp(XP_Bool encrypted_p, XP_Bool signed_p, XP_Bool good_p, + XP_Bool unverified_p, XP_Bool close_parent_stamp_p, const char *stamp_url); diff --git a/mozilla/lib/libmime/mimei.c b/mozilla/lib/libmime/mimei.c index dee0330a41c..a738856836a 100644 --- a/mozilla/lib/libmime/mimei.c +++ b/mozilla/lib/libmime/mimei.c @@ -20,6 +20,7 @@ Created: Jamie Zawinski , 15-May-96. */ +#include "mime.h" #include "mimeobj.h" /* MimeObject (abstract) */ #include "mimecont.h" /* |--- MimeContainer (abstract) */ #include "mimemult.h" /* | |--- MimeMultipart (abstract) */ @@ -41,13 +42,16 @@ #include "mimetenr.h" /* | | | |--- MimeInlineTextEnriched */ #ifndef MOZILLA_30 #include "mimevcrd.h" /* | | |--------- MimeInlineTextVCard */ +#ifdef MOZ_CALENDAR +#include "mimecal.h" /* | | |--------- MimeInlineTextCalendar */ +#endif #include "prefapi.h" #endif /* !MOZILLA_30 */ #include "mimeiimg.h" /* | |--- MimeInlineImage */ #include "mimeeobj.h" /* | |--- MimeExternalObject */ #include "mimeebod.h" /* |--- MimeExternalBody */ -#ifndef NO_SECURITY +#ifdef MOZ_SECURITY #include "mimesec.h" #endif /* NO_SECURITY */ @@ -148,8 +152,12 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs, else if (!strcasecomp(content_type+5, "plain")) class = (MimeObjectClass *)&mimeInlineTextPlainClass; #ifndef MOZILLA_30 +#ifdef MOZ_CALENDAR else if (!strcasecomp(content_type+5, "x-vcard")) class = (MimeObjectClass *)&mimeInlineTextVCardClass; + else if (!strcasecomp(content_type+5, "calendar")) + class = (MimeObjectClass *)&mimeInlineTextCalendarClass; +#endif #endif /* !MOZILLA_30 */ else if (!exact_match_p) class = (MimeObjectClass *)&mimeInlineTextPlainClass; @@ -554,6 +562,25 @@ mime_part_address(MimeObject *obj) } +/* Returns a string describing the location of the *IMAP* part (like "2.5.3"). + This is not a full URL, just a part-number. + This part is explicitly passed in the X-Mozilla-IMAP-Part header. + Return value must be freed by the caller. + */ +char * +mime_imap_part_address(MimeObject *obj) +{ + char *imap_part = 0; + if (!obj || !obj->headers) + return 0; + + imap_part = MimeHeaders_get(obj->headers, + IMAP_EXTERNAL_CONTENT_HEADER, FALSE, FALSE); + + return imap_part; +} + + /* Asks whether the given object is one of the cryptographically signed or encrypted objects that we know about. (MimeMessageClass uses this to decide if the headers need to be presented differently.) @@ -582,7 +609,7 @@ mime_crypto_object_p(MimeHeaders *hdrs, XP_Bool clearsigned_counts) XP_FREE(ct); #ifndef NO_SECURITY - return mime_is_sec_class_p(class); + return mime_is_sec_class_p(class, clearsigned_counts); #endif /* NO_SECURITY */ } @@ -717,6 +744,26 @@ mime_set_url_part(const char *url, char *part, XP_Bool append_p) } + +/* Puts an *IMAP* part-number into a URL. + */ +char * +mime_set_url_imap_part(const char *url, char *imappart, char *libmimepart) +{ + char *result = (char *) XP_ALLOC(XP_STRLEN(url) + XP_STRLEN(imappart) + XP_STRLEN(libmimepart) + 17); + if (!result) return 0; + + XP_STRCPY(result, url); + XP_STRCAT(result, "/;section="); + XP_STRCAT(result, imappart); + XP_STRCAT(result, "&part="); + XP_STRCAT(result, libmimepart); + result[XP_STRLEN(result)] = 0; + + return result; +} + + /* Given a part ID, looks through the MimeObject tree for a sub-part whose ID number matches, and returns the MimeObject (else NULL.) (part is not a URL -- it's of the form "1.3.5".) @@ -1132,10 +1179,10 @@ MimeObject_output_init(MimeObject *obj, const char *content_type) FALSE, FALSE); if (ct) { - x_mac_type = MimeHeaders_get_parameter(ct,PARAM_X_MAC_TYPE); - x_mac_creator= MimeHeaders_get_parameter(ct,PARAM_X_MAC_CREATOR); + x_mac_type = MimeHeaders_get_parameter(ct,PARAM_X_MAC_TYPE, NULL, NULL); + x_mac_creator= MimeHeaders_get_parameter(ct,PARAM_X_MAC_CREATOR, NULL, NULL); FREEIF(obj->options->default_charset); - obj->options->default_charset = MimeHeaders_get_parameter(ct, "charset"); + obj->options->default_charset = MimeHeaders_get_parameter(ct, "charset", NULL, NULL); XP_FREE(ct); } } diff --git a/mozilla/lib/libmime/mimei.h b/mozilla/lib/libmime/mimei.h index bcf96cfdaa1..eae32ba71f6 100644 --- a/mozilla/lib/libmime/mimei.h +++ b/mozilla/lib/libmime/mimei.h @@ -85,6 +85,8 @@ | | | |--- MimeInlineTextEnriched | | | | | |--- MimeInlineTextVCard + | | | + | | |--- MimeInlineTextCalendar | | | |--- MimeInlineImage | | @@ -231,6 +233,7 @@ typedef struct MimeObjectClass MimeObjectClass; # define mimeInlineTextRichtext mimeInlineTextRichtext16 # define mimeInlineTextEnriched mimeInlineTextEnriched16 # define mimeInlineTextVCard mimeInlineTextVCard16 +# define mimeInlineTextCalendar mimeInlineTextCalendar16 # define mimeInlineImage mimeInlineImage16 # define mimeExternalObject mimeExternalObject16 # define mimeExternalBody mimeExternalBody16 @@ -291,12 +294,23 @@ extern XP_Bool mime_typep(MimeObject *obj, MimeObjectClass *class); */ extern char *mime_part_address(MimeObject *obj); +/* Returns a string describing the location of the *IMAP* part (like "2.5.3"). + This is not a full URL, just a part-number. + This part is explicitly passed in the X-Mozilla-IMAP-Part header. + Return value must be freed by the caller. + */ +extern char *mime_imap_part_address(MimeObject *obj); + /* Puts a part-number into a URL. If append_p is true, then the part number is appended to any existing part-number already in that URL; otherwise, it replaces it. */ extern char *mime_set_url_part(const char *url, char *part, XP_Bool append_p); +/* Puts an *IMAP* part-number into a URL. + */ +extern char *mime_set_url_imap_part(const char *url, char *part, char *libmimepart); + /* Given a part ID, looks through the MimeObject tree for a sub-part whose ID number matches, and returns the MimeObject (else NULL.) @@ -436,8 +450,17 @@ extern int MK_OUT_OF_MEMORY; half-thought-out, and so on. But the current "attachment panel" needs to be destroyed, and this is the only hope. */ #define JS_ATTACHMENT_MUMBO_JUMBO + +extern XP_Bool MimeObjectChildIsMessageBody(MimeObject *obj, + XP_Bool *isAlterOrRelated); + #endif /* MOZILLA_30 */ +/* Sends some mail, without user interaction. */ +extern int +MimeSendMessage(MimeDisplayOptions* options, char* to, char* subject, + char* otherheaders, char* body); + /* #### These ought to be in libxp or nspr, not libmsg... */ diff --git a/mozilla/lib/libmime/mimemoz.c b/mozilla/lib/libmime/mimemoz.c index 9f5b48548e9..fc711937f9a 100644 --- a/mozilla/lib/libmime/mimemoz.c +++ b/mozilla/lib/libmime/mimemoz.c @@ -31,8 +31,13 @@ #include "mimemsig.h" #include "mimecryp.h" #ifndef MOZILLA_30 +#include "mimemrel.h" +#include "mimemalt.h" # include "xpgetstr.h" # include "mimevcrd.h" /* for MIME_VCardConverter */ +#ifdef MOZ_CALENDAR +# include "mimecal.h" /* for MIME_JulianConverter */ +#endif # include "edt.h" extern int XP_FORWARDED_MESSAGE_ATTACHMENT; #endif /* !MOZILLA_30 */ @@ -42,70 +47,28 @@ #include "prprf.h" #include "intl_csi.h" +#if defined(XP_UNIX) || defined(XP_WIN32) +#if defined(MOZ_CALENDAR) + #define JULIAN_EXISTS 1 /* Julian isn't working on mac yet */ +#endif +#endif + + +#ifdef JULIAN_EXISTS +#include "julianform.h" +#endif + #ifdef HAVE_MIME_DATA_SLOT # define LOCK_LAST_CACHED_MESSAGE #endif -/* Interface between netlib and the top-level message/rfc822 parser: - MIME_MessageConverter() - */ +extern int MK_UNABLE_TO_OPEN_TMP_FILE; -struct mime_stream_data { /* This struct is the state we pass around - amongst the various stream functions - used by MIME_MessageConverter(). - */ - - URL_Struct *url; /* The URL this is all coming from. */ - int format_out; - MWContext *context; - NET_StreamClass *stream; /* The stream to which we write output */ - NET_StreamClass *istream; /* The stream we're writing out image data, - if any. */ - MimeObject *obj; /* The root parser object */ - MimeDisplayOptions *options; /* Data for communicating with libmime.a */ - - /* These are used by FO_QUOTE_HTML_MESSAGE stuff only: */ - int16 lastcsid; /* csid corresponding to above. */ - int16 outcsid; /* csid passed to EDT_PasteQuoteINTL */ - -#ifndef MOZILLA_30 - uint8 rand_buf[6]; /* Random number used in the MATCH - attribute of the ILAYER tag - pair that encapsulates a - text/html part. (The - attributes must match on the - ILAYER and the closing - /ILAYER.) This is used to - prevent stray layer tags (or - maliciously placed ones) inside - an email message allowing the - message to escape from its - encapsulated environment. */ -#endif /* MOZILLA_30 */ - -#ifdef DEBUG_terry - XP_File logit; /* Temp file to put generated HTML into. */ -#endif -}; +/* Arrgh. Why isn't this in a reasonable header file somewhere??? ###tw */ +extern char * NET_ExplainErrorDetails (int code, ...); -struct MimeDisplayData { /* This struct is what we hang off of - MWContext->mime_data, to remember info - about the last MIME object we've - parsed and displayed. See - MimeGuessURLContentName() below. - */ - MimeObject *last_parsed_object; - char *last_parsed_url; - -#ifdef LOCK_LAST_CACHED_MESSAGE - char *previous_locked_url; -#endif /* LOCK_LAST_CACHED_MESSAGE */ - -#ifndef MOZILLA_30 - MSG_Pane* last_pane; -#endif /* MOZILLA_30 */ -}; +#include "mimedisp.h" #ifndef MOZILLA_30 @@ -121,7 +84,7 @@ static XP_Bool MIME_PrefDataValid = 0; /* 0: First time. */ #endif /* #### defined in libmsg/msgutils.c */ -extern NET_StreamClass * +extern NET_StreamClass * msg_MakeRebufferingStream (NET_StreamClass *next_stream, URL_Struct *url, MWContext *context); @@ -237,7 +200,7 @@ mime_convert_rfc1522 (const char *input_line, int32 input_length, line[input_length] = 0; } - converted = IntlDecodeMimePartIIStr(line, + converted = IntlDecodeMimePartIIStr(line, INTL_DocToWinCharSetID(INTL_DefaultDocCharSetID(msd->context)), FALSE); if (line != input_line) @@ -347,7 +310,7 @@ mime_display_stream_write (NET_StreamClass *stream, int32 size) { struct mime_stream_data *msd = (struct mime_stream_data *) stream->data_object; - MimeObject *obj = (msd ? msd->obj : 0); + MimeObject *obj = (msd ? msd->obj : 0); if (!obj) return -1; return obj->class->parse_buffer((char *) buf, size, obj); } @@ -356,7 +319,7 @@ mime_display_stream_write (NET_StreamClass *stream, static unsigned int mime_display_stream_write_ready (NET_StreamClass *stream) { - struct mime_stream_data *msd = (struct mime_stream_data *) stream->data_object; + struct mime_stream_data *msd = (struct mime_stream_data *) stream->data_object; if (msd->istream) { return msd->istream->is_write_ready (msd->istream); } else if (msd->stream) @@ -372,7 +335,7 @@ static void mime_display_stream_complete (NET_StreamClass *stream) { struct mime_stream_data *msd = (struct mime_stream_data *) stream->data_object; - MimeObject *obj = (msd ? msd->obj : 0); + MimeObject *obj = (msd ? msd->obj : 0); if (obj) { int status; @@ -468,7 +431,7 @@ static void mime_display_stream_abort (NET_StreamClass *stream, int status) { struct mime_stream_data *msd = (struct mime_stream_data *) stream->data_object; - MimeObject *obj = (msd ? msd->obj : 0); + MimeObject *obj = (msd ? msd->obj : 0); if (obj) { if (!obj->closed_p) @@ -502,12 +465,16 @@ mime_display_stream_abort (NET_StreamClass *stream, int status) } } - if (msd->stream) - { - msd->stream->abort (msd->stream, status); - XP_FREE (msd->stream); - } - XP_FREE(msd); + XP_ASSERT(msd); /* Crash was happening here - jrm */ + if (msd) + { + if (msd->stream) + { + msd->stream->abort (msd->stream, status); + XP_FREE (msd->stream); + } + XP_FREE(msd); + } } @@ -516,7 +483,7 @@ mime_display_stream_abort (NET_StreamClass *stream, int status) static unsigned int mime_insert_html_write_ready(NET_StreamClass *stream) -{ +{ return MAX_WRITE_READY; } @@ -525,7 +492,7 @@ mime_insert_html_put_block(NET_StreamClass *stream, const char* str, int32 lengt { struct mime_stream_data* msd = (struct mime_stream_data*) stream->data_object; char* s = (char*) str; - char c = s[length]; + char c = s[length]; XP_ASSERT(msd); if (!msd) return -1; if (c) { @@ -533,7 +500,7 @@ mime_insert_html_put_block(NET_StreamClass *stream, const char* str, int32 lengt } /* s is in the outcsid encoding at this point. That was done in * mime_insert_html_convert_charset */ - EDT_PasteQuoteINTL(msd->context, s, msd->outcsid); + EDT_PasteQuoteINTL(msd->context, s, msd->outcsid); if (c) { s[length] = c; } @@ -544,7 +511,7 @@ mime_insert_html_put_block(NET_StreamClass *stream, const char* str, int32 lengt static void mime_insert_html_complete(NET_StreamClass *stream) { - struct mime_stream_data* msd = (struct mime_stream_data*) stream->data_object; + struct mime_stream_data* msd = (struct mime_stream_data*) stream->data_object; XP_ASSERT(msd); if (!msd) return; EDT_PasteQuote(msd->context, ""); @@ -563,7 +530,7 @@ mime_insert_html_complete(NET_StreamClass *stream) static void mime_insert_html_abort(NET_StreamClass *stream, int status) -{ +{ mime_insert_html_complete(stream); } @@ -630,7 +597,7 @@ mime_make_output_stream(const char *content_type, /* Special case here. Make a stream that just jams data directly into our editor context. No calling of NET_StreamBuilder for me; I don't really understand it anyway... */ - + XP_ASSERT(msd); if (msd) { stream = XP_NEW_ZAP(NET_StreamClass); @@ -670,10 +637,10 @@ mime_make_output_stream(const char *content_type, right application will get launched when the file is clicked on, etc.) [mwelch: I'm not adding FO_EDT_SAVE_IMAGE here, because the editor, to - the best of my knowledge, never spools out a message per se; such a message - would be filed as an attachment (FO_CACHE_AND_MAIL_TO), independent of the - editor. In addition, we want to drill down as far as we can within a quoted - message, in order to identify whatever part has been requested (usually an + the best of my knowledge, never spools out a message per se; such a message + would be filed as an attachment (FO_CACHE_AND_MAIL_TO), independent of the + editor. In addition, we want to drill down as far as we can within a quoted + message, in order to identify whatever part has been requested (usually an image, sound, applet, or other inline data).] In 3.0b7 and earlier, we did this for *all* types. On 9-Aug-96 jwz and @@ -732,8 +699,10 @@ mime_make_output_stream(const char *content_type, } stream = NET_StreamBuilder (format_out, url, context); - if (stream) + if (stream && (context->type != MWContextMessageComposition)) { + /* Bug #110565: do not change the stream to a rebuffering stream + when we have a Mail Compose context */ NET_StreamClass * buffer = msg_MakeRebufferingStream(stream, url, context); if (buffer) stream = buffer; @@ -893,7 +862,7 @@ mime_output_init_fn (const char *type, = free object-1 = save object-2 in context->mime_data = done with object-2; free nothing. - + Look at message-1, then look at message-1-part-A: The flow of control in this case is somewhat different: @@ -992,7 +961,7 @@ mime_PrefsChangeCallback(const char* prefname, void* data) #endif /* !MOZILLA_30 */ -NET_StreamClass * +NET_StreamClass * MIME_MessageConverter (int format_out, void *closure, URL_Struct *url, MWContext *context) { @@ -1021,7 +990,10 @@ MIME_MessageConverter (int format_out, void *closure, #if defined(XP_WIN) || defined(XP_OS2) msd->logit = XP_FileOpen("C:\\temp\\twtemp.html", xpTemporary, XP_FILE_WRITE); #endif +#if defined(XP_UNIX) + msd->logit = XP_FileOpen("/tmp/twtemp.html", xpTemporary, XP_FILE_WRITE); #endif +#endif /* DEBUG_terry */ msd->url = url; msd->context = context; msd->format_out = format_out; @@ -1052,7 +1024,7 @@ MIME_MessageConverter (int format_out, void *closure, XP_FREE (opt2); url->fe_data = 0; msd->options->attachment_icon_layer_id = 0; /* Sigh... */ - } + } /* Set the defaults, based on the context, and the output-type. */ @@ -1069,7 +1041,7 @@ MIME_MessageConverter (int format_out, void *closure, format_out == FO_CACHE_AND_PRESENT) msd->options->output_vcard_buttons_p = TRUE; #endif /* !MOZILLA_30 */ - + if (format_out == FO_PRESENT || format_out == FO_CACHE_AND_PRESENT) { msd->options->fancy_links_p = TRUE; @@ -1221,7 +1193,7 @@ MIME_MessageConverter (int format_out, void *closure, if (format_out == FO_QUOTE_HTML_MESSAGE) { msd->options->charset_conversion_fn = mime_insert_html_convert_charset; msd->options->dont_touch_citations_p = TRUE; - } else + } else #endif msd->options->charset_conversion_fn = mime_convert_charset; msd->options->rfc1522_conversion_fn = mime_convert_rfc1522; @@ -1475,7 +1447,7 @@ mime_image_write_buffer(char *buf, int32 size, void *image_closure) be returned. (This string will be relative to the URL in the window.) Else, returns NULL. */ -static char * +char * mime_extract_relative_part_address(MWContext *context, const char *url) { char *url1 = 0, *url2 = 0, *part = 0, *result = 0; /* free these */ @@ -1723,11 +1695,74 @@ mime_get_main_object(MimeObject* obj) } +XP_Bool MimeObjectChildIsMessageBody(MimeObject *obj, + XP_Bool *isAlternativeOrRelated) +{ + char *disp = 0; + XP_Bool bRet = FALSE; + MimeObject *firstChild = 0; + MimeContainer *container = (MimeContainer*) obj; + + if (isAlternativeOrRelated) + *isAlternativeOrRelated = FALSE; + + if (!container || + !mime_subclass_p(obj->class, + (MimeObjectClass*) &mimeContainerClass)) + { + return bRet; + } + else if (mime_subclass_p(obj->class, (MimeObjectClass*) + &mimeMultipartRelatedClass)) + { + if (isAlternativeOrRelated) + *isAlternativeOrRelated = TRUE; + return bRet; + } + else if (mime_subclass_p(obj->class, (MimeObjectClass*) + &mimeMultipartAlternativeClass)) + { + if (isAlternativeOrRelated) + *isAlternativeOrRelated = TRUE; + return bRet; + } + + if (container->children) + firstChild = container->children[0]; + + if (!firstChild || + !firstChild->content_type || + !firstChild->headers) + return bRet; + + disp = MimeHeaders_get (firstChild->headers, + HEADER_CONTENT_DISPOSITION, + TRUE, + FALSE); + if (disp /* && !strcasecomp (disp, "attachment") */) + bRet = FALSE; + else if (!strcasecomp (firstChild->content_type, TEXT_PLAIN) || + !strcasecomp (firstChild->content_type, TEXT_HTML) || + !strcasecomp (firstChild->content_type, TEXT_MDL) || + !strcasecomp (firstChild->content_type, MULTIPART_ALTERNATIVE) || + !strcasecomp (firstChild->content_type, MULTIPART_RELATED) || + !strcasecomp (firstChild->content_type, MESSAGE_NEWS) || + !strcasecomp (firstChild->content_type, MESSAGE_RFC822)) + bRet = TRUE; + else + bRet = FALSE; + FREEIF(disp); + return bRet; +} + + int MimeGetAttachmentCount(MWContext* context) { MimeObject* obj; MimeContainer* cobj; + XP_Bool isMsgBody = FALSE, isAlternativeOrRelated = FALSE; + XP_ASSERT(context); if (!context || !context->mime_data || @@ -1735,15 +1770,20 @@ MimeGetAttachmentCount(MWContext* context) return 0; } obj = mime_get_main_object(context->mime_data->last_parsed_object); - if (!mime_subclass_p(obj->class, (MimeObjectClass*) &mimeContainerClass)) { - + if (!mime_subclass_p(obj->class, (MimeObjectClass*) &mimeContainerClass)) return 0; - } + cobj = (MimeContainer*) obj; - return cobj->nchildren - 1; /* ### Hardcoding subtraction of one isn't - quite right; we have to look at the first - object and decide whether it is the body or - the first attachment on a NULL body. */ + + isMsgBody = MimeObjectChildIsMessageBody(obj, + &isAlternativeOrRelated); + + if (isAlternativeOrRelated) + return 0; + else if (isMsgBody) + return cobj->nchildren - 1; + else + return cobj->nchildren; } @@ -1757,6 +1797,8 @@ MimeGetAttachmentList(MWContext* context, MSG_AttachmentData** data) int32 i; char* disp; char c; + XP_Bool isMsgBody = FALSE, isAlternativeOrRelated = FALSE; + if (!data) return 0; *data = NULL; XP_ASSERT(context); @@ -1769,6 +1811,11 @@ MimeGetAttachmentList(MWContext* context, MSG_AttachmentData** data) if (!mime_subclass_p(obj->class, (MimeObjectClass*) &mimeContainerClass)) { return 0; } + isMsgBody = MimeObjectChildIsMessageBody(obj, + &isAlternativeOrRelated); + if (isAlternativeOrRelated) + return 0; + cobj = (MimeContainer*) obj; n = cobj->nchildren; /* This is often too big, but that's OK. */ if (n <= 0) return n; @@ -1779,12 +1826,32 @@ MimeGetAttachmentList(MWContext* context, MSG_AttachmentData** data) if (XP_STRCHR(context->mime_data->last_parsed_url, '?')) { c = '&'; } - for (i=1 /*###ick, see above*/ ; inchildren ; i++, tmp++) { + + /* let's figure out where to start */ + if (isMsgBody) + i = 1; + else + i = 0; + + for ( ; inchildren ; i++, tmp++) { MimeObject* child = cobj->children[i]; char* part = mime_part_address(child); + char* imappart = NULL; if (!part) return MK_OUT_OF_MEMORY; - tmp->url = PR_smprintf("%s%cpart=%s", context->mime_data->last_parsed_url, + if (obj->options->missing_parts) + imappart = mime_imap_part_address (child); + if (imappart) + { + tmp->url = mime_set_url_imap_part(context->mime_data->last_parsed_url, imappart, part); + } + else + { + tmp->url = mime_set_url_part(context->mime_data->last_parsed_url, part, TRUE); + } + /* + tmp->url = PR_smprintf("%s%cpart=%s", context->mime_data->last_parsed_url, c, part); + */ if (!tmp->url) return MK_OUT_OF_MEMORY; tmp->real_type = child->content_type ? XP_STRDUP(child->content_type) : NULL; @@ -1792,7 +1859,7 @@ MimeGetAttachmentList(MWContext* context, MSG_AttachmentData** data) disp = MimeHeaders_get(child->headers, HEADER_CONTENT_DISPOSITION, FALSE, FALSE); if (disp) { - tmp->real_name = MimeHeaders_get_parameter(disp, "filename"); + tmp->real_name = MimeHeaders_get_parameter(disp, "filename", NULL, NULL); if (tmp->real_name) { char *fname = NULL; @@ -1809,8 +1876,23 @@ MimeGetAttachmentList(MWContext* context, MSG_AttachmentData** data) FALSE, FALSE); if (disp) { - tmp->x_mac_type = MimeHeaders_get_parameter(disp, PARAM_X_MAC_TYPE); - tmp->x_mac_creator= MimeHeaders_get_parameter(disp, PARAM_X_MAC_CREATOR); + tmp->x_mac_type = MimeHeaders_get_parameter(disp, PARAM_X_MAC_TYPE, NULL, NULL); + tmp->x_mac_creator= MimeHeaders_get_parameter(disp, PARAM_X_MAC_CREATOR, NULL, NULL); + if (!tmp->real_name || *tmp->real_name == 0) + { + XP_FREEIF(tmp->real_name); + tmp->real_name = MimeHeaders_get_parameter(disp, "name", NULL, NULL); + if (tmp->real_name) + { + char *fname = NULL; + fname = mime_decode_filename(tmp->real_name); + if (fname && fname != tmp->real_name) + { + XP_FREE(tmp->real_name); + tmp->real_name = fname; + } + } + } XP_FREE(disp); } tmp->description = MimeHeaders_get(child->headers, @@ -1818,7 +1900,7 @@ MimeGetAttachmentList(MWContext* context, MSG_AttachmentData** data) FALSE, FALSE); #ifndef MOZILLA_30 if (tmp->real_type && !strcasecomp(tmp->real_type, MESSAGE_RFC822) && - (!tmp->real_name || *tmp->real_name)) + (!tmp->real_name || *tmp->real_name == 0)) { StrAllocCopy(tmp->real_name, XP_GetString(XP_FORWARDED_MESSAGE_ATTACHMENT)); } @@ -1864,7 +1946,7 @@ MimeDestroyContextData(MWContext *context) csi = LO_GetDocumentCharacterSetInfo(context); if (csi) INTL_SetCSIMimeCharset(csi, NULL); - + if (!context->mime_data) return; if (context->mime_data->last_parsed_object) @@ -1944,7 +2026,7 @@ struct mime_richtext_data { XP_Bool enriched_p; }; -static int +static int mime_richtext_stream_fn (char *buf, int32 size, void *closure) { struct mime_richtext_data *mrd = (struct mime_richtext_data *) closure; @@ -1965,7 +2047,7 @@ mime_richtext_write_line (char* line, int32 size, void *closure) static int mime_richtext_write (NET_StreamClass *stream, const char* buf, int32 size) { - struct mime_richtext_data *data = (struct mime_richtext_data *) stream->data_object; + struct mime_richtext_data *data = (struct mime_richtext_data *) stream->data_object; return msg_LineBuffer (buf, size, &data->ibuffer, &data->ibuffer_size, &data->ibuffer_fp, FALSE, mime_richtext_write_line, data); @@ -1974,7 +2056,7 @@ mime_richtext_write (NET_StreamClass *stream, const char* buf, int32 size) static unsigned int mime_richtext_write_ready (NET_StreamClass *stream) { - struct mime_richtext_data *data = (struct mime_richtext_data *) stream->data_object; + struct mime_richtext_data *data = (struct mime_richtext_data *) stream->data_object; if (data->stream) return ((*data->stream->is_write_ready) (data->stream)); @@ -1985,7 +2067,7 @@ mime_richtext_write_ready (NET_StreamClass *stream) static void mime_richtext_complete (NET_StreamClass *stream) { - struct mime_richtext_data *mrd = (struct mime_richtext_data *) stream->data_object; + struct mime_richtext_data *mrd = (struct mime_richtext_data *) stream->data_object; if (!mrd) return; FREEIF(mrd->obuffer); if (mrd->stream) @@ -1999,7 +2081,7 @@ mime_richtext_complete (NET_StreamClass *stream) static void mime_richtext_abort (NET_StreamClass *stream, int status) { - struct mime_richtext_data *mrd = (struct mime_richtext_data *) stream->data_object; + struct mime_richtext_data *mrd = (struct mime_richtext_data *) stream->data_object; if (!mrd) return; FREEIF(mrd->obuffer); if (mrd->stream) @@ -2011,7 +2093,7 @@ mime_richtext_abort (NET_StreamClass *stream, int status) } -static NET_StreamClass * +static NET_StreamClass * MIME_RichtextConverter_1 (int format_out, void *closure, URL_Struct *url, MWContext *context, XP_Bool enriched_p) @@ -2058,14 +2140,14 @@ MIME_RichtextConverter_1 (int format_out, void *closure, return stream; } -NET_StreamClass * +NET_StreamClass * MIME_RichtextConverter (int format_out, void *closure, URL_Struct *url, MWContext *context) { return MIME_RichtextConverter_1 (format_out, closure, url, context, FALSE); } -NET_StreamClass * +NET_StreamClass * MIME_EnrichedTextConverter (int format_out, void *closure, URL_Struct *url, MWContext *context) { @@ -2099,7 +2181,7 @@ MIME_DisplayAttachmentPane(MWContext* context) /* This struct is the state we used in MIME_VCardConverter() */ struct mime_vcard_data { URL_Struct *url; /* original url */ - int format_out; /* intended output format; + int format_out; /* intended output format; should be TEXT-VCARD */ MWContext *context; NET_StreamClass *stream; /* not used for now */ @@ -2112,7 +2194,7 @@ mime_vcard_write (NET_StreamClass *stream, const char *buf, int32 size ) { - struct mime_vcard_data *vcd = (struct mime_vcard_data *) stream->data_object; + struct mime_vcard_data *vcd = (struct mime_vcard_data *) stream->data_object; XP_ASSERT ( vcd ); if ( !vcd || !vcd->obj ) return -1; @@ -2123,7 +2205,7 @@ mime_vcard_write (NET_StreamClass *stream, static unsigned int mime_vcard_write_ready (NET_StreamClass *stream) { - struct mime_vcard_data *vcd = (struct mime_vcard_data *) stream->data_object; + struct mime_vcard_data *vcd = (struct mime_vcard_data *) stream->data_object; XP_ASSERT (vcd); if (!vcd) return MAX_WRITE_READY; @@ -2136,18 +2218,18 @@ mime_vcard_write_ready (NET_StreamClass *stream) static void mime_vcard_complete (NET_StreamClass *stream) { - struct mime_vcard_data *vcd = (struct mime_vcard_data *) stream->data_object; - + struct mime_vcard_data *vcd = (struct mime_vcard_data *) stream->data_object; + XP_ASSERT (vcd); if (!vcd) return; - + if (vcd->obj) { int status; status = vcd->obj->class->parse_eof ( vcd->obj, FALSE ); vcd->obj->class->parse_end( vcd->obj, status < 0 ? TRUE : FALSE ); - + mime_free (vcd->obj); vcd->obj = 0; @@ -2163,21 +2245,21 @@ static void mime_vcard_abort (NET_StreamClass *stream, int status ) { struct mime_vcard_data *vcd = (struct mime_vcard_data *) stream->data_object; - + XP_ASSERT (vcd); if (!vcd) return; - + if (vcd->obj) { int status; - + if ( !vcd->obj->closed_p ) status = vcd->obj->class->parse_eof ( vcd->obj, TRUE ); if ( !vcd->obj->parsed_p ) vcd->obj->class->parse_end( vcd->obj, TRUE ); - + mime_free (vcd->obj); vcd->obj = 0; - + if (vcd->stream) { vcd->stream->abort (vcd->stream, status); XP_FREE( vcd->stream ); @@ -2214,7 +2296,7 @@ MIME_VCardConverter ( int format_out, if (!next_stream) return 0; - + vcd = XP_NEW_ZAP (struct mime_vcard_data); if (!vcd) { XP_FREE (next_stream); @@ -2259,7 +2341,7 @@ MIME_VCardConverter ( int format_out, XP_FREE ( vcd ); return 0; } - + obj->options = vcd->options; vcd->obj = obj; @@ -2298,3 +2380,245 @@ MIME_VCardConverter ( int format_out, } #endif /* !MOZILLA_30 */ + + + +int +MimeSendMessage(MimeDisplayOptions* options, char* to, char* subject, + char* otherheaders, char* body) +{ + struct mime_stream_data* msd = + (struct mime_stream_data*) options->stream_closure; + return NET_SendMessageUnattended(msd->context, to, subject, + otherheaders, body); +} + + +int +mime_TranslateCalendar(char* caldata, char** html) +{ +#ifdef JULIAN_EXISTS + static XP_Bool initialized = FALSE; + void* closure; + if (!initialized) { + Julian_Form_Callback_Struct jcbs; + + jcbs.callbackurl = NET_CallbackURLCreate; + jcbs.callbackurlfree = NET_CallbackURLFree; + jcbs.ParseURL = NET_ParseURL; + jcbs.MakeNewWindow = FE_MakeNewWindow; + jcbs.CreateURLStruct = NET_CreateURLStruct; + jcbs.StreamBuilder = NET_StreamBuilder; + jcbs.SACopy = NET_SACopy; + + /* John Sun added 4-22-98 */ + jcbs.SendMessageUnattended = NET_SendMessageUnattended; + jcbs.DestroyWindow = FE_DestroyWindow; + + jcbs.GetString = XP_GetString; + + jf_Initialize(&jcbs); + initialized = TRUE; + } + closure = jf_New(caldata); + *html = jf_getForm(closure); + jf_Destroy(closure); + return 0; +#else + *html = XP_STRDUP("Can't handle calendar data on this platform yet"); + return 0; +#endif /* JULIAN_EXISTS */ +} + + + +/* + * + * MIME_JulianConverter Stream handler stuff + * + */ + +#ifdef MOZ_CALENDAR +struct mime_calendar_data { + URL_Struct *url; /* original url */ + int format_out; /* intended output format; should be TEXT-CALENDAR */ + MWContext *context; + NET_StreamClass *stream; /* not used for now */ + MimeDisplayOptions *options; /* data for communicating with libmime.a */ + MimeObject *obj; /* The root */ +}; + + +static int mime_calendar_write (void *stream, const char *buf, int32 size ) +{ + struct mime_calendar_data *cald = (struct mime_calendar_data *) stream; + XP_ASSERT ( cald ); + + if ( !cald || !cald->obj ) return -1; + + return cald->obj->class->parse_line ((char *) buf, size, cald->obj); +} + +static unsigned int mime_calendar_write_ready (void *stream) +{ + struct mime_calendar_data *cald = (struct mime_calendar_data *) stream; + XP_ASSERT (cald); + + if (!cald) return MAX_WRITE_READY; + if (cald->stream) + return cald->stream->is_write_ready ( cald->stream->data_object ); + else + return MAX_WRITE_READY; +} + +static void mime_calendar_complete (void *stream) +{ + struct mime_calendar_data *cald = (struct mime_calendar_data *) stream; + + XP_ASSERT (cald); + + if (!cald) return; + + if (cald->obj) { + int status; + + status = cald->obj->class->parse_eof ( cald->obj, FALSE ); + cald->obj->class->parse_end( cald->obj, status < 0 ? TRUE : FALSE ); + + mime_free (cald->obj); + cald->obj = 0; + + if (cald->stream) { + cald->stream->complete (cald->stream->data_object); + XP_FREE( cald->stream ); + cald->stream = 0; + } + } +} + +static void mime_calendar_abort (void *stream, int status ) +{ + struct mime_calendar_data *cald = (struct mime_calendar_data *) stream; + + XP_ASSERT (cald); + if (!cald) return; + + if (cald->obj) { + int status; + + if ( !cald->obj->closed_p ) + status = cald->obj->class->parse_eof ( cald->obj, TRUE ); + if ( !cald->obj->parsed_p ) + cald->obj->class->parse_end( cald->obj, TRUE ); + + mime_free (cald->obj); + cald->obj = 0; + + if (cald->stream) { + cald->stream->abort (cald->stream->data_object, status); + XP_FREE( cald->stream ); + cald->stream = 0; + } + } + XP_FREE (cald); +} + +extern NET_StreamClass * MIME_JulianConverter (int format_out, void *closure, URL_Struct *url, MWContext *context ) +{ + int status = 0; + NET_StreamClass * stream = NULL; + NET_StreamClass * next_stream = NULL; + struct mime_calendar_data *cald = NULL; + MimeObject *obj; + + XP_ASSERT (url && context); + if ( !url || !context ) return NULL; + + next_stream = mime_make_output_stream (TEXT_HTML, 0, 0, 0, 0, + format_out, url, context, NULL); + + if (!next_stream) return 0; + + cald = XP_NEW_ZAP (struct mime_calendar_data); + if (!cald) { + XP_FREE (next_stream); + return 0; + } + + cald->url = url; + cald->context = context; + cald->format_out = format_out; + cald->stream = next_stream; + + cald->options = XP_NEW_ZAP ( MimeDisplayOptions ); + + if ( !cald->options ) { + XP_FREE (next_stream); + XP_FREE ( cald ); + return 0; + } + + cald->options->write_html_p = TRUE; + cald->options->output_fn = mime_output_fn; + if (format_out == FO_PRESENT || + format_out == FO_CACHE_AND_PRESENT) + cald->options->output_vcard_buttons_p = FALSE; + +#ifdef MIME_DRAFTS + cald->options->decompose_file_p = FALSE; /* new field in MimeDisplayOptions */ +#endif /* MIME_DRAFTS */ + + cald->options->url = url->address; + cald->options->stream_closure = cald; + cald->options->html_closure = cald; + + obj = mime_new ( (MimeObjectClass *) &mimeInlineTextCalendarClass, + (MimeHeaders *) NULL, + TEXT_CALENDAR ); + + if ( !obj ) { + FREEIF( cald->options->part_to_load ); + XP_FREE ( next_stream ); + XP_FREE ( cald->options ); + XP_FREE ( cald ); + return 0; + } + + obj->options = cald->options; + cald->obj = obj; + + stream = XP_NEW_ZAP ( NET_StreamClass ); + if ( !stream ) { + FREEIF ( cald->options->part_to_load ); + XP_FREE ( next_stream ); + XP_FREE ( cald->options ); + XP_FREE ( cald ); + XP_FREE ( obj ); + return 0; + } + + stream->name = "MIME To Calendar Converter Stream"; + stream->complete = mime_calendar_complete; + stream->abort = mime_calendar_abort; + stream->put_block = mime_calendar_write; + stream->is_write_ready = mime_calendar_write_ready; + stream->data_object = cald; + stream->window_id = context; + + status = obj->class->initialize ( obj ); + if ( status >= 0 ) + status = obj->class->parse_begin ( obj ); + if ( status < 0 ) { + XP_FREE ( stream ); + FREEIF( cald->options->part_to_load ); + XP_FREE ( next_stream ); + XP_FREE ( cald->options ); + XP_FREE ( cald ); + XP_FREE ( obj ); + return 0; + } + + return stream; +} +#endif + diff --git a/mozilla/lib/libmime/mimemrel.c b/mozilla/lib/libmime/mimemrel.c index 7e5f5009b42..c4d14f1efbc 100644 --- a/mozilla/lib/libmime/mimemrel.c +++ b/mozilla/lib/libmime/mimemrel.c @@ -136,6 +136,13 @@ MimeMultipartRelated_initialize(MimeObject* obj) MimeMultipartRelated* relobj = (MimeMultipartRelated*) obj; relobj->base_url = MimeHeaders_get(obj->headers, "Content-Base", FALSE, FALSE); + /* rhp: need this for supporting Content-Location */ + if (!relobj->base_url) + { + relobj->base_url = MimeHeaders_get(obj->headers, "Content-Location", + FALSE, FALSE); + } + /* rhp: need this for supporting Content-Location */ /* I used to have code here to test if the type was text/html. Then I added multipart/alternative as being OK, too. Then I found that the @@ -232,17 +239,82 @@ escape_for_mrel_subst(char *inURL) } return output; } +/* rhp - need to support start parameter */ +#define HEADER_PARM_START "start" /* this goes in libmime.h */ + +static XP_Bool +MimeStartParamExists(MimeObject *obj, MimeObject* child) +{ + char *ct = MimeHeaders_get (obj->headers, HEADER_CONTENT_TYPE, FALSE, FALSE); + char *st = (ct + ? MimeHeaders_get_parameter(ct, HEADER_PARM_START, NULL, NULL) + : 0); + if (!st) + return FALSE; + + FREEIF(st); + FREEIF(ct); + return TRUE; +} + +static XP_Bool +MimeThisIsStartPart(MimeObject *obj, MimeObject* child) +{ + XP_Bool rval = FALSE; + char *ct, *st, *cst; + + ct = MimeHeaders_get (obj->headers, HEADER_CONTENT_TYPE, FALSE, FALSE); + st = (ct + ? MimeHeaders_get_parameter(ct, HEADER_PARM_START, NULL, NULL) + : 0); + if (!st) + return FALSE; + + cst = MimeHeaders_get(child->headers, "Content-ID", FALSE, FALSE); + if (!cst) + rval = FALSE; + else + { + char *tmp = cst; + if (*tmp == '<') + { + int length; + tmp++; + length = XP_STRLEN(tmp); + if (length > 0 && tmp[length - 1] == '>') + { + tmp[length - 1] = '\0'; + } + } + + rval = (!XP_STRCMP(st, tmp)); + } + + FREEIF(st); + FREEIF(ct); + FREEIF(cst); + return rval; +} +/* rhp - gotta support the "start" parameter */ static XP_Bool MimeMultipartRelated_output_child_p(MimeObject *obj, MimeObject* child) { MimeMultipartRelated *relobj = (MimeMultipartRelated *) obj; - if (relobj->head_loaded) { + + /* rhp - Changed from "if (relobj->head_loaded)" alone to support the + start parameter + */ + if ( + (relobj->head_loaded) || + (MimeStartParamExists(obj, child) && !MimeThisIsStartPart(obj, child)) + ) + { /* This is a child part. Just remember the mapping between the URL it represents and the part-URL to get it back. */ char* location = MimeHeaders_get(child->headers, "Content-Location", FALSE, FALSE); - if (!location) { + if (!location) { char* tmp = MimeHeaders_get(child->headers, "Content-ID", FALSE, FALSE); if (tmp) { @@ -258,13 +330,21 @@ MimeMultipartRelated_output_child_p(MimeObject *obj, MimeObject* child) location = PR_smprintf("cid:%s", tmp2); XP_FREE(tmp); } - } - if (location) { - char* base_url = MimeHeaders_get(child->headers, "Content-Base", + } + + if (location) { + char *absolute; + char *base_url = MimeHeaders_get(child->headers, "Content-Base", FALSE, FALSE); - char* absolute = - NET_MakeAbsoluteURL(base_url ? base_url : relobj->base_url, - location); + /* rhp: need this for supporting Content-Location */ + if (!base_url) + { + base_url = MimeHeaders_get(child->headers, "Content-Location", FALSE, FALSE); + } + /* rhp: need this for supporting Content-Location */ + + absolute = NET_MakeAbsoluteURL(base_url ? base_url : relobj->base_url, location); + FREEIF(base_url); XP_FREE(location); if (absolute) { @@ -281,6 +361,36 @@ MimeMultipartRelated_output_child_p(MimeObject *obj, MimeObject* child) temp = escape_for_mrel_subst(part); XP_Puthash(relobj->hash, absolute, temp); + /* rhp - If this part ALSO has a Content-ID we need to put that into + the hash table and this is what this code does + */ + { + char *tloc; + char *tmp = MimeHeaders_get(child->headers, "Content-ID", FALSE, FALSE); + if (tmp) + { + char* tmp2 = tmp; + if (*tmp2 == '<') + { + int length; + tmp2++; + length = XP_STRLEN(tmp2); + if (length > 0 && tmp2[length - 1] == '>') + { + tmp2[length - 1] = '\0'; + } + } + + tloc = PR_smprintf("cid:%s", tmp2); + XP_FREE(tmp); + if (tloc) + { + XP_Puthash(relobj->hash, tloc, XP_STRDUP(temp)); + } + } + } + /* rhp - End of putting more stuff into the hash table */ + /* The value string that is added to the hashtable will be deleted by the hashtable at destruction time. So if we created an escaped string for the hashtable, we have to delete the @@ -299,6 +409,13 @@ MimeMultipartRelated_output_child_p(MimeObject *obj, MimeObject* child) relobj->buffered_hdrs = MimeHeaders_copy(child->headers); base_url = MimeHeaders_get(child->headers, "Content-Base", FALSE, FALSE); + /* rhp: need this for supporting Content-Location */ + if (!base_url) + { + base_url = MimeHeaders_get(child->headers, "Content-Location", FALSE, FALSE); + } + /* rhp: need this for supporting Content-Location */ + if (base_url) { /* If the head object has a base_url associated with it, use that instead of any base_url that may have been associated @@ -544,7 +661,7 @@ flush_tag(MimeMultipartRelated* relobj) *ptr2 = '\0'; /* Construct a URL out of the word. */ - absolute = NET_MakeAbsoluteURL(relobj->base_url, buf); + absolute = NET_MakeAbsoluteURL(relobj->base_url, buf); /* See if we have a mailbox part URL corresponding to this cid. */ @@ -563,6 +680,35 @@ flush_tag(MimeMultipartRelated* relobj) /* Restore the character that we nulled. */ *ptr2 = c; } + /* rhp - if we get here, we should still check against the hash table! */ + else + { + char holder = *ptr2; + char *realout; + + *ptr2 = '\0'; + + /* Construct a URL out of the word. */ + absolute = NET_MakeAbsoluteURL(relobj->base_url, buf); + + /* See if we have a mailbox part URL + corresponding to this cid. */ + if (absolute) + realout = XP_Gethash(relobj->hash, absolute, NULL); + else + realout = XP_Gethash(relobj->hash, buf, NULL); + + *ptr2 = holder; + FREEIF(absolute); + + if (realout) + { + status = real_write(relobj, realout, XP_STRLEN(realout)); + if (status < 0) return status; + buf = ptr2; /* skip over the cid: URL we substituted */ + } + } + /* rhp - if we get here, we should still check against the hash table! */ /* Advance to the beginning of the next word, or to the end of the value string. */ diff --git a/mozilla/lib/libmime/mimemult.c b/mozilla/lib/libmime/mimemult.c index 9790ab30245..2f63e5111c5 100644 --- a/mozilla/lib/libmime/mimemult.c +++ b/mozilla/lib/libmime/mimemult.c @@ -21,6 +21,7 @@ */ #include "mimemult.h" +#include "mime.h" #define MIME_SUPERCLASS mimeContainerClass MimeDefClass(MimeMultipart, MimeMultipartClass, @@ -85,7 +86,7 @@ MimeMultipart_initialize (MimeObject *object) ct = MimeHeaders_get (object->headers, HEADER_CONTENT_TYPE, FALSE, FALSE); mult->boundary = (ct - ? MimeHeaders_get_parameter (ct, HEADER_PARM_BOUNDARY) + ? MimeHeaders_get_parameter (ct, HEADER_PARM_BOUNDARY, NULL, NULL) : 0); FREEIF(ct); mult->state = MimeMultipartPreamble; @@ -321,10 +322,23 @@ MimeMultipart_create_child(MimeObject *obj) ->output_child_p(obj, body)); if (body->output_p) { +#ifdef JS_ATTACHMENT_MUMBO_JUMBO + int attachment_count = 0; + XP_Bool isMsgBody = FALSE, isAlternativeOrRelated = FALSE; +#endif status = body->class->parse_begin(body); if (status < 0) return status; #ifdef JS_ATTACHMENT_MUMBO_JUMBO - if (cont->nchildren > 1 && + isMsgBody = MimeObjectChildIsMessageBody + (obj, &isAlternativeOrRelated); + if (isAlternativeOrRelated) + attachment_count = 0; + else if (isMsgBody) + attachment_count = cont->nchildren - 1; + else + attachment_count = cont->nchildren; + + if (attachment_count && obj->options && !obj->options->nice_html_only_p && obj->options->attachment_icon_layer_id) { /* This is not the first child, so it's an attachment. Cause the @@ -345,6 +359,12 @@ MimeMultipart_create_child(MimeObject *obj) showIcon = FALSE; else if (XP_STRSTR(body->content_type, "message/rfc822")) showIcon = FALSE; + else if (XP_STRSTR(body->content_type, "multipart/signed")) + showIcon = FALSE; + else if (XP_STRSTR(body->content_type, "application/x-pkcs7-signature")) + showIcon = FALSE; + else if (XP_STRSTR(body->content_type, "multipart/mixed")) + showIcon = FALSE; if (showIcon) { diff --git a/mozilla/lib/libmime/mimestub.c b/mozilla/lib/libmime/mimestub.c index b93e85e70c2..f72ec6e6914 100644 --- a/mozilla/lib/libmime/mimestub.c +++ b/mozilla/lib/libmime/mimestub.c @@ -912,7 +912,7 @@ NET_MakeAbsoluteURL(char * absolute_url, char * relative_url) NET_MakeAbsoluteURL("news://h/123@4", "456@7") => "news://h/456@7". */ base_type = NET_URL_Type(absolute_url); - if (base_type == MAILBOX_TYPE_URL && + if ((base_type == MAILBOX_TYPE_URL || base_type == IMAP_TYPE_URL) && *relative_url != '#' && *relative_url != '?') { diff --git a/mozilla/lib/libmime/mimetext.c b/mozilla/lib/libmime/mimetext.c index 8ce65cd82c3..c6d6b450023 100644 --- a/mozilla/lib/libmime/mimetext.c +++ b/mozilla/lib/libmime/mimetext.c @@ -73,7 +73,7 @@ MimeInlineText_initialize (MimeObject *obj) FALSE, FALSE); if (ct) { - text->charset = MimeHeaders_get_parameter (ct, "charset"); + text->charset = MimeHeaders_get_parameter (ct, "charset", NULL, NULL); XP_FREE(ct); } diff --git a/mozilla/lib/libmime/mimethtm.c b/mozilla/lib/libmime/mimethtm.c index 504fdc55f2f..dbe137420ac 100644 --- a/mozilla/lib/libmime/mimethtm.c +++ b/mozilla/lib/libmime/mimethtm.c @@ -61,6 +61,13 @@ MimeInlineTextHTML_parse_begin (MimeObject *obj) char *base_hdr = MimeHeaders_get (obj->headers, HEADER_CONTENT_BASE, FALSE, FALSE); + /* rhp - for MHTML Spec changes!!! */ + if (!base_hdr) + { + base_hdr = MimeHeaders_get (obj->headers, "Content-Location", FALSE, FALSE); + } + /* rhp - for MHTML Spec changes!!! */ + /* Encapsulate the entire text/html part inside an in-flow layer. This will provide it a private coordinate system and prevent it from escaping the bounds of its clipping so that diff --git a/mozilla/lib/libmime/mimevcrd.c b/mozilla/lib/libmime/mimevcrd.c index 97df147cbd2..ed247f2b2ca 100644 --- a/mozilla/lib/libmime/mimevcrd.c +++ b/mozilla/lib/libmime/mimevcrd.c @@ -908,7 +908,7 @@ static int OutputButtons(MimeObject *obj, XP_Bool basic, VObject *v) if (!obj->options->output_vcard_buttons_p) return status; - vCard = writeMemVObjects(0, &len, v, FALSE); + vCard = writeMemVObjects(0, &len, v); if (!vCard) return MK_OUT_OF_MEMORY; diff --git a/mozilla/lib/libmisc/Makefile b/mozilla/lib/libmisc/Makefile index 956f63bf744..42155172136 100644 --- a/mozilla/lib/libmisc/Makefile +++ b/mozilla/lib/libmisc/Makefile @@ -29,6 +29,7 @@ CSRCS = \ bkmks.c \ shist.c \ hotlist.c \ + dirprefs.c \ $(NULL) REQUIRES = net msg js dbm nspr img util layer pref ldap security @@ -36,7 +37,7 @@ REQUIRES = net msg js dbm nspr img util layer pref ldap security include $(DEPTH)/config/config.mk ifdef MOZ_MAIL_NEWS -CSRCS += mime.c dirprefs.c +CSRCS += mime.c endif include $(DEPTH)/config/rules.mk diff --git a/mozilla/lib/libmisc/bkmks.c b/mozilla/lib/libmisc/bkmks.c index 43c55b9a2d1..6b45cc7d2f4 100644 --- a/mozilla/lib/libmisc/bkmks.c +++ b/mozilla/lib/libmisc/bkmks.c @@ -16,6 +16,10 @@ * Reserved. */ +/* If you add code to this file, make sure it still builds on win16 debug - its + * code segment is too big. + */ + #include "bkmks.h" #include "net.h" #include "xp_mcom.h" @@ -29,9 +33,10 @@ #include "xp_qsort.h" #include "intl_csi.h" -/* N.B. If you add code to this file, make sure it still builds on win16 debug - its - code segment is too big. -*/ +#ifdef XP_MAC +#pragma warn_unusedarg off +#pragma warn_possunwant off +#endif #define INTL_SORT 1 #ifdef INTL_SORT /* Added by ftang */ @@ -90,6 +95,9 @@ extern int XP_ADDRBOOK_HEADER; #define BMLIST_COOKIE "" #define BM_ADDR_LIST_COOKIE "" #define READ_BUFFER_SIZE 2048 +#define WRITE_BUFFER_SIZE 1848 /* Make this a few hundred less than + read buffer so we can be sure to + read the bookmarks back properly */ #define DEF_NAME "Personal Bookmarks" /* L10N? This doesn't seem to be used. */ #ifdef FREEIF @@ -2390,23 +2398,22 @@ bm_read_url(MWContext* context, XP_File fp, char* buffer, char* ptr, end = strcasestr(gtr_than, ""); if (end) { *end = '\0'; - StrAllocCopy(new_item->name, XP_StripLine(gtr_than + 1)); - /* terminate at beginning of name since there - is nothing interesting after that */ - *gtr_than = '\0'; - } else { - StrAllocCopy(new_item->name, - XP_StripLine(gtr_than + 1)); + } else { + /* This must be a long title. + * Don't bother using the rest if it. + */ + char *dumpbuf = (char*) XP_ALLOC(READ_BUFFER_SIZE); + while (XP_FileReadLine(dumpbuf, READ_BUFFER_SIZE, fp)) { + if (strchr(dumpbuf, '\n')) + break; + } + XP_FREE(dumpbuf); + } + StrAllocCopy(new_item->name, XP_StripLine(gtr_than + 1)); - /* what happens if this breaks?? this is bogus stuff I don't - know what to do with */ - XP_FileReadLine(buffer, READ_BUFFER_SIZE, fp); - end = strcasestr(buffer, ""); - - if (end) *end = '\0'; - - StrAllocCat(new_item->name, XP_StripLine(buffer)); - } + /* terminate at beginning of name since there + is nothing interesting after that */ + *gtr_than = '\0'; } parseString = endQuote + 1; @@ -2772,8 +2779,12 @@ bm_WriteAsHTML(MWContext* context, XP_File fp, BM_Entry* item, int32 level, static int bm_write_ok(const char* str, int length, XP_File fp) { - if (length < 0) length = XP_STRLEN(str); - if ((int) XP_FileWrite(str, length, fp) < length) return -1; + if (length < 0) + length = XP_STRLEN(str); + if (length > WRITE_BUFFER_SIZE) + length = WRITE_BUFFER_SIZE; + if ((int) XP_FileWrite(str, length, fp) < length) + return -1; return 0; } @@ -2998,6 +3009,8 @@ bm_write_address( char *pszAddress, XP_File fp ) WRITE( pszBuf, -1, fp ); XP_FREE( pszBuf ); + + return 0; } /* writes out a URL entry to look like: @@ -3605,7 +3618,7 @@ BM_InsertItemInHeaderOrAfterItem( MWContext* context, bm_end_batch(context); } -void remove_to(MWContext* context, BM_Entry* entry, void* to) +static void remove_to(MWContext* context, BM_Entry* entry, void* to) { BM_Entry* moveTo = (BM_Entry*)to; BM_Entry* parent; @@ -7161,7 +7174,7 @@ void BM_ObeyCommand(MWContext* context, BM_CommandType command) case BM_Cmd_Sort_LastVisit: case BM_Cmd_Sort_LastVisit_Asc: case BM_Cmd_Sort_Natural: - bm_SortSelected( context, command-BM_Cmd_Sort_Name ); + bm_SortSelected( context, (BM_SortType)(command-BM_Cmd_Sort_Name) ); break; case BM_Cmd_InsertBookmark: diff --git a/mozilla/lib/libmisc/dirprefs.c b/mozilla/lib/libmisc/dirprefs.c index 10817c4aa52..564ed99bb82 100644 --- a/mozilla/lib/libmisc/dirprefs.c +++ b/mozilla/lib/libmisc/dirprefs.c @@ -27,13 +27,31 @@ #include "libi18n.h" #ifdef MOZ_LDAP #include "ldap.h" -HG82168 #else #define LDAP_PORT 389 #define LDAPS_PORT 636 -#endif /* MOZ_LDAP */ +#endif -#if !defined(MOZADDRSTANDALONE) +#ifndef MOZ_MAIL_NEWS + +int DIR_GetLdapServers(XP_List *wholeList, XP_List *subList) +{ + return -1; +} + +const char **DIR_GetAttributeStrings (DIR_Server *server, DIR_AttributeId id) +{ + return 0 ; +} + +const char *DIR_GetFirstAttributeString (DIR_Server *server, DIR_AttributeId id) +{ + return 0 ; +} + +#else + +#ifndef MOZADDRSTANDALONE extern int MK_OUT_OF_MEMORY; extern int MK_ADDR_PAB; @@ -52,14 +70,25 @@ extern int MK_LDAP_CUSTOM2; extern int MK_LDAP_CUSTOM3; extern int MK_LDAP_CUSTOM4; extern int MK_LDAP_CUSTOM5; +extern int MK_LDAP_DESCRIPTION; +extern int MK_LDAP_EMPLOYEE_TYPE; +extern int MK_LDAP_FAX_NUMBER; +extern int MK_LDAP_MANAGER; +extern int MK_LDAP_OBJECT_CLASS; +extern int MK_LDAP_POSTAL_ADDRESS; +extern int MK_LDAP_POSTAL_CODE; +extern int MK_LDAP_SECRETARY; +extern int MK_LDAP_TITLE; +extern int MK_LDAP_CAR_LICENSE; +extern int MK_LDAP_BUSINESS_CAT; +extern int MK_LDAP_DEPT_NUMBER; extern int MK_LDAP_REPL_CANT_SYNC_REPLICA; #else #define MK_OUT_OF_MEMORY -1; -#endif /* #if !defined(MOZADDRSTANDALONE) */ - +#endif /* !MOZADDRSTANDALONE */ /***************************************************************************** * Private structs and stuff @@ -82,19 +111,6 @@ typedef struct DIR_Attribute char **attrNames; } DIR_Attribute; -struct _DIR_ReplicationInfo -{ - XP_Bool enabled; /* duh */ - char *description; /* human readable description of replica */ - char *filter; /* LDAP filter string which constrains the repl search */ - int32 lastChangeNumber; /* Last change we saw -- start replicating here */ - int32 generation; /* LDAP server's scoping of the lastChangeNumber */ - /* this changes when the server's DB gets reloaded from LDIF */ - char **excludedAttributes; /* list of attributes we shouldn't replicate */ - int excludedAttributesCount; /* duh */ - -}; - /* Our internal view of a default attribute is a resourceId for the pretty * name and the real attribute name. These are catenated to create a string * of the form "Pretty Name:attrname" @@ -129,23 +145,81 @@ typedef struct DIR_Filter #define kDefaultIsOffline TRUE #define kDefaultEnableAuth FALSE #define kDefaultSavePassword FALSE -#define kDefaultAutoCompleteEnabled FALSE - -#define kDefaultReplicaExcludedAttributes "" -#define kDefaultReplicaEnabled FALSE -#define kDefaultReplicaFilter "(objectclass=*)" -#define kDefaultReplicaChangeNumber 0 -#define kDefaultReplicaChangeNumberGeneration 0 -#define kDefaultReplicaDescription "" #define kDefaultUtf8Disabled FALSE +#define kDefaultLdapPublicDirectory FALSE + +#define kDefaultAutoCompleteEnabled FALSE +#define kDefaultAutoCompleteStyle acsGivenAndSurname + +#define kDefaultReplicaEnabled FALSE +#define kDefaultReplicaFileName NULL +#define kDefaultReplicaDataVersion NULL +#define kDefaultReplicaDescription NULL +#define kDefaultReplicaChangeNumber -1 +#define kDefaultReplicaFilter "(objectclass=*)" +#define kDefaultReplicaExcludedAttributes NULL #define kLdapServersPrefName "network.hosts.ldap_servers" const char *DIR_GetAttributeName (DIR_Server *server, DIR_AttributeId id); -void DIR_SetServerFileName(DIR_Server* pServer, const char* leafName); static DIR_DefaultAttribute *DIR_GetDefaultAttribute (DIR_AttributeId id); +void DIR_SetFileName(char** filename, const char* leafName); +/***************************************************************************** + * Functions for creating the new back end managed DIR_Server list. + */ + +static XP_List * dir_ServerList = NULL; + +XP_List * DIR_GetDirServers() +{ + const char * msg = "abook.nab"; + if (!dir_ServerList) + { + /* we need to build the DIR_Server list */ + dir_ServerList = XP_ListNew(); + + PREF_SetDefaultCharPref("browser.addressbook_location",msg); + + DIR_GetServerPreferences (&dir_ServerList, msg); +/* char * ldapPref = PR_smprintf("ldap_%d.end_of_directories", kCurrentListVersion); + if (ldapPref) + PREF_RegisterCallback(ldapPref, DirServerListChanged, NULL); + XP_FREEIF (ldapPref); */ + } + return dir_ServerList; +} + +int DIR_ShutDown() /* FEs should call this when the app is shutting down. It frees all DIR_Servers regardless of ref count values! */ +{ + int i = 1; + if (dir_ServerList) + { + for (i = 1; i <= XP_ListCount(dir_ServerList); i++) + DIR_DeleteServer(XP_ListGetObjectNum (dir_ServerList, i)); + XP_ListDestroy (dir_ServerList); + } + + return 0; +} + +int DIR_DecrementServerRefCount (DIR_Server *server) +{ + XP_ASSERT(server); + if (server && --server->refCount <= 0) + return DIR_DeleteServer(server); + return 0; +} + +int DIR_IncrementServerRefCount (DIR_Server *server) +{ + XP_ASSERT(server); + if (server) + server->refCount++; + return 0; +} + /***************************************************************************** * Functions for creating DIR_Servers */ @@ -161,6 +235,7 @@ int DIR_InitServer (DIR_Server *server) server->port = LDAP_PORT; server->maxHits = kDefaultMaxHits; server->isOffline = kDefaultIsOffline; + server->refCount = 1; } return 0; } @@ -227,14 +302,16 @@ static int dir_CopyTokenList (char **inList, int inCount, char ***outList, int * static DIR_ReplicationInfo *dir_CopyReplicationInfo (DIR_ReplicationInfo *inInfo) { - DIR_ReplicationInfo *outInfo = (DIR_ReplicationInfo*) XP_CALLOC (sizeof(DIR_ReplicationInfo), 1); + DIR_ReplicationInfo *outInfo = (DIR_ReplicationInfo*) XP_CALLOC (1, sizeof(DIR_ReplicationInfo)); if (outInfo) { outInfo->lastChangeNumber = inInfo->lastChangeNumber; - outInfo->generation = inInfo->generation; - outInfo->enabled = inInfo->enabled; if (inInfo->description) outInfo->description = XP_STRDUP (inInfo->description); + if (inInfo->fileName) + outInfo->fileName = XP_STRDUP (inInfo->fileName); + if (inInfo->dataVersion) + outInfo->dataVersion = XP_STRDUP (inInfo->dataVersion); if (inInfo->filter) outInfo->filter = XP_STRDUP (inInfo->filter); dir_CopyTokenList (inInfo->excludedAttributes, inInfo->excludedAttributesCount, @@ -243,11 +320,9 @@ static DIR_ReplicationInfo *dir_CopyReplicationInfo (DIR_ReplicationInfo *inInfo return outInfo; } - int DIR_CopyServer (DIR_Server *in, DIR_Server **out) { int err = 0; - if (in) { *out = XP_ALLOC(sizeof(DIR_Server)); if (*out) @@ -378,6 +453,12 @@ int DIR_CopyServer (DIR_Server *in, DIR_Server **out) if (in->customDisplayUrl) (*out)->customDisplayUrl = XP_STRDUP (in->customDisplayUrl); + if (in->searchPairList) + (*out)->searchPairList = XP_STRDUP (in->searchPairList); + + (*out)->autoCompleteStyle = in->autoCompleteStyle; + + (*out)->refCount = 1; } else { err = MK_OUT_OF_MEMORY; @@ -393,21 +474,32 @@ int DIR_CopyServer (DIR_Server *in, DIR_Server **out) return err; } - /***************************************************************************** * Function for comparing DIR_Servers */ XP_Bool DIR_AreServersSame (DIR_Server *first, DIR_Server *second) { + /* This function used to be written to assume that we only had one PAB so it + only checked the server type for PABs. If both were PABDirectories, then + it returned TRUE. Now that we support multiple address books, we need to + check type & file name for address books to test if they are the same */ + XP_Bool result = FALSE; if (first && second) { /* assume for right now one personal address book type where offline is false */ if ((first->dirType == PABDirectory) && (second->dirType == PABDirectory)) { - if ((first->isOffline == FALSE) && (second->isOffline == FALSE)) - return TRUE; + if ((first->isOffline == FALSE) && (second->isOffline == FALSE)) /* are they both really address books? */ + { + XP_ASSERT(first->fileName && second->fileName); + if (first->fileName && second->fileName) + if (XP_STRCASECMP(first->fileName, second->fileName) == 0) + return TRUE; + + return FALSE; + } else { XP_ASSERT (first->serverName && second->serverName); if (first->serverName && second->serverName) @@ -515,12 +607,16 @@ static void dir_DeleteReplicationInfo (DIR_Server *server) dir_DeleteTokenList (info->excludedAttributes, info->excludedAttributesCount); XP_FREEIF(info->description); + XP_FREEIF(info->fileName); + XP_FREEIF(info->dataVersion); XP_FREEIF(info->filter); XP_FREE(info); } } - +/* When the back end manages the server list, deleting a server just decrements + * its ref count, in the old world, we actually delete the server + */ int DIR_DeleteServer (DIR_Server *server) { if (server) @@ -562,6 +658,7 @@ int DIR_DeleteServer (DIR_Server *server) dir_DeleteReplicationInfo (server); XP_FREEIF (server->customDisplayUrl); + XP_FREEIF (server->searchPairList); XP_FREE (server); } @@ -583,22 +680,11 @@ int DIR_DeleteServerList(XP_List *wholeList) int DIR_CleanUpServerPreferences(XP_List *deletedList) { - int i; - if (deletedList) - { - for (i = 1; i <= XP_ListCount(deletedList); i++) - { - DIR_Server *server = (DIR_Server *) (XP_ListGetObjectNum (deletedList, i)); - if (server) - { -#if !defined(MOZADDRSTANDALONE) - if (server->fileName) - XP_FileRemove (server->fileName, xpAddrBookNew); -#endif - } - } - DIR_DeleteServerList(deletedList); - } + /* In the new world order of DIR_Servers it has been decreed that to clean + * up a server you should set its DIR_CLEAR_SERVER flag. Then, release + * your ref count on the list or servers (if you have one) + */ + XP_ASSERT(FALSE); return 0; } @@ -607,7 +693,7 @@ int DIR_CleanUpServerPreferences(XP_List *deletedList) * Functions for retrieving subsets of the DIR_Server list */ -int DIR_GetHtmlServers (XP_List *wholeList, XP_List *subList) +static int DIR_GetHtmlServers(XP_List *wholeList, XP_List *subList) { int i; if (wholeList && subList) @@ -623,7 +709,23 @@ int DIR_GetHtmlServers (XP_List *wholeList, XP_List *subList) return -1; } -int DIR_GetLdapServers (XP_List *wholeList, XP_List *subList) +int DIR_GetPersonalAddressBooks (XP_List *wholeList, XP_List * subList) +{ + int i; + if (wholeList && subList) + { + for (i = 1; i <= XP_ListCount(wholeList); i++) + { + DIR_Server *s = (DIR_Server*) XP_ListGetObjectNum (wholeList, i); + if (PABDirectory == s->dirType) + XP_ListAddObjectToEnd (subList, s); + } + return 0; + } + return -1; +} + +int DIR_GetLdapServers(XP_List *wholeList, XP_List *subList) { int i; if (wholeList && subList) @@ -639,7 +741,7 @@ int DIR_GetLdapServers (XP_List *wholeList, XP_List *subList) return -1; } -int DIR_ReorderLdapServers (XP_List *wholeList) +int DIR_ReorderLdapServers(XP_List *wholeList) { int status = 0; int length = 0; @@ -672,7 +774,7 @@ int DIR_ReorderLdapServers (XP_List *wholeList) return status; } -int DIR_GetPersonalAddressBook (XP_List *wholeList, DIR_Server **pab) +int DIR_GetPersonalAddressBook(XP_List *wholeList, DIR_Server **pab) { int i; if (wholeList && pab) @@ -699,7 +801,7 @@ int DIR_GetPersonalAddressBook (XP_List *wholeList, DIR_Server **pab) return -1; } -int DIR_GetComposeNameCompletionAddressBook (XP_List *wholeList, DIR_Server **cab) +int DIR_GetComposeNameCompletionAddressBook(XP_List *wholeList, DIR_Server **cab) { int i; if (wholeList && cab) @@ -725,7 +827,7 @@ int DIR_GetComposeNameCompletionAddressBook (XP_List *wholeList, DIR_Server **ca #if !defined(MOZADDRSTANDALONE) -static char *DIR_GetStringPref (const char *prefRoot, const char *prefLeaf, char *scratch, const char *defaultValue) +static char *DIR_GetStringPref(const char *prefRoot, const char *prefLeaf, char *scratch, const char *defaultValue) { int valueLength = 0; char *value = NULL; @@ -736,15 +838,15 @@ static char *DIR_GetStringPref (const char *prefRoot, const char *prefLeaf, char { /* unfortunately, there may be some prefs out there which look like this */ if (!XP_STRCMP(value, "(null)")) - value = XP_STRDUP(defaultValue); + value = defaultValue ? XP_STRDUP(defaultValue) : NULL; } else - value = XP_STRDUP(defaultValue); + value = defaultValue ? XP_STRDUP(defaultValue) : NULL; return value; } -static int32 DIR_GetIntPref (const char *prefRoot, const char *prefLeaf, char *scratch, int32 defaultValue) +static int32 DIR_GetIntPref(const char *prefRoot, const char *prefLeaf, char *scratch, int32 defaultValue) { int32 value; XP_STRCPY(scratch, prefRoot); @@ -754,7 +856,7 @@ static int32 DIR_GetIntPref (const char *prefRoot, const char *prefLeaf, char *s } -static XP_Bool DIR_GetBoolPref (const char *prefRoot, const char *prefLeaf, char *scratch, XP_Bool defaultValue) +static XP_Bool DIR_GetBoolPref(const char *prefRoot, const char *prefLeaf, char *scratch, XP_Bool defaultValue) { XP_Bool value; XP_STRCPY(scratch, prefRoot); @@ -764,7 +866,7 @@ static XP_Bool DIR_GetBoolPref (const char *prefRoot, const char *prefLeaf, char } -int DIR_AttributeNameToId (const char *attrName, DIR_AttributeId *id) +int DIR_AttributeNameToId(const char *attrName, DIR_AttributeId *id) { int status = 0; @@ -776,6 +878,7 @@ int DIR_AttributeNameToId (const char *attrName, DIR_AttributeId *id) else status = -1; break; + case 'c' : if (!XP_STRCASECMP(attrName, "cn")) *id = cn; @@ -800,11 +903,9 @@ int DIR_AttributeNameToId (const char *attrName, DIR_AttributeId *id) else status = -1; break; - case 's': - if (!XP_STRCASECMP(attrName, "street")) - *id = street; - else if (!XP_STRCASECMP(attrName, "sn")) - *id = sn; + case 'l': + if (!XP_STRCASECMP(attrName, "l")) + *id = l; else status = -1; break; @@ -822,14 +923,16 @@ int DIR_AttributeNameToId (const char *attrName, DIR_AttributeId *id) else status = -1; break; - case 'l': - if (!XP_STRCASECMP(attrName, "l")) - *id = l; + case 's': + if (!XP_STRCASECMP(attrName, "street")) + *id = street; + else if (!XP_STRCASECMP(attrName, "sn")) + *id = sn; else status = -1; break; case 't': - if (!XP_STRCASECMP(attrName, "telephoneNumber")) + if (!XP_STRCASECMP(attrName, "telephonenumber")) *id = telephonenumber; else status = -1; @@ -842,7 +945,7 @@ int DIR_AttributeNameToId (const char *attrName, DIR_AttributeId *id) } -static int DIR_AddCustomAttribute (DIR_Server *server, const char *attrName, char *jsAttr) +static int DIR_AddCustomAttribute(DIR_Server *server, const char *attrName, char *jsAttr) { int status = 0; char *jsCompleteAttr = NULL; @@ -919,13 +1022,12 @@ static int DIR_AddCustomAttribute (DIR_Server *server, const char *attrName, cha return status; } - -static int dir_CreateTokenListFromWholePref (const char *pref, char ***outList, int *outCount) +static int dir_CreateTokenListFromWholePref(const char *pref, char ***outList, int *outCount) { int result = 0; char *commaSeparatedList = NULL; - if (PREF_NOERROR == PREF_CopyCharPref (pref, &commaSeparatedList) && commaSeparatedList) + if (PREF_NOERROR == PREF_CopyCharPref(pref, &commaSeparatedList) && commaSeparatedList) { char *tmpList = commaSeparatedList; *outCount = 1; @@ -933,14 +1035,14 @@ static int dir_CreateTokenListFromWholePref (const char *pref, char ***outList, if (*tmpList++ == ',') (*outCount)++; - *outList = (char**) XP_ALLOC (*outCount * sizeof(char*)); + *outList = (char**) XP_ALLOC(*outCount * sizeof(char*)); if (*outList) { int i; - char *token = XP_STRTOK (commaSeparatedList, ", "); + char *token = XP_STRTOK(commaSeparatedList, ", "); for (i = 0; i < *outCount; i++) { - (*outList)[i] = XP_STRDUP (token); + (*outList)[i] = XP_STRDUP(token); token = XP_STRTOK(NULL, ", "); } } @@ -955,18 +1057,18 @@ static int dir_CreateTokenListFromWholePref (const char *pref, char ***outList, } -static int dir_CreateTokenListFromPref (const char *prefBase, const char *prefLeaf, char *scratch, char ***outList, int *outCount) +static int dir_CreateTokenListFromPref(const char *prefBase, const char *prefLeaf, char *scratch, char ***outList, int *outCount) { XP_STRCPY (scratch, prefBase); XP_STRCAT (scratch, prefLeaf); - return dir_CreateTokenListFromWholePref (scratch, outList, outCount); + return dir_CreateTokenListFromWholePref(scratch, outList, outCount); } -static int dir_ConvertTokenListToIdList (char **tokenList, int tokenCount, DIR_AttributeId **outList) +static int dir_ConvertTokenListToIdList(char **tokenList, int tokenCount, DIR_AttributeId **outList) { - *outList = (DIR_AttributeId*) XP_ALLOC (sizeof(DIR_AttributeId) * tokenCount); + *outList = (DIR_AttributeId*) XP_ALLOC(sizeof(DIR_AttributeId) * tokenCount); if (*outList) { int i; @@ -979,71 +1081,51 @@ static int dir_ConvertTokenListToIdList (char **tokenList, int tokenCount, DIR_A } -static void dir_GetReplicationInfo (const char *prefName, DIR_Server *server, char *scratch) +static void dir_GetReplicationInfo(const char *prefName, DIR_Server *server, char *scratch) { - char *childList = NULL; - XP_STRCPY (scratch, prefName); - if (PREF_NOERROR == PREF_CreateChildList (XP_STRCAT(scratch, "replication"), &childList)) - { - XP_ASSERT (server->replInfo == NULL); - if (childList && childList[0]) - { - server->replInfo = (DIR_ReplicationInfo *) XP_CALLOC (sizeof (DIR_ReplicationInfo), 1); - if (server->replInfo) - { - char *child = NULL; - int index = 0; - while ((child = PREF_NextChild (childList, &index)) != NULL) - { - char *leaf = XP_STRRCHR (child, '.'); - if (leaf) - { - leaf++; /* skip over the '.' */ + char *replPrefName; + XP_Bool arePrefsValid = FALSE; - /* Note: JS prefs are case-sensitive, and so is this code */ - switch (leaf[0]) - { - case 'd': - if (!XP_STRCMP (leaf, "description")) - PREF_CopyCharPref (child, &server->replInfo->description); - else - XP_ASSERT(FALSE); - break; - case 'e': - if (!XP_STRCMP (leaf, "enabled")) - PREF_GetBoolPref (child, &server->replInfo->enabled); - else if (!XP_STRCMP (leaf, "excludedAttributes")) - dir_CreateTokenListFromWholePref (child, &server->replInfo->excludedAttributes, - &server->replInfo->excludedAttributesCount); - else - XP_ASSERT(FALSE); - break; - case 'f' : - if (!XP_STRCMP (leaf, "filter")) - PREF_CopyCharPref (child, &server->replInfo->filter); - else - XP_ASSERT(FALSE); - break; - case 'g': - if (!XP_STRCMP (leaf, "generation")) - PREF_GetIntPref (child, &server->replInfo->generation); - else - XP_ASSERT(FALSE); - break; - case 'l': - if (!XP_STRCMP (leaf, "lastChangeNumber")) - PREF_GetIntPref (child, &server->replInfo->lastChangeNumber); - else - XP_ASSERT(FALSE); - break; - default: - XP_ASSERT(FALSE); - } - } - } - } + XP_ASSERT (server->replInfo == NULL); + + replPrefName = (char *) XP_ALLOC(128); + server->replInfo = (DIR_ReplicationInfo *) XP_CALLOC (1, sizeof (DIR_ReplicationInfo)); + if (server->replInfo && replPrefName) + { + XP_STRCPY(replPrefName, prefName); + XP_STRCAT(replPrefName, "replication."); + + if (DIR_GetBoolPref (replPrefName, "enabled", scratch, kDefaultReplicaEnabled)) + DIR_SetFlag (server, DIR_REPLICATION_ENABLED); + + server->replInfo->fileName = DIR_GetStringPref (replPrefName, "fileName", scratch, kDefaultReplicaFileName); + server->replInfo->dataVersion = DIR_GetStringPref (replPrefName, "dataVersion", scratch, kDefaultReplicaDataVersion); + + /* The file name and data version must be set or we ignore all of the + * replication prefs. + */ + if (server->replInfo->fileName && server->replInfo->dataVersion) + { + dir_CreateTokenListFromPref (replPrefName, "excludedAttributes", scratch, &server->replInfo->excludedAttributes, + &server->replInfo->excludedAttributesCount); + + server->replInfo->description = DIR_GetStringPref (replPrefName, "description", scratch, kDefaultReplicaDescription); + server->replInfo->filter = DIR_GetStringPref (replPrefName, "filter", scratch, kDefaultReplicaFilter); + server->replInfo->lastChangeNumber = DIR_GetIntPref (replPrefName, "lastChangeNumber", scratch, kDefaultReplicaChangeNumber); + + arePrefsValid = TRUE; } - XP_FREE(childList); + } + + if (!arePrefsValid) + { + if (server->replInfo) + { + XP_FREEIF(server->replInfo->fileName); + XP_FREEIF(server->replInfo->dataVersion); + } + XP_FREEIF(server->replInfo); + XP_FREEIF(replPrefName); } } @@ -1051,7 +1133,7 @@ static void dir_GetReplicationInfo (const char *prefName, DIR_Server *server, ch /* Called at startup-time to read whatever overrides the LDAP site administrator has * done to the attribute names */ -static int DIR_GetCustomAttributePrefs (const char *prefName, DIR_Server *server, char *scratch) +static int DIR_GetCustomAttributePrefs(const char *prefName, DIR_Server *server, char *scratch) { char **tokenList = NULL; char *childList = NULL; @@ -1111,7 +1193,7 @@ static int DIR_GetCustomAttributePrefs (const char *prefName, DIR_Server *server /* Called at startup-time to read whatever overrides the LDAP site administrator has * done to the filtering logic */ -static int DIR_GetCustomFilterPrefs (const char *prefName, DIR_Server *server, char *scratch) +static int DIR_GetCustomFilterPrefs(const char *prefName, DIR_Server *server, char *scratch) { int status = 0; XP_Bool keepGoing = TRUE; @@ -1139,13 +1221,6 @@ static int DIR_GetCustomFilterPrefs (const char *prefName, DIR_Server *server, c if (1 == filterNum) { server->tokenSeps = DIR_GetStringPref (prefName, "wordSeparators", localScratch, kDefaultTokenSeps); -#if 0 - /* This is left over from when I thought I'd have time to let the - ** admin specify a list of filters, and we'd run them until we got - ** a hit. Still a good idea, but probably too late for Dogbert. - */ - server->stopFiltersOnHit = DIR_GetBoolPref (prefName, "stopFiltersOnHit", localScratch, kDefaultStopOnHit); -#endif XP_STRCAT(scratch, "."); } @@ -1185,12 +1260,12 @@ static int DIR_GetCustomFilterPrefs (const char *prefName, DIR_Server *server, c /* This will convert from the old preference that was a path and filename */ /* to a just a filename */ -void DIR_ConvertServerFileName(DIR_Server* pServer) +static void DIR_ConvertServerFileName(DIR_Server* pServer) { char* leafName = pServer->fileName; char* newLeafName = NULL; #if defined(XP_WIN) || defined(XP_OS2) - /* jefft -- bug 73349 This is to allow users share same address book. + /* This is to allow users to share the same address book. * It only works if the user specify a full path filename. */ if (! XP_FileIsFullPath(leafName)) @@ -1203,22 +1278,27 @@ void DIR_ConvertServerFileName(DIR_Server* pServer) } /* This will generate a correct filename and then remove the path */ -void DIR_SetServerFileName(DIR_Server* pServer, const char* leafName) +void DIR_SetFileName(char** fileName, const char* leafName) { char* tempName = WH_TempName(xpAddrBook, leafName); char* nativeName = WH_FileName(tempName, xpAddrBook); char* urlName = XP_PlatformFileToURL(nativeName); #if defined(XP_WIN) || defined(XP_UNIX) || defined(XP_MAC) || defined(XP_OS2) char* newLeafName = XP_STRRCHR (urlName + XP_STRLEN("file://"), '/'); - pServer->fileName = newLeafName ? XP_STRDUP(newLeafName + 1) : XP_STRDUP(urlName + XP_STRLEN("file://")); + (*fileName) = newLeafName ? XP_STRDUP(newLeafName + 1) : XP_STRDUP(urlName + XP_STRLEN("file://")); #else - pServer->fileName = XP_STRDUP(urlName + XP_STRLEN("file://")); + (*fileName) = XP_STRDUP(urlName + XP_STRLEN("file://")); #endif if (urlName) XP_FREE(urlName); if (nativeName) XP_FREE(nativeName); if (tempName) XP_FREE(tempName); } +void DIR_SetServerFileName(DIR_Server *server, const char* leafName) +{ + DIR_SetFileName(&(server->fileName), leafName); +} + /* This will reconstruct a correct filename including the path */ void DIR_GetServerFileName(char** filename, const char* leafName) { @@ -1227,7 +1307,7 @@ void DIR_GetServerFileName(char** filename, const char* leafName) char* nativeName; char* urlName; if (XP_STRCHR(leafName, ':') != NULL) - realLeafName = XP_STRRCHR(leafName, ':') + 1; // makes sure that leafName is not a fullpath + realLeafName = XP_STRRCHR(leafName, ':') + 1; /* makes sure that leafName is not a fullpath */ else realLeafName = leafName; @@ -1258,7 +1338,7 @@ void DIR_GetServerFileName(char** filename, const char* leafName) if (nativeName) XP_FREE(nativeName); } -static int DIR_GetPrefsFromBranch (XP_List **list, const char *pabFile, const char *branch) +static int DIR_GetPrefsFromBranch(XP_List **list, const char *pabFile, const char *branch) { int32 numDirectories = 0; int i = 0; @@ -1282,14 +1362,16 @@ static int DIR_GetPrefsFromBranch (XP_List **list, const char *pabFile, const ch char *numberOfDirs = PR_smprintf ("%s.number_of_directories", branch); if (numberOfDirs) PREF_GetIntPref(numberOfDirs, &numDirectories); + for (i = 1; i <= numDirectories; i++) { pNewServer = (DIR_Server *) XP_ALLOC(sizeof(DIR_Server)); if (pNewServer) { XP_Bool prefBool; + int prefInt; - XP_BZERO(pNewServer, sizeof(DIR_Server)); + DIR_InitServer(pNewServer); XP_SPRINTF(prefstring, "%s.directory%i.", branch, i); pNewServer->isSecure = DIR_GetBoolPref (prefstring, "isSecure", tempString, FALSE); @@ -1345,19 +1427,23 @@ static int DIR_GetPrefsFromBranch (XP_List **list, const char *pabFile, const ch /* Get authentication prefs */ pNewServer->enableAuth = DIR_GetBoolPref (prefstring, "enableAuth", tempString, kDefaultEnableAuth); + pNewServer->authDn = DIR_GetStringPref (prefstring, "authDn", tempString, NULL); pNewServer->savePassword = DIR_GetBoolPref (prefstring, "savePassword", tempString, kDefaultSavePassword); if (pNewServer->savePassword) - { - pNewServer->authDn = DIR_GetStringPref (prefstring, "authDn", tempString, ""); pNewServer->password = DIR_GetStringPref (prefstring, "password", tempString, ""); - } - prefBool = DIR_GetBoolPref (prefstring, "autoCompleteEnabled", tempString, kDefaultAutoCompleteEnabled); + prefBool = DIR_GetBoolPref (prefstring, "autoComplete.enabled", tempString, kDefaultAutoCompleteEnabled); DIR_ForceFlag (pNewServer, DIR_AUTO_COMPLETE_ENABLED, prefBool); + prefInt = DIR_GetIntPref (prefstring, "autoComplete.style", tempString, kDefaultAutoCompleteStyle); + pNewServer->autoCompleteStyle = (DIR_AutoCompleteStyle) prefInt; prefBool = DIR_GetBoolPref (prefstring, "utf8Disabled", tempString, kDefaultUtf8Disabled); DIR_ForceFlag (pNewServer, DIR_UTF8_DISABLED, prefBool); + prefBool = DIR_GetBoolPref (prefstring, "ldapPublicDirectory", tempString, kDefaultLdapPublicDirectory); + DIR_ForceFlag (pNewServer, DIR_LDAP_PUBLIC_DIRECTORY, prefBool); + DIR_ForceFlag (pNewServer, DIR_LDAP_ROOTDSE_PARSED, prefBool); + pNewServer->customDisplayUrl = DIR_GetStringPref (prefstring, "customDisplayUrl", tempString, ""); XP_ListAddObjectToEnd((*list), pNewServer); @@ -1368,7 +1454,7 @@ static int DIR_GetPrefsFromBranch (XP_List **list, const char *pabFile, const ch /* all.js should have filled this stuff in */ XP_ASSERT(hasPAB); - XP_ASSERT(numDirectories != 0); + XP_ASSERT(numDirectories != 0); } else result = -1; @@ -1380,7 +1466,7 @@ static int DIR_GetPrefsFromBranch (XP_List **list, const char *pabFile, const ch } -int DIR_GetServerPreferences (XP_List **list, const char* pabFile) +int DIR_GetServerPreferences(XP_List **list, const char* pabFile) { int err = 0; XP_List *oldList = NULL; @@ -1400,9 +1486,12 @@ int DIR_GetServerPreferences (XP_List **list, const char* pabFile) { if (oldChildren) { - if (userHasOldPrefs) - err = DIR_GetPrefsFromBranch (&oldList, pabFile, "directories"); - PREF_DeleteBranch ("directories"); + if (XP_STRLEN(oldChildren)) + { + if (userHasOldPrefs) + err = DIR_GetPrefsFromBranch (&oldList, pabFile, "directories"); + PREF_DeleteBranch ("directories"); + } XP_FREEIF(oldChildren); } } @@ -1411,15 +1500,18 @@ int DIR_GetServerPreferences (XP_List **list, const char* pabFile) { if (oldChildren) { - if (userHasOldPrefs) - err = DIR_GetPrefsFromBranch (&oldList, pabFile, "ldap"); - PREF_DeleteBranch ("ldap"); + if (XP_STRLEN(oldChildren)) + { + if (userHasOldPrefs) + err = DIR_GetPrefsFromBranch (&oldList, pabFile, "ldap"); + PREF_DeleteBranch ("ldap"); + } XP_FREEIF(oldChildren); } } /* Find the new-style "ldap_1" tree in prefs */ - DIR_GetPrefsFromBranch (&newList, pabFile, "ldap_1"); + DIR_GetPrefsFromBranch(&newList, pabFile, "ldap_1"); if (oldList && newList) { @@ -1435,19 +1527,19 @@ int DIR_GetServerPreferences (XP_List **list, const char* pabFile) while (NULL != (newServer = XP_ListNextObject(walkNewList)) && addOldServer) { - if (DIR_AreServersSame (oldServer, newServer)) + if (DIR_AreServersSame(oldServer, newServer)) addOldServer = FALSE; /* don't add servers which are in the new list */ else if (PABDirectory == oldServer->dirType) addOldServer = FALSE; /* don't need the old PAB; there's already one in ALL.JS */ - else if (!XP_STRCMP (oldServer->serverName, "ldap-trace.fedex.com")) + else if (!XP_STRCMP(oldServer->serverName, "ldap-trace.fedex.com")) addOldServer = FALSE; } if (addOldServer) { DIR_Server *copyOfOldServer; - DIR_CopyServer (oldServer, ©OfOldServer); - XP_ListAddObjectToEnd (newList, copyOfOldServer); + DIR_CopyServer(oldServer, ©OfOldServer); + XP_ListAddObjectToEnd(newList, copyOfOldServer); } } @@ -1465,10 +1557,7 @@ int DIR_GetServerPreferences (XP_List **list, const char* pabFile) } -#define DIR_GOOD_WAY 1 - - -static void DIR_ClearPrefBranch (const char *branch) +static void DIR_ClearPrefBranch(const char *branch) { /* This little function provides a way to delete a prefs object but still * allow reassignment of that object later. @@ -1476,7 +1565,7 @@ static void DIR_ClearPrefBranch (const char *branch) char *recreateBranch = NULL; PREF_DeleteBranch (branch); - recreateBranch = PR_smprintf ("pref_inittree(\"%s\")", branch); + recreateBranch = PR_smprintf("pref_inittree(\"%s\")", branch); if (recreateBranch) { PREF_QuietEvaluateJSBuffer (recreateBranch, XP_STRLEN(recreateBranch)); @@ -1529,7 +1618,11 @@ static void DIR_SetStringPref (const char *prefRoot, const char *prefLeaf, char /* If there's a default pref, just set ours in and let libpref worry * about potential defaults in all.js */ - prefErr = PREF_SetCharPref (scratch, value); + if (value) /* added this check to make sure we have a value before we try to set it..*/ + prefErr = PREF_SetCharPref (scratch, value); + else + DIR_ClearStringPref(scratch); + XP_FREE(defaultPref); } else @@ -1540,18 +1633,14 @@ static void DIR_SetStringPref (const char *prefRoot, const char *prefLeaf, char char *userPref = NULL; if (PREF_NOERROR == PREF_CopyCharPref (scratch, &userPref)) { -#if DIR_GOOD_WAY - if (value && XP_STRCASECMP(value, defaultValue)) + if (value && (defaultValue ? XP_STRCASECMP(value, defaultValue) : value != defaultValue)) prefErr = PREF_SetCharPref (scratch, value); else DIR_ClearStringPref (scratch); -#else - prefErr = PREF_SetCharPref (scratch, value); -#endif } else { - if (value && XP_STRCASECMP(value, defaultValue)) + if (value && (defaultValue ? XP_STRCASECMP(value, defaultValue) : value != defaultValue)) prefErr = PREF_SetCharPref (scratch, value); } } @@ -1578,14 +1667,10 @@ static void DIR_SetIntPref (const char *prefRoot, const char *prefLeaf, char *sc int32 userPref; if (PREF_NOERROR == PREF_GetIntPref (scratch, &userPref)) { -#if DIR_GOOD_WAY if (value != defaultValue) prefErr = PREF_SetIntPref(scratch, value); else DIR_ClearIntPref (scratch); -#else - prefErr = PREF_SetIntPref(scratch, value); -#endif } else { @@ -1616,14 +1701,10 @@ static void DIR_SetBoolPref (const char *prefRoot, const char *prefLeaf, char *s XP_Bool userPref; if (PREF_NOERROR == PREF_GetBoolPref (scratch, &userPref)) { -#if DIR_GOOD_WAY if (value != defaultValue) prefErr = PREF_SetBoolPref(scratch, value); else DIR_ClearBoolPref (scratch); -#else - prefErr = PREF_SetBoolPref(scratch, value); -#endif } else { @@ -1768,6 +1849,7 @@ static int DIR_SaveCustomFilters (const char *prefRoot, char *scratch, DIR_Serve DIR_SetStringPref (scratch, "string", localScratch, filter->string, kDefaultFilter); } XP_FREE(localScratch); + localScratch = NULL; } else err = MK_OUT_OF_MEMORY; @@ -1782,6 +1864,9 @@ static int DIR_SaveCustomFilters (const char *prefRoot, char *scratch, DIR_Serve DIR_SetStringPref (scratch, "string", localScratch, kDefaultFilter, kDefaultFilter); } + if (localScratch) /* memory leak! I'm adding this to patch up the leak. */ + XP_FREE(localScratch); + return err; } @@ -1796,6 +1881,8 @@ static int dir_SaveReplicationInfo (const char *prefRoot, char *scratch, DIR_Ser XP_STRCPY (scratch, prefRoot); XP_STRCAT (scratch, "replication."); + DIR_SetBoolPref (scratch, "enabled", localScratch, DIR_TestFlag (server, DIR_REPLICATION_ENABLED), kDefaultReplicaEnabled); + if (server->replInfo) { char *excludedList = NULL; @@ -1819,15 +1906,16 @@ static int dir_SaveReplicationInfo (const char *prefRoot, char *scratch, DIR_Ser err = MK_OUT_OF_MEMORY; } - DIR_SetStringPref (scratch, "excludedAttributes", scratch, excludedList, kDefaultReplicaExcludedAttributes); + DIR_SetStringPref (scratch, "excludedAttributes", localScratch, excludedList, kDefaultReplicaExcludedAttributes); - DIR_SetBoolPref (scratch, "enabled", localScratch, server->replInfo->enabled, kDefaultReplicaEnabled); DIR_SetStringPref (scratch, "description", localScratch, server->replInfo->description, kDefaultReplicaDescription); + DIR_SetStringPref (scratch, "fileName", localScratch, server->replInfo->fileName, kDefaultReplicaFileName); DIR_SetStringPref (scratch, "filter", localScratch, server->replInfo->filter, kDefaultReplicaFilter); DIR_SetIntPref (scratch, "lastChangeNumber", localScratch, server->replInfo->lastChangeNumber, kDefaultReplicaChangeNumber); - DIR_SetIntPref (scratch, "generation", localScratch, server->replInfo->generation, kDefaultReplicaChangeNumberGeneration); + DIR_SetStringPref (scratch, "dataVersion", localScratch, server->replInfo->dataVersion, kDefaultReplicaDataVersion); } + XP_FREE(localScratch); return err; } @@ -1869,16 +1957,17 @@ int DIR_SaveServerPreferences (XP_List *wholeList) DIR_SetIntPref (prefstring, "dirType", tempString, s->dirType, (int) LDAPDirectory); DIR_SetBoolPref (prefstring, "isOffline", tempString, s->isOffline, kDefaultIsOffline); - DIR_SetBoolPref (prefstring, "autoCompleteEnabled", tempString, DIR_TestFlag(s, DIR_AUTO_COMPLETE_ENABLED), kDefaultAutoCompleteEnabled); + DIR_SetBoolPref (prefstring, "autoComplete.enabled", tempString, DIR_TestFlag(s, DIR_AUTO_COMPLETE_ENABLED), kDefaultAutoCompleteEnabled); + DIR_SetIntPref (prefstring, "autoComplete.style", tempString, (int32) s->autoCompleteStyle, kDefaultAutoCompleteStyle); + DIR_SetBoolPref (prefstring, "utf8Disabled", tempString, DIR_TestFlag(s, DIR_UTF8_DISABLED), kDefaultUtf8Disabled); DIR_SetBoolPref (prefstring, "enableAuth", tempString, s->enableAuth, kDefaultEnableAuth); + DIR_SetStringPref (prefstring, "authDn", tempString, s->authDn, NULL); DIR_SetBoolPref (prefstring, "savePassword", tempString, s->savePassword, kDefaultSavePassword); - if (s->savePassword) - { - DIR_SetStringPref (prefstring, "authDn", tempString, s->authDn, ""); - DIR_SetStringPref (prefstring, "password", tempString, s->password, ""); - } + DIR_SetStringPref (prefstring, "password", tempString, s->savePassword ? s->password : "", ""); + + DIR_SetBoolPref (prefstring, "publicDirectory", tempString, DIR_TestFlag(s, DIR_LDAP_PUBLIC_DIRECTORY), kDefaultLdapPublicDirectory); DIR_SaveCustomAttributes (prefstring, tempString, s); DIR_SaveCustomFilters (prefstring, tempString, s); @@ -1907,70 +1996,74 @@ static DIR_DefaultAttribute *DIR_GetDefaultAttribute (DIR_AttributeId id) { int i = 0; - static DIR_DefaultAttribute defaults[15]; - defaults[0].id = cn; - defaults[0].resourceId = MK_LDAP_COMMON_NAME; - defaults[0].name = "cn"; - - defaults[1].id = givenname; - defaults[1].resourceId = MK_LDAP_GIVEN_NAME; - defaults[1].name = "givenName"; - - defaults[2].id = sn; - defaults[2].resourceId = MK_LDAP_SURNAME; - defaults[2].name = "sn"; - - defaults[3].id = mail; - defaults[3].resourceId = MK_LDAP_EMAIL_ADDRESS; - defaults[3].name = "mail"; - - defaults[4].id = telephonenumber; - defaults[4].resourceId = MK_LDAP_PHONE_NUMBER; - defaults[4].name = "telephoneNumber"; - - defaults[5].id = o; - defaults[5].resourceId = MK_LDAP_ORGANIZATION; - defaults[5].name = "o"; - - defaults[6].id = ou; - defaults[6].resourceId = MK_LDAP_ORG_UNIT; - defaults[6].name = "ou"; - - defaults[7].id = l; - defaults[7].resourceId = MK_LDAP_LOCALITY; - defaults[7].name = "l"; - - defaults[8].id = street; - defaults[8].resourceId = MK_LDAP_STREET; - defaults[8].name = "street"; - - defaults[9].id = custom1; - defaults[9].resourceId = MK_LDAP_CUSTOM1; - defaults[9].name = "custom1"; - - defaults[10].id = custom2; - defaults[10].resourceId = MK_LDAP_CUSTOM2; - defaults[10].name = "custom2"; - - defaults[11].id = custom3; - defaults[11].resourceId = MK_LDAP_CUSTOM3; - defaults[11].name = "custom3"; - - defaults[12].id = custom4; - defaults[12].resourceId = MK_LDAP_CUSTOM4; - defaults[12].name = "custom4"; - - defaults[13].id = custom5; - defaults[13].resourceId = MK_LDAP_CUSTOM5; - defaults[13].name = "custom5"; + static DIR_DefaultAttribute defaults[16]; - defaults[14].id = auth; - defaults[14].resourceId = MK_LDAP_EMAIL_ADDRESS; - defaults[14].name = "mail"; + if (defaults[0].name == NULL) + { + defaults[0].id = cn; + defaults[0].resourceId = MK_LDAP_COMMON_NAME; + defaults[0].name = "cn"; + + defaults[1].id = givenname; + defaults[1].resourceId = MK_LDAP_GIVEN_NAME; + defaults[1].name = "givenName"; + + defaults[2].id = sn; + defaults[2].resourceId = MK_LDAP_SURNAME; + defaults[2].name = "sn"; + + defaults[3].id = mail; + defaults[3].resourceId = MK_LDAP_EMAIL_ADDRESS; + defaults[3].name = "mail"; + + defaults[4].id = telephonenumber; + defaults[4].resourceId = MK_LDAP_PHONE_NUMBER; + defaults[4].name = "telephoneNumber"; + + defaults[5].id = o; + defaults[5].resourceId = MK_LDAP_ORGANIZATION; + defaults[5].name = "o"; + + defaults[6].id = ou; + defaults[6].resourceId = MK_LDAP_ORG_UNIT; + defaults[6].name = "ou"; + + defaults[7].id = l; + defaults[7].resourceId = MK_LDAP_LOCALITY; + defaults[7].name = "l"; + + defaults[8].id = street; + defaults[8].resourceId = MK_LDAP_STREET; + defaults[8].name = "street"; + + defaults[9].id = custom1; + defaults[9].resourceId = MK_LDAP_CUSTOM1; + defaults[9].name = "custom1"; + + defaults[10].id = custom2; + defaults[10].resourceId = MK_LDAP_CUSTOM2; + defaults[10].name = "custom2"; + + defaults[11].id = custom3; + defaults[11].resourceId = MK_LDAP_CUSTOM3; + defaults[11].name = "custom3"; + + defaults[12].id = custom4; + defaults[12].resourceId = MK_LDAP_CUSTOM4; + defaults[12].name = "custom4"; + + defaults[13].id = custom5; + defaults[13].resourceId = MK_LDAP_CUSTOM5; + defaults[13].name = "custom5"; - defaults[15].id = cn; - defaults[15].resourceId = 0; - defaults[15].name = NULL; + defaults[14].id = auth; + defaults[14].resourceId = MK_LDAP_EMAIL_ADDRESS; + defaults[14].name = "mail"; + + defaults[15].id = cn; + defaults[15].resourceId = 0; + defaults[15].name = NULL; + } while (defaults[i].name) { @@ -2012,14 +2105,17 @@ const char **DIR_GetAttributeStrings (DIR_Server *server, DIR_AttributeId id) { const char **result = NULL; - /* First look in the custom attributes in case the attribute is overridden */ - XP_List *list = server->customAttributes; - DIR_Attribute *walkList = NULL; - - while ((walkList = XP_ListNextObject(list)) != NULL) + if (server && server->customAttributes) { - if (walkList->id == id) - result = (const char**)walkList->attrNames; + /* First look in the custom attributes in case the attribute is overridden */ + XP_List *list = server->customAttributes; + DIR_Attribute *walkList = NULL; + + while ((walkList = XP_ListNextObject(list)) != NULL) + { + if (walkList->id == id) + result = (const char**)walkList->attrNames; + } } /* If we didn't find it, look in our own static list of attributes */ @@ -2040,6 +2136,13 @@ const char *DIR_GetFirstAttributeString (DIR_Server *server, DIR_AttributeId id) return array[0]; } +const char *DIR_GetReplicationFilter (DIR_Server *server) +{ + if (server && server->replInfo) + return server->replInfo->filter; + else + return NULL; +} const char *DIR_GetFilterString (DIR_Server *server) { @@ -2328,58 +2431,100 @@ char *DIR_Unescape (const char *src, XP_Bool makeHtml) } -/***************************************************************************** - * Functions for building a secure connection to LDAP servers - * - * Use of PR_CALLBACK is required for Win16 because the socket API functions - * ultimately call into MOZOCK, which has DS-resident global variables. Ick. - */ - -#ifdef MOZ_LDAP - -HG29989 - -int DIR_ValidateRootDSE (DIR_Server *server, int32 gen, int32 first, int32 last) +int DIR_ValidateRootDSE (DIR_Server *server, char *version, int32 first, int32 last) { /* Here we validate the replication info that the server has against the * state of the local replica as stored in JS prefs. */ - XP_ASSERT(server && server->replInfo); - if (!server || !server->replInfo) + if (!server || !version) return -1; - /* The generation of the server's DB is different than when we last - * saw it, which means that the first and last change number we know - * are totally meaningless. + /* If the replication info file name in the server is NULL, that means the + * server has not been replicated. Reinitialize the change number and the + * data version and generate a file name for the replica database. */ - if (gen != server->replInfo->generation) - return MK_LDAP_REPL_CANT_SYNC_REPLICA; + if (!server->replInfo) + server->replInfo = (DIR_ReplicationInfo *) XP_CALLOC (1, sizeof (DIR_ReplicationInfo)); + if (!server->replInfo) + return MK_OUT_OF_MEMORY; - /* Some changes have come and gone on the server since we last - * replicated. Since we have no way to know what those changes were, - * we have no way to get sync'd up with the current server state - */ - if (first > server->replInfo->lastChangeNumber) - return MK_LDAP_REPL_CANT_SYNC_REPLICA; + if (!server->replInfo->fileName) + { + server->replInfo->lastChangeNumber = kDefaultReplicaChangeNumber; + XP_FREEIF(server->replInfo->filter); + server->replInfo->filter = XP_STRDUP(kDefaultReplicaFilter); + XP_FREEIF(server->replInfo->dataVersion); + server->replInfo->dataVersion = XP_STRDUP(version); + DIR_SetFileName (&(server->replInfo->fileName), server->serverName); + return 0; + } - /* We appear to have already replicated changes that the server - * hasn't made yet. Not likely + /* There are three cases in which we should reinitialize the replica: + * 1) The data version of the server's DB is different than when we last + * saw it, which means that the first and last change number we know + * are totally meaningless. + * 2) Some changes have come and gone on the server since we last + * replicated. Since we have no way to know what those changes were, + * we have no way to get sync'd up with the current server state + * 3) We have already replicated changes that the server hasn't made yet. + * Not likely. */ - if (last < server->replInfo->lastChangeNumber) - return MK_LDAP_REPL_CANT_SYNC_REPLICA; + if ( !server->replInfo->dataVersion || XP_STRCASECMP(version, server->replInfo->dataVersion) + || first > server->replInfo->lastChangeNumber + 1 + || last < server->replInfo->lastChangeNumber) + { + server->replInfo->lastChangeNumber = kDefaultReplicaChangeNumber; + XP_FREEIF(server->replInfo->dataVersion); + server->replInfo->dataVersion = XP_STRDUP(version); + } return 0; } +#ifdef MOZ_LDAP +int DIR_ParseRootDSE (DIR_Server *server, LDAP *ld, LDAPMessage *message) +{ + char **values = NULL; + + server->flags |= DIR_LDAP_ROOTDSE_PARSED; + server->flags &= ~(DIR_LDAP_VERSION3 | DIR_LDAP_VIRTUALLISTVIEW); + + values = ldap_get_values (ld, message, "supportedLDAPVersion"); + if (values && values[0]) + { + int i; + + for (i = 0; values[i]; i++) + { + if (XP_ATOI (values[i]) == LDAP_VERSION3) + { + server->flags |= DIR_LDAP_VERSION3; + break; + } + } + ldap_value_free (values); + } + + values = ldap_get_values (ld, message, "supportedControl"); + if (values) + { + int i; + + for (i = 0; values[i]; i++) + { + if (XP_STRCMP (values[i], LDAP_CONTROL_VLVREQUEST) == 0) + { + server->flags |= DIR_LDAP_VIRTUALLISTVIEW; + break; + } + } + ldap_value_free (values); + } + return 0; +} +#endif -#define DIR_AUTO_COMPLETE_ENABLED 0x00000001 -#define DIR_ENABLE_AUTH 0x00000002 -#define DIR_SAVE_PASSWORD 0x00000004 -#define DIR_UTF8_DISABLED 0x00000008 -#define DIR_IS_SECURE 0x00000010 -#define DIR_SAVE_RESULTS 0x00000020 -#define DIR_EFFICIENT_WILDCARDS 0x00000040 void DIR_SetAutoCompleteEnabled (XP_List *list, DIR_Server *server, XP_Bool enabled) { @@ -2391,11 +2536,11 @@ void DIR_SetAutoCompleteEnabled (XP_List *list, DIR_Server *server, XP_Bool enab if (enabled) { while (NULL != (tmp = XP_ListNextObject(list))) - tmp->flags &= ~DIR_AUTO_COMPLETE_ENABLED; - server->flags |= DIR_AUTO_COMPLETE_ENABLED; + DIR_ClearFlag (tmp, DIR_AUTO_COMPLETE_ENABLED); + DIR_SetFlag (server, DIR_AUTO_COMPLETE_ENABLED); } else - server->flags &= ~DIR_AUTO_COMPLETE_ENABLED; + DIR_ClearFlag (server, DIR_AUTO_COMPLETE_ENABLED); } } @@ -2497,9 +2642,9 @@ char *DIR_BuildUrl (DIR_Server *server, const char *dn, XP_Bool forAddToAB) } return url; } +#endif /* !MOZADDRSTANDALONE */ + +#endif /* !MOZ_MAIL_NEWS */ -#endif /* MOZ_LDAP */ - -#endif /* #if !defined(MOZADDRSTANDALONE) */ diff --git a/mozilla/lib/libmisc/glhist.c b/mozilla/lib/libmisc/glhist.c index 87561d5b3ff..28264e40e0e 100644 --- a/mozilla/lib/libmisc/glhist.c +++ b/mozilla/lib/libmisc/glhist.c @@ -524,6 +524,7 @@ GH_UpdateGlobalHistory(URL_Struct * URL_s) !strncasecomp(URL_s->address, "javascript:", 11) || !strncasecomp(URL_s->address, "livescript:", 11) || !strncasecomp(URL_s->address, "mailbox:", 8) || + !strncasecomp(URL_s->address, "imap:", 5) || !strncasecomp(URL_s->address, "mailto:", 7) || !strncasecomp(URL_s->address, "mocha:", 6) || !strncasecomp(URL_s->address, "news:", 5) || diff --git a/mozilla/lib/libmisc/mime.c b/mozilla/lib/libmisc/mime.c index 177e97df031..f38510b1636 100644 --- a/mozilla/lib/libmisc/mime.c +++ b/mozilla/lib/libmisc/mime.c @@ -16,19 +16,13 @@ * Reserved. */ - #include "xp.h" #include "mime.h" -#include "mkutils.h" -/* there used to be problems including msgcom.h with mime.h having to do with - differing prototypes for some of the msg_linebuffer calls, but that - seems to be fixed.And we need msgcom.h for win16 -*/ +#include "prefapi.h" #include "msgcom.h" #include "libi18n.h" - -/* for XP_GetString() */ #include "xpgetstr.h" + extern int MK_MSG_NO_RETURN_ADDRESS; extern int MK_MSG_NO_RETURN_ADDRESS_AT; extern int MK_MSG_NO_RETURN_ADDRESS_DOT; @@ -160,6 +154,11 @@ MISC_ValidateReturnAddress (MWContext *context, const char *addr) char *at; char *dot; char *fmt = 0; + XP_Bool validate; + + PREF_GetBoolPref("mail.identity.validate_addr", &validate); + + if ( !validate ) return 0; #if defined(XP_WIN) || defined(XP_OS2) if(FE_IsAltMailUsed(context)) diff --git a/mozilla/lib/libmocha/Makefile b/mozilla/lib/libmocha/Makefile index 3f4be24b39e..811fe6f072b 100644 --- a/mozilla/lib/libmocha/Makefile +++ b/mozilla/lib/libmocha/Makefile @@ -69,7 +69,8 @@ include $(DEPTH)/config/rules.mk DEFINES += -DDLL_SUFFIX=\"$(DLL_SUFFIX)\" EMBED_CFLAGS = $(CFLAGS) -I$(DEPTH)/lib/plugin -TAINT_CFLAGS = $(CFLAGS) -I$(DEPTH)/lib/libjar -I$(DEPTH)/sun-java/netscape/security/_jri +TAINT_CFLAGS = $(CFLAGS) -I$(DEPTH)/lib/libjar -I$(DEPTH)/sun-java/netscape/security/_jri \ + -I$(DEPTH)/dist/public/security ifneq ($(OS_ARCH),OS2) $(OBJDIR)/lm_embed.o: lm_embed.c diff --git a/mozilla/lib/libmocha/et_mocha.c b/mozilla/lib/libmocha/et_mocha.c index 4062ddb993b..dbcba2095c2 100644 --- a/mozilla/lib/libmocha/et_mocha.c +++ b/mozilla/lib/libmocha/et_mocha.c @@ -41,7 +41,7 @@ #include "pa_parse.h" #include "jsjava.h" #include "intl_csi.h" -#include "netcache.h" +/* #include "netcache.h" */ QueueStackElement * et_TopQueue = NULL; @@ -261,7 +261,7 @@ et_event_handler(JSEvent * e) * would cause lossage of mousemove messages we're sending all * mousemoves between mousedowns and ups so that if the scripts * starts capturing during the onmousedown handler, the mousemoves - * we would have lost will be sitting on the JS queue. + * we would have lost will be sitting on the JS queue. */ /* TRUE unless explicitly denied */ if (LM_EventCaptureCheck(e->ce.context, EVENT_MOUSEMOVE)) { if (lm_InputEvent(e->ce.context, lo_element, e, &rval) && diff --git a/mozilla/lib/libmocha/et_moz.c b/mozilla/lib/libmocha/et_moz.c index 6237c59d6f5..9be066529a2 100644 --- a/mozilla/lib/libmocha/et_moz.c +++ b/mozilla/lib/libmocha/et_moz.c @@ -34,7 +34,7 @@ #include "np.h" #include "prefapi.h" #include "pa_parse.h" -#include "netcache.h" +/* #include "netcache.h" */ #include "secnav.h" diff --git a/mozilla/lib/libmocha/lm_doc.c b/mozilla/lib/libmocha/lm_doc.c index d256e646951..00ae45e2b07 100644 --- a/mozilla/lib/libmocha/lm_doc.c +++ b/mozilla/lib/libmocha/lm_doc.c @@ -20,6 +20,7 @@ * * Brendan Eich, 9/8/95 */ +#include "rosetta.h" #include "lm.h" #include "prtypes.h" #include "plhash.h" @@ -1009,16 +1010,7 @@ doc_open_stream(JSContext *cx, MochaDecoder *decoder, JSObject *doc_obj, stream = 0; cached_url = 0; - /* If the writer is secure, pass its security info into the cache. */ - running = JS_GetPrivate(cx, JS_GetGlobalObject(cx)); - he = SHIST_GetCurrent(&running->window_context->hist); - if (he && he->security_on) { - /* Copy security stuff (checking for malloc failure) */ - url_struct->security_on = he->security_on; - url_struct->sec_info = SECNAV_CopySSLSocketStatus(he->sec_info); - if (he->sec_info && !url_struct->sec_info) - goto bad; - } + HG99880 /* If we're opening a stream for the window's document */ if (doc->layer_id == LO_DOCUMENT_LAYER_ID) { diff --git a/mozilla/lib/libmocha/lm_form.c b/mozilla/lib/libmocha/lm_form.c index 1f617325475..94633e8e205 100644 --- a/mozilla/lib/libmocha/lm_form.c +++ b/mozilla/lib/libmocha/lm_form.c @@ -22,7 +22,8 @@ */ #include "lm.h" #include "lo_ele.h" -#include "netutils.h" +/* #include "netutils.h" */ +#include "mkutils.h" #include "layout.h" #include "pa_tags.h" #include "shist.h" diff --git a/mozilla/lib/libmocha/lm_jsd.c b/mozilla/lib/libmocha/lm_jsd.c index 5f4c9984687..5d9c890df42 100644 --- a/mozilla/lib/libmocha/lm_jsd.c +++ b/mozilla/lib/libmocha/lm_jsd.c @@ -23,12 +23,12 @@ /* Please leave outside of ifdef for windows precompiled headers */ #include "lm.h" -#include "jsdebug.h" #include "net.h" #include "prlink.h" #ifdef JSDEBUGGER +#include "jsdebug.h" /***************************************/ /* a static global, oh well... */ diff --git a/mozilla/lib/libmocha/lm_nav.c b/mozilla/lib/libmocha/lm_nav.c index 62ead0b4981..92b62a912e2 100644 --- a/mozilla/lib/libmocha/lm_nav.c +++ b/mozilla/lib/libmocha/lm_nav.c @@ -20,6 +20,7 @@ * * Brendan Eich, 11/16/95 */ +#include "rosetta.h" #include "lm.h" #include "prmem.h" #ifdef JAVA @@ -349,8 +350,7 @@ lm_DefineNavigator(MochaDecoder *decoder) nav->appPlatform = JS_NewStringCopyZ(cx, XP_AppPlatform); JS_LockGCThing(cx, nav->appPlatform); - nav->securityPolicy = JS_NewStringCopyZ(cx, SECNAV_GetPolicyNameString()); - JS_LockGCThing(cx, nav->securityPolicy); + HG99881 /* Ask lm_plgin.c to create objects for plug-in and MIME-type arrays */ diff --git a/mozilla/lib/libmocha/lm_taint.c b/mozilla/lib/libmocha/lm_taint.c index 349afdc9825..9245d4459d0 100644 --- a/mozilla/lib/libmocha/lm_taint.c +++ b/mozilla/lib/libmocha/lm_taint.c @@ -41,6 +41,7 @@ #include "jsatom.h" #include "jsscope.h" +#ifdef JAVA /* Needed to access private method; making method public would be security hole */ #define IMPLEMENT_netscape_security_PrivilegeManager @@ -56,6 +57,7 @@ #endif /* XP_MAC */ #include "netscape_security_Privilege.h" #include "netscape_security_Target.h" +#endif extern JRIEnv * LJ_JSJ_CurrentEnv(JSContext * cx); extern char *LJ_GetAppletScriptOrigin(JRIEnv *env); @@ -447,7 +449,9 @@ lm_GetSubjectOriginURL(JSContext *cx) * them is so expensive. */ typedef struct SharedZig { +#ifdef JAVA ZIG *zig; +#endif int32 refCount; JRIGlobalRef zigObjectRef; } SharedZig; diff --git a/mozilla/lib/libmocha/lm_win.c b/mozilla/lib/libmocha/lm_win.c index 825daf64c15..4d6eab384a2 100644 --- a/mozilla/lib/libmocha/lm_win.c +++ b/mozilla/lib/libmocha/lm_win.c @@ -20,6 +20,7 @@ * * Brendan Eich, 9/8/95 */ +#include "rosetta.h" #include "lm.h" #include "xp.h" #include "xpgetstr.h" @@ -266,11 +267,8 @@ win_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) break; case WIN_SECURE: - status = ET_GetSecurityStatus(context); - if (status == SSL_SECURITY_STATUS_ON_LOW || status == SSL_SECURITY_STATUS_ON_HIGH) - *vp = JSVAL_TRUE; - else - *vp = JSVAL_FALSE; + *vp = JSVAL_FALSE; + HG99882 break; case WIN_LOADING: diff --git a/mozilla/lib/libparse/pa_parse.c b/mozilla/lib/libparse/pa_parse.c index b5cd5995f48..65efaee0190 100644 --- a/mozilla/lib/libparse/pa_parse.c +++ b/mozilla/lib/libparse/pa_parse.c @@ -1878,6 +1878,12 @@ pa_FetchDocData(MWContext *window_id) return(doc_data); } +XP_Bool ValidateDocData(MWContext *window_id) +{ + if (pa_FetchDocData(window_id)) + return TRUE; + return FALSE; +} static Bool pa_RemoveDocData(pa_DocData *target_doc_data) diff --git a/mozilla/lib/libpics/htstring.c b/mozilla/lib/libpics/htstring.c index 8d23e5829f6..6ce20a8222e 100644 --- a/mozilla/lib/libpics/htstring.c +++ b/mozilla/lib/libpics/htstring.c @@ -33,7 +33,7 @@ with copyright holders. ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: htstring.c,v 3.1 1998-03-28 03:32:07 ltabb Exp $ +** @(#) $Id: htstring.c,v 3.2 1998-06-22 21:20:29 spider Exp $ ** ** Original version came with listserv implementation. ** Version TBL Oct 91 replaces one which modified the strings. @@ -73,9 +73,9 @@ PUBLIC int WWW_TraceFlag = 0; /* Global trace flag for ALL W3 code */ /* if ((diff = TOLOWER(*a) - TOLOWER(*b))) */ /* return diff; */ /* } */ -/* if (*a) return 1; /* a was longer than b */ -/* if (*b) return -1; /* a was shorter than b */ -/* return 0; /* Exact match */ +/* if (*a) return 1; */ /* a was longer than b */ +/* if (*b) return -1; */ /* a was shorter than b */ +/* return 0; */ /* Exact match */ /*} */ /************************************************************************/ /* --- END removed by mharmsen@netscape.com on 7/9/97 --- */ @@ -93,12 +93,12 @@ PUBLIC int WWW_TraceFlag = 0; /* Global trace flag for ALL W3 code */ /* */ /* for(p=a, q=b;; p++, q++) { */ /* int diff; */ -/* if (p == a+n) return 0; /* Match up to n characters */ +/* if (p == a+n) return 0; */ /* Match up to n characters */ /* if (!(*p && *q)) return *p - *q; */ /* diff = TOLOWER(*p) - TOLOWER(*q); */ /* if (diff) return diff; */ /* } */ -/* /*NOTREACHED */ +/* NOTREACHED */ /*} */ /**********************************************************************/ /* --- END removed by mharmsen@netscape.com on 7/9/97 --- */ diff --git a/mozilla/lib/libpics/htutils.h b/mozilla/lib/libpics/htutils.h index e4db47e11f0..a555acbf083 100644 --- a/mozilla/lib/libpics/htutils.h +++ b/mozilla/lib/libpics/htutils.h @@ -143,8 +143,8 @@ MACROS FOR FUNCTION DECLARATIONS */ /* --- BEGIN removed by mharmsen@netscape.com on 7/9/97 --- */ -/* #define PUBLIC /* Accessible outside this module */ -/* #define PRIVATE static /* Accessible only within this module */ +/* #define PUBLIC */ /* Accessible outside this module */ +/* #define PRIVATE static */ /* Accessible only within this module */ /* --- END removed by mharmsen@netscape.com on 7/9/97 --- */ /* @@ -244,8 +244,8 @@ THE LOCAL EQUIVALENTS OF CR AND LF */ /* --- BEGIN removed by mharmsen@netscape.com on 7/9/97 --- */ -/* #define LF FROMASCII('\012') /* ASCII line feed LOCAL EQUIVALENT */ -/* #define CR FROMASCII('\015') /* Will be converted to ^M for transmission */ +/* #define LF FROMASCII('\012') */ /* ASCII line feed LOCAL EQUIVALENT */ +/* #define CR FROMASCII('\015') */ /* Will be converted to ^M for transmission */ /* --- END removed by mharmsen@netscape.com on 7/9/97 --- */ /* @@ -265,6 +265,6 @@ LIBRARY DYNAMIC MEMORY MAGEMENT ___________________________________ - @(#) $Id: htutils.h,v 3.1 1998-03-28 03:32:08 ltabb Exp $ + @(#) $Id: htutils.h,v 3.2 1998-06-22 21:20:29 spider Exp $ */ diff --git a/mozilla/lib/mac/UserInterface/CBevelView.cp b/mozilla/lib/mac/UserInterface/CBevelView.cp index 3ef6ae361d6..2473d77972c 100644 --- a/mozilla/lib/mac/UserInterface/CBevelView.cp +++ b/mozilla/lib/mac/UserInterface/CBevelView.cp @@ -46,8 +46,9 @@ CBevelView::CBevelView(LStream *inStream) if (theBevelResID != 0) { - StResource theBevelRes(ResType_BevelDescList, theBevelResID); + StResource theBevelRes(ResType_BevelDescList, theBevelResID, false, false); //don't throw on failure + if (theBevelRes.mResourceH != NULL) { StHandleLocker theLock(theBevelRes); LDataStream theBevelStream(*theBevelRes.mResourceH, ::GetHandleSize(theBevelRes)); diff --git a/mozilla/lib/mac/UserInterface/CButton.cp b/mozilla/lib/mac/UserInterface/CButton.cp index f154a01daca..ba036e2dd2a 100644 --- a/mozilla/lib/mac/UserInterface/CButton.cp +++ b/mozilla/lib/mac/UserInterface/CButton.cp @@ -27,10 +27,6 @@ #include #include -#if defined(QAP_BUILD) -#include -#endif - #include "UGraphicGizmos.h" #include "CButton.h" #include "StSetBroadcasting.h" @@ -53,28 +49,6 @@ // ¥ Class CButton // ¥¥¥ // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -/* -#if defined(QAP_BUILD) -void -CButton::QapGetContents (PWCINFO pwc, short *pCount, short max) -{ - QapAddViewItem (pwc, pCount, WT_ASSIST_ITEM, WC_PUSH_BUTTON); -} - -void -CButton::QapGetCDescriptorMax (char * cp_buf, short s_max) -{ - Str255 controlTitle; - short sMinLen; - - GetDescriptor(controlTitle); - - memset (cp_buf, 0, s_max); - sMinLen = ((short)controlTitle[0] < s_max ? (short)controlTitle[0] : s_max); - strncpy (cp_buf, (const char *)&controlTitle[1], sMinLen); -} -#endif -*/ // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // ¥ CButton // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ diff --git a/mozilla/lib/mac/UserInterface/CButton.h b/mozilla/lib/mac/UserInterface/CButton.h index 876d542be46..8e538594d89 100644 --- a/mozilla/lib/mac/UserInterface/CButton.h +++ b/mozilla/lib/mac/UserInterface/CButton.h @@ -22,10 +22,6 @@ #include -#if defined(QAP_BUILD) -#include -#endif - #include "MPaneEnablerPolicy.h" // abstract base class for button controls @@ -52,11 +48,6 @@ class CButton : public LControl, public MPaneEnablerPolicy virtual void SetGraphicID(ResIDT inResID); virtual ResIDT GetGraphicID(void) const; -//#if defined(QAP_BUILD) -// virtual void QapGetContents (PWCINFO pwc, short *pCount, short max); -// virtual void QapGetCDescriptorMax (char * cp_buf, short s_max); -//#endif - virtual void Draw(RgnHandle inSuperDrawRgnH); protected: diff --git a/mozilla/lib/mac/UserInterface/CButtonEnablerReloadStop.cp b/mozilla/lib/mac/UserInterface/CButtonEnablerReloadStop.cp index 03bb60d3681..5b4ce67baf5 100644 --- a/mozilla/lib/mac/UserInterface/CButtonEnablerReloadStop.cp +++ b/mozilla/lib/mac/UserInterface/CButtonEnablerReloadStop.cp @@ -28,7 +28,7 @@ CButtonEnablerReloadStop::CButtonEnablerReloadStop(LStream* inStream) // ta da! } -void CButtonEnablerReloadStop::ExecuteSelf(MessageT inMessage, void *ioParam) +void CButtonEnablerReloadStop::ExecuteSelf(MessageT /* inMessage */, void * /* ioParam */) { LControl* theControl = dynamic_cast(mPane); LCommander* theTarget = LCommander::GetTarget(); diff --git a/mozilla/lib/mac/UserInterface/CContextMenuAttachment.cp b/mozilla/lib/mac/UserInterface/CContextMenuAttachment.cp index 245cf92e802..a49495837e8 100644 --- a/mozilla/lib/mac/UserInterface/CContextMenuAttachment.cp +++ b/mozilla/lib/mac/UserInterface/CContextMenuAttachment.cp @@ -17,6 +17,7 @@ */ #include "CContextMenuAttachment.h" +#include "xp.h" #include "CDrawingState.h" #include "CApplicationEventAttachment.h" @@ -53,6 +54,9 @@ CContextMenuAttachment::EClickState CContextMenuAttachment::WaitMouseAction( return eMouseTimeout; } + if (inDelay == kDefaultDelay) // GetDblTime() can be 48, 32 or 20 ticks + inDelay = MAX(GetDblTime(), 30); // but 20 is too short to display the popup + while (::StillDown()) { Point theCurrentPoint; @@ -176,7 +180,7 @@ UInt16 CContextMenuAttachment::PruneMenu(LMenu* inMenu) void CContextMenuAttachment::DoPopup(const SMouseDownEvent& inMouseDown, EClickState& outResult) //----------------------------------- { - Try_ + try { LMenu* menu = BuildMenu(); MenuHandle menuH = menu->GetMacMenuH(); @@ -192,11 +196,9 @@ void CContextMenuAttachment::DoPopup(const SMouseDownEvent& inMouseDown, EClickS StMercutioMDEFTextState theMercutioMDEFTextState; if (mTextTraitsID) { - mHostView->FocusDraw(); TextTraitsH traitsH = UTextTraits::LoadTextTraits(mTextTraitsID); if (traitsH) { - mHostView->FocusDraw(); ::LMSetSysFontFam((**traitsH).fontNumber); ::LMSetSysFontSize((**traitsH).size); ::LMSetLastSPExtra(-1L); @@ -225,30 +227,25 @@ void CContextMenuAttachment::DoPopup(const SMouseDownEvent& inMouseDown, EClickS if (command) mHostCommander->ObeyCommand(command, (void*)&inMouseDown); } - Catch_(inError) + catch(...) { } - EndCatch_ } // CContextMenuAttachment::DoPopup - -// -// Execute -// +//---------------------------------------------------------------------------------------- +Boolean CContextMenuAttachment::Execute( MessageT inMessage, void *ioParam ) // Overridden to listen for multiple messages (context menu and context menu cursor) -// -Boolean -CContextMenuAttachment :: Execute ( MessageT inMessage, void *ioParam ) +//---------------------------------------------------------------------------------------- { Boolean executeHost = true; - if ((inMessage == msg_ContextMenu) || (inMessage == msg_ContextMenuCursor)) { + if ((inMessage == msg_ContextMenu) || (inMessage == msg_ContextMenuCursor)) + { ExecuteSelf(inMessage, ioParam); executeHost = mExecuteHost; } - return executeHost; -} +} // CContextMenuAttachment::Execute //----------------------------------- @@ -260,57 +257,46 @@ void CContextMenuAttachment::ExecuteSelf( mExecuteHost = true; if (!mHostView || !mHostCommander) return; - - switch ( inMessage ) { + switch ( inMessage ) + { case msg_ContextMenu: + mHostView->FocusDraw(); // so that coordinate computations are correct. SExecuteParams& params = *(SExecuteParams*)ioParam; const SMouseDownEvent& mouseDown = *params.inMouseDown; params.outResult = WaitMouseAction( mouseDown.whereLocal, - mouseDown.macEvent.when, - 2 * GetDblTime()); + mouseDown.macEvent.when); if (params.outResult == eMouseTimeout) DoPopup(mouseDown, params.outResult); break; - case msg_ContextMenuCursor: Assert_(ioParam != NULL); ChangeCursor ( (EventRecord*)ioParam ); break; - } // case of which message - } // CContextMenuAttachment::ExecuteSelf -// -// BuildMenu -// THROWS int on error -// -// Reads in the menu with the id given in the PPob. This can be overridden to read the menu -// from some other place, such as from the back-end. -// - -LMenu* -CContextMenuAttachment :: BuildMenu ( ) +//---------------------------------------------------------------------------------------- +LMenu* CContextMenuAttachment::BuildMenu( ) +// THROWS OSErr on error +// Reads in the menu with the id given in the PPob. This can be overridden to read the +// menu from some other place, such as from the back-end. +//---------------------------------------------------------------------------------------- { LMenu* menu = new LMenu(mMenuID); MenuHandle menuH = menu->GetMacMenuH(); if (!menuH) - throw ResError(); + throw (OSErr)ResError(); ::DetachResource((Handle)menuH); return menu; } // CContextMenuAttachment::BuildMenu - -// -// ChangeCursor -// +//---------------------------------------------------------------------------------------- +void CContextMenuAttachment::ChangeCursor( const EventRecord* inEvent ) // Makes the mouse the contextual menu cursor from OS8 if cmd key is down -// -void -CContextMenuAttachment :: ChangeCursor ( const EventRecord* inEvent ) +//---------------------------------------------------------------------------------------- { if ( inEvent->modifiers & controlKey ) { CursHandle contextCurs = ::GetCursor ( kContextualCursorID ); @@ -319,5 +305,4 @@ CContextMenuAttachment :: ChangeCursor ( const EventRecord* inEvent ) } else ::InitCursor(); - } // ChangeCursor diff --git a/mozilla/lib/mac/UserInterface/CContextMenuAttachment.h b/mozilla/lib/mac/UserInterface/CContextMenuAttachment.h index 4ba0203cef6..5c0969435ce 100644 --- a/mozilla/lib/mac/UserInterface/CContextMenuAttachment.h +++ b/mozilla/lib/mac/UserInterface/CContextMenuAttachment.h @@ -63,16 +63,19 @@ public: EClickState outResult; }; - virtual Boolean Execute ( MessageT inMessage, void *ioParam ) ; + enum { kDefaultDelay = -1}; -protected: - - enum { kContextualCursorID = 6610 } ; - - EClickState WaitMouseAction( + // Public utility method + static EClickState WaitMouseAction( const Point& inInitialPoint, Int32 inWhen, - Int32 inDelay); + Int32 inDelay = kDefaultDelay); +protected: + + enum { kContextualCursorID = 6610 }; + + virtual Boolean Execute( MessageT inMessage, void *ioParam ); + virtual void ExecuteSelf( MessageT inMessage, void* ioParam); @@ -82,9 +85,9 @@ protected: virtual UInt16 PruneMenu(LMenu* inMenu); // override to do something other than read in a menu from the resource fork - virtual LMenu* BuildMenu ( ) ; + virtual LMenu* BuildMenu( ) ; - virtual void ChangeCursor ( const EventRecord* inEvent ) ; + virtual void ChangeCursor( const EventRecord* inEvent ); //---- // Data diff --git a/mozilla/lib/mac/UserInterface/CDrawingState.cp b/mozilla/lib/mac/UserInterface/CDrawingState.cp index 42c61a89ede..dad11ab98ae 100644 --- a/mozilla/lib/mac/UserInterface/CDrawingState.cp +++ b/mozilla/lib/mac/UserInterface/CDrawingState.cp @@ -54,6 +54,8 @@ StMercutioMDEFTextState::SetUpForMercurtioMDEF() ::TextFont(systemFont); ::TextSize(0); +/* duh. this does exactly what we just did. + if (UEnvironment::HasFeature(env_SupportsColor)) { ::GetCWMgrPort(&mWMgrCPort); @@ -63,7 +65,7 @@ StMercutioMDEFTextState::SetUpForMercurtioMDEF() ::TextFont(systemFont); ::TextSize(0); } - +*/ ::SetPort(mPort); } @@ -78,12 +80,14 @@ StMercutioMDEFTextState::Restore() ::TextFont(mWMgrFont); ::TextSize(mWMgrSize); +/* duh. this does exactly what we just did. if (UEnvironment::HasFeature(env_SupportsColor)) { ::SetPort((GrafPtr)mWMgrCPort); ::TextFont(mCWMgrFont); ::TextSize(mCWMgrSize); } +*/ ::SetPort(mPort); } @@ -138,9 +142,9 @@ StSysFontState::Restore() void StSysFontState::SetTextTraits( - ResIDT inTextTraitsID) + ResIDT inTextTraitsID ) { - TextTraitsH traitsH = UTextTraits::LoadTextTraits ( 130 ); + TextTraitsH traitsH = UTextTraits::LoadTextTraits ( inTextTraitsID ); if ( traitsH ) { // Bug #64133 kellys @@ -149,6 +153,7 @@ StSysFontState::SetTextTraits( ::LMSetSysFontFam ( ::GetScriptVariable(::FontToScript(1), smScriptAppFond) ); else ::LMSetSysFontFam ( (**traitsH).fontNumber ); + ::LMSetSysFontSize ( (**traitsH).size ); ::LMSetLastSPExtra ( -1L ); } diff --git a/mozilla/lib/mac/UserInterface/CDrawingState.h b/mozilla/lib/mac/UserInterface/CDrawingState.h index 470196710f5..fbb9e107441 100644 --- a/mozilla/lib/mac/UserInterface/CDrawingState.h +++ b/mozilla/lib/mac/UserInterface/CDrawingState.h @@ -38,11 +38,11 @@ public: private: GrafPtr mPort; GrafPtr mWMgrPort; - CGrafPtr mWMgrCPort; + // CGrafPtr mWMgrCPort; Int16 mWMgrFont; Int16 mWMgrSize; - Int16 mCWMgrFont; - Int16 mCWMgrSize; + //Int16 mCWMgrFont; + //Int16 mCWMgrSize; }; class StSysFontState @@ -54,7 +54,7 @@ public: void Save(); void Restore(); - void SetTextTraits(ResIDT inTextTraitsID); + void SetTextTraits(ResIDT inTextTraitsID = 130); private: Int16 mFont; diff --git a/mozilla/lib/mac/UserInterface/CInlineEditField.cp b/mozilla/lib/mac/UserInterface/CInlineEditField.cp index dd2750f62dd..897198324b2 100644 --- a/mozilla/lib/mac/UserInterface/CInlineEditField.cp +++ b/mozilla/lib/mac/UserInterface/CInlineEditField.cp @@ -64,7 +64,8 @@ void CInlineEditField::SetDescriptor(ConstStr255Param inDescriptor) { - inherited::SetDescriptor(inDescriptor); + Inherited::SetDescriptor(inDescriptor); + if (mGrowableBorder) AdjustFrameWidthToText(); @@ -134,7 +135,7 @@ void CInlineEditField::UpdateEdit(ConstStr255Param inEditText, const SPoint32 *i void CInlineEditField::FinishCreateSelf(void) { - inherited::FinishCreateSelf(); + Inherited::FinishCreateSelf(); Hide(); // Should be invisible to start @@ -156,7 +157,7 @@ void CInlineEditField::ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Bo if ( !inWidthDelta && !inHeightDelta ) return; - inherited::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); + Inherited::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh); if ( inRefresh && mGrowableBorder) { Rect portRect, refreshRect; @@ -215,7 +216,7 @@ Boolean CInlineEditField::HandleKeyPress(const EventRecord &inKeyEvent) { } } - return inherited::HandleKeyPress(inKeyEvent); + return Inherited::HandleKeyPress(inKeyEvent); } @@ -227,7 +228,7 @@ void CInlineEditField::DontBeTarget(void) { StValueChanger change(mGivingUpTarget, true); - inherited::DontBeTarget(); + Inherited::DontBeTarget(); PaneIDT paneID = mPaneID; BroadcastMessage(msg_HidingInlineEditField, &paneID); @@ -254,7 +255,7 @@ void CInlineEditField::HideSelf(void) { void CInlineEditField::TakeOffDuty(void) { - inherited::TakeOffDuty(); + Inherited::TakeOffDuty(); mOnDuty = triState_Off; // Taking our chain off duty means that we are hidden and // should no longer be in the chain of command. diff --git a/mozilla/lib/mac/UserInterface/CInlineEditField.h b/mozilla/lib/mac/UserInterface/CInlineEditField.h index cd8ec1fea95..bbfd448e621 100644 --- a/mozilla/lib/mac/UserInterface/CInlineEditField.h +++ b/mozilla/lib/mac/UserInterface/CInlineEditField.h @@ -59,9 +59,9 @@ class CInlineEditField : public LBroadcasterEditField { -#if !defined(__MWERKS__) || (__MWERKS__ >= 0x2000) - typedef LBroadcasterEditField inherited; -#endif + + typedef LBroadcasterEditField Inherited; + public: diff --git a/mozilla/lib/mac/UserInterface/CMouseDispatcher.cp b/mozilla/lib/mac/UserInterface/CMouseDispatcher.cp index 070caf30a72..6201d99b733 100644 --- a/mozilla/lib/mac/UserInterface/CMouseDispatcher.cp +++ b/mozilla/lib/mac/UserInterface/CMouseDispatcher.cp @@ -49,6 +49,12 @@ void CMouseDispatcher::ExecuteSelf( if (theEvent->what == kHighLevelEvent) return; + // Don't process mouse position for update events (otherwise, tooltip + // panes that are drawn under the mouse position get deleted before + // the update event even gets processed - jrm 98/05/05. + if (theEvent->what == updateEvt) + return; + LPane* theCurrentPane = nil; LPane* theLastPane = LPane::GetLastPaneMoused(); diff --git a/mozilla/lib/mac/UserInterface/CNotificationAttachment.cp b/mozilla/lib/mac/UserInterface/CNotificationAttachment.cp index e63d16ecb58..ee4f116e54f 100644 --- a/mozilla/lib/mac/UserInterface/CNotificationAttachment.cp +++ b/mozilla/lib/mac/UserInterface/CNotificationAttachment.cp @@ -59,7 +59,7 @@ void CNotificationAttachment::ExecuteSelf( void CNotificationAttachment::Post(void) { - OSErr theErr = ::GetIconSuite(&mIconSuite, 170, svAllSmallData); + OSErr theErr = ::GetIconSuite(&mIconSuite, 128, svAllSmallData); ThrowIfOSErr_(theErr); ::HNoPurge(mIconSuite); diff --git a/mozilla/lib/mac/UserInterface/CPaneEnabler.cp b/mozilla/lib/mac/UserInterface/CPaneEnabler.cp index 25be81da699..530e145a4ea 100644 --- a/mozilla/lib/mac/UserInterface/CPaneEnabler.cp +++ b/mozilla/lib/mac/UserInterface/CPaneEnabler.cp @@ -111,7 +111,7 @@ void CPaneEnabler::UpdatePanes() } // CPaneEnabler::UpdatePanes //----------------------------------- -void CPaneEnabler::ExecuteSelf(MessageT inMessage, void*) +void CPaneEnabler::ExecuteSelf(MessageT /* inMessage */, void*) //----------------------------------- { MPaneEnablerPolicy* thePolicy = dynamic_cast(mPane); diff --git a/mozilla/lib/mac/UserInterface/CPatternButton.cp b/mozilla/lib/mac/UserInterface/CPatternButton.cp index 5925c552089..98336a430ca 100644 --- a/mozilla/lib/mac/UserInterface/CPatternButton.cp +++ b/mozilla/lib/mac/UserInterface/CPatternButton.cp @@ -91,7 +91,8 @@ void CPatternButton::DrawButtonContent(void) void CPatternButton::DrawButtonGraphic(void) { - bool useMouseOverIcon = false; + Boolean useMouseOverIcon = false; + mIconTransform = kTransformNone; if (IsEnabled() && IsActive()) @@ -99,23 +100,31 @@ void CPatternButton::DrawButtonGraphic(void) if (!IsBehaviourButton() && (GetValue() == Button_On)) { // do something different if IsTrackInside() - //theNewID += 2; + //theNewID += 1; } - else if (IsTrackInside()) + else if (IsTrackInside()) { + //theNewID += 1; mIconTransform = kTransformSelected; - else if (IsMouseInFrame()) + } + else if (IsMouseInFrame()) { useMouseOverIcon = true; + } } - else + else { + //theNewID += 1; mIconTransform = kTransformDisabled; + } - ResIDT theIconID; - if ( useMouseOverIcon ) { + ResIDT theIconID; + + if (useMouseOverIcon) { theIconID = GetGraphicID(); SetGraphicID(theIconID + 2); } + CToolbarButton::DrawButtonGraphic(); - if ( useMouseOverIcon ) + + if (useMouseOverIcon) SetGraphicID(theIconID); } diff --git a/mozilla/lib/mac/UserInterface/CPatternButtonPopupText.cp b/mozilla/lib/mac/UserInterface/CPatternButtonPopupText.cp index 17a68601046..055faf921a3 100644 --- a/mozilla/lib/mac/UserInterface/CPatternButtonPopupText.cp +++ b/mozilla/lib/mac/UserInterface/CPatternButtonPopupText.cp @@ -24,6 +24,8 @@ #include "CSharedPatternWorld.h" #include "CTargetedUpdateMenuRegistry.h" +#include "PascalString.h" + // This class overrides CPatternButtonPopup to provide a popup menu which // changes the descriptor based on the menu selection // assumes left-justified text in DrawButtonTitle() @@ -141,7 +143,11 @@ CPatternButtonPopupText::DrawButtonTitle(void) if (IsTrackInside()) ::RGBForeColor(&UGAColorRamp::GetWhiteColor()); - UGraphicGizmos::PlaceStringInRect(mTitle, mCachedTitleFrame, teFlushLeft, teCenter); + CStr255 truncTitle(mTitle); + + ::TruncString( mFrameSize.width - (gsPopup_ArrowButtonWidth + 5), truncTitle, smTruncEnd); + + UGraphicGizmos::PlaceStringInRect(truncTitle, mCachedTitleFrame, teFlushLeft, teCenter); DrawPopupArrow(); } diff --git a/mozilla/lib/mac/UserInterface/CPatternTabControl.cp b/mozilla/lib/mac/UserInterface/CPatternTabControl.cp index 7dad2fe2db3..b4d9c223a83 100644 --- a/mozilla/lib/mac/UserInterface/CPatternTabControl.cp +++ b/mozilla/lib/mac/UserInterface/CPatternTabControl.cp @@ -49,7 +49,7 @@ CPatternTabControl::~CPatternTabControl() //----------------------------------- void CPatternTabControl::DrawOneTabBackground( RgnHandle inRegion, - Boolean inCurrentTab) + Boolean /* inCurrentTab */) //----------------------------------- { Point theAlignment; @@ -60,7 +60,7 @@ void CPatternTabControl::DrawOneTabBackground( } // CPatternTabControl::DrawOneTabBackground //----------------------------------- -void CPatternTabControl::DrawOneTabFrame(RgnHandle inRegion, Boolean inCurrentTab) +void CPatternTabControl::DrawOneTabFrame(RgnHandle inRegion, Boolean /* inCurrentTab */) //----------------------------------- { ::FrameRgn(inRegion); diff --git a/mozilla/lib/mac/UserInterface/CProgressBar.cp b/mozilla/lib/mac/UserInterface/CProgressBar.cp index 70a18b5e86e..7a4cf384a32 100644 --- a/mozilla/lib/mac/UserInterface/CProgressBar.cp +++ b/mozilla/lib/mac/UserInterface/CProgressBar.cp @@ -61,7 +61,6 @@ void CProgressBar::FinishCreateSelf(void) PixMapHandle theMap = (**mPolePattern).patMap; mPatWidth = RectWidth((*theMap)->bounds); -// SetValueRange(Range32T(0,100)); mValueRange = 100; } @@ -123,7 +122,9 @@ void CProgressBar::DrawSelf(void) ::GetAuxWin(thePort, &theAuxHandle); CTabHandle theColorTable = (**theAuxHandle).awCTable; - RGBColor theWindowBack = UGraphicGizmos::FindInColorTable(theColorTable, wContentColor); + RGBColor theWindowBack; + + UGraphicGizmos::FindInColorTable(theColorTable, wContentColor, theWindowBack); RGBColor theBodyColor, theFrameColor, theBarColor; #if 0 @@ -261,13 +262,3 @@ void CProgressBar::SetValue(Int32 inValue) Draw(NULL); } } - -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -// ¥ -// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -#if 0 -void CProgressBar::SetValueRange(const Range32T& inRange) -{ - mValueRange = inRange; -} -#endif diff --git a/mozilla/lib/mac/UserInterface/CSimpleDividedView.cp b/mozilla/lib/mac/UserInterface/CSimpleDividedView.cp index a483c4e32f0..9c8cabfb434 100644 --- a/mozilla/lib/mac/UserInterface/CSimpleDividedView.cp +++ b/mozilla/lib/mac/UserInterface/CSimpleDividedView.cp @@ -206,9 +206,9 @@ void CSimpleDividedView::FinishCreateSelf() // ¥ AdaptToSuperFrameSize // --------------------------------------------------------------------------- // Do not want to move the view around -void CSimpleDividedView::AdaptToSuperFrameSize(Int32 inSurrWidthDelta, - Int32 inSurrHeightDelta, - Boolean inRefresh) +void CSimpleDividedView::AdaptToSuperFrameSize(Int32 /* inSurrWidthDelta */, + Int32 /* inSurrHeightDelta */, + Boolean /* inRefresh */) { ReadjustConstraints(); } @@ -291,7 +291,7 @@ void CSimpleDividedView::ClickSelf(const SMouseDownEvent &inMouseDown) // --------------------------------------------------------------------------- // Standard vert/horizontal sliders -void CSimpleDividedView::AdjustCursorSelf(Point inPortPt, const EventRecord& inMacEvent ) +void CSimpleDividedView::AdjustCursorSelf(Point /* inPortPt */, const EventRecord& /* inMacEvent */ ) { ResIDT cursID = fIsVertical ? VERT_CURSOR : HORI_CURSOR; CursHandle h = GetCursor (cursID); diff --git a/mozilla/lib/mac/UserInterface/CSimpleTextView.cp b/mozilla/lib/mac/UserInterface/CSimpleTextView.cp index f7189850f1c..86fe61b326a 100644 --- a/mozilla/lib/mac/UserInterface/CSimpleTextView.cp +++ b/mozilla/lib/mac/UserInterface/CSimpleTextView.cp @@ -26,16 +26,14 @@ //#include //#include -//#include #include #include "CSpellChecker.h" - -#include "resgui.h" +#include "resgui.h" // for emSignature //#include "Textension.h" -#pragma global_optimizer off +//#pragma global_optimizer off //why??? Boolean CSimpleTextView::sInitialized = false; @@ -57,6 +55,7 @@ CSimpleTextView::CSimpleTextView() Assert_( false ); // Must use parameters + mTabIntoFieldSelectsAll = true; //default behaviour } @@ -69,6 +68,9 @@ CSimpleTextView::CSimpleTextView( LStream *inStream ) if ( !sInitialized ) Initialize(); + + mTabIntoFieldSelectsAll = true; //default behaviour + /* mTextParms = NULL; @@ -156,7 +158,7 @@ CSimpleTextView::FinishCreateSelf( void ) } */ - CWASTEEdit::FinishCreateSelf(); + Inherited::FinishCreateSelf(); } @@ -232,6 +234,7 @@ void CSimpleTextView::NoteOverNewThing(LManipulator *inThing) Boolean CSimpleTextView::ObeyCommand( CommandT inCommand, void *ioParam ) { + Boolean cmdHandled = true; switch (inCommand) { @@ -243,10 +246,22 @@ CSimpleTextView::ObeyCommand( CommandT inCommand, void *ioParam ) break; #endif // MOZ_SPELLCHK + // handle msg_TabSelect ourselves, because we don't want the CWASTEEdit + // select all behaviour + case msg_TabSelect: + if ( ! mTabIntoFieldSelectsAll ) + { + // do nothing + break; + } + // else + // fallthrough for default behaviour + default: - return CWASTEEdit::ObeyCommand(inCommand, ioParam); + cmdHandled = Inherited::ObeyCommand(inCommand, ioParam); } + return cmdHandled; } @@ -261,7 +276,7 @@ CSimpleTextView::ClickSelf( const SMouseDownEvent &inMouseDown ) if ( !IsTarget() ) SwitchTarget( this ); - CWASTEEdit::ClickSelf( inMouseDown ); + Inherited::ClickSelf( inMouseDown ); } @@ -282,7 +297,17 @@ CSimpleTextView::BeTarget() } - CWASTEEdit::BeTarget(); + //Inherited::BeTarget(); + // ugly copy and paste because I don't want to change CWASTEEdit + // but want to override its scroller activation behaviour + + if (FocusDraw()) { // Show active selection + WEActivate( GetWEHandle() ); + } + + StartIdling(); + + ProtectSelection(); } @@ -303,7 +328,14 @@ CSimpleTextView::DontBeTarget() } - CWASTEEdit::DontBeTarget(); + // Inherited::DontBeTarget(); + // ugly copy and paste because I don't want to change CWASTEEdit + // but want to override its scroller activation behaviour + + if (FocusDraw()) { // Show inactive selection + WEDeactivate( GetWEHandle() ); + } + StopIdling(); // Stop flashing the cursor } @@ -324,12 +356,31 @@ void CSimpleTextView::FindCommandStatus( CommandT inCommand, #endif // MOZ_SPELLCHK default: - CWASTEEdit::FindCommandStatus(inCommand, outEnabled, + Inherited::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); } } +Boolean CSimpleTextView::HandleKeyPress( const EventRecord & inKeyEvent) + { + Boolean commandKeyDown = (inKeyEvent.modifiers & cmdKey) != 0; + Int16 theKey = inKeyEvent.message & charCodeMask; + + if (commandKeyDown && ( theKey == char_Tab) ) + { + // strip out the command key modifier so the tab group handles it + const_cast(& inKeyEvent)->modifiers &= ~cmdKey; + + // send it up to the supercommander (the window) to handle + return LCommander::HandleKeyPress( inKeyEvent ); + + } + else + { + return Inherited::HandleKeyPress( inKeyEvent ); + } + } void CSimpleTextView::Save( const FSSpec &inFileSpec ) { @@ -359,11 +410,10 @@ void CSimpleTextView::Save( const FSSpec &inFileSpec ) } -pascal void -CSimpleTextView::TSMPreUpdate( WEReference inWE ) +pascal void CSimpleTextView::TSMPreUpdate( WEReference ) { -// AHHHH!!! Why didn't these wankers allow us to pass in a context +// AHHHH!!! Why didn't they allow us to pass in a context // pointer? Now I have to maintain this stupid sTargetView item. Assert_( sTargetView != NULL ); diff --git a/mozilla/lib/mac/UserInterface/CSimpleTextView.h b/mozilla/lib/mac/UserInterface/CSimpleTextView.h index 586833cc807..5ff2936b65c 100644 --- a/mozilla/lib/mac/UserInterface/CSimpleTextView.h +++ b/mozilla/lib/mac/UserInterface/CSimpleTextView.h @@ -72,6 +72,8 @@ class CSimpleTextView : public CWASTEEdit // friend class LTextEditHandler; // this will be going away! private: + typedef CWASTEEdit Inherited; + CSimpleTextView(); // Must use parameters @@ -109,9 +111,13 @@ class CSimpleTextView : public CWASTEEdit virtual void SetInitialTraits(ResIDT inTextTraitsID); virtual void SetInitialText(ResIDT inTextID); - virtual Boolean IsReadOnly(); + virtual Boolean IsReadOnly(); virtual void SetReadOnly( const Boolean inFlag ); + virtual void SetTabSelectsAll ( const Boolean inTabIntoFieldSelectsAll ) + { + mTabIntoFieldSelectsAll = inTabIntoFieldSelectsAll; + }; // Commands void Save( const FSSpec &inFileSpec ); @@ -119,6 +125,8 @@ class CSimpleTextView : public CWASTEEdit protected: virtual void ClickSelf( const SMouseDownEvent &inMouseDown); + virtual Boolean HandleKeyPress( const EventRecord & inKeyEvent); + virtual void BeTarget(); virtual void DontBeTarget(); @@ -132,6 +140,9 @@ class CSimpleTextView : public CWASTEEdit static WETSMPreUpdateUPP sPreUpdateUPP; static CSimpleTextView *sTargetView; + private: + + Boolean mTabIntoFieldSelectsAll; }; diff --git a/mozilla/lib/mac/UserInterface/CTabControl.cp b/mozilla/lib/mac/UserInterface/CTabControl.cp index a0be8da7311..19563353110 100644 --- a/mozilla/lib/mac/UserInterface/CTabControl.cp +++ b/mozilla/lib/mac/UserInterface/CTabControl.cp @@ -143,6 +143,30 @@ void CTabControl::DoLoadTabs(ResIDT inTabDescResID) SetValue(mValue); } +// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ +// ¥ +// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ + +void CTabControl::SetTabEnable(ResIDT inPageResID, Boolean inEnable) +{ + CTabInstance* theTab; + LArrayIterator theIter(mTabs, LArrayIterator::from_Start); + while (theIter.Next(&theTab)) + { + if (theTab->mMessage == inPageResID) + { + if (theTab->mEnabled != inEnable) + { + theTab->mEnabled = inEnable; + FocusDraw(); + DrawSelf(); // because it's not sufficient to DrawOneTab(theTab) + break; + } + } + } +} + + // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // ¥ // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ @@ -605,7 +629,7 @@ void CTabControl::DrawTopBevel(CTabInstance* inTab) // ¥ DrawBottomBevel // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -void CTabControl::DrawBottomBevel(CTabInstance* inTab, Boolean inCurrentTab) +void CTabControl::DrawBottomBevel(CTabInstance* inTab, Boolean /* inCurrentTab */) { const Rect& theTabFrame = inTab->mFrame; switch (mOrientation) @@ -725,6 +749,12 @@ Int16 CTabControl::FindHotSpot(Point inPoint) const if (theTab == mCurrentTab) continue; + if (! theTab->mEnabled) + { + ::SysBeep(1); + break; + } + if (::PtInRgn(inPoint, theTab->mMask)) { theHotSpot = mTabs.FetchIndexOf(&theTab); @@ -901,6 +931,7 @@ void CTabControl::DeactivateSelf(void) CTabInstance::CTabInstance() { mMask = NULL; + mEnabled = true; } CTextTabInstance::CTextTabInstance(const STabDescriptor& inDesc) @@ -933,6 +964,9 @@ void CTextTabInstance::DrawTitle(CTabInstance* inCurrentTab, ResIDT inTitleTrait ::OffsetRect(&theFrame, 0, 1); } + if (! mEnabled) + (**theTraitsHandle).mode |= grayishTextOr; + { StHandleLocker theLocker((Handle)theTraitsHandle); UTextTraits::SetPortTextTraits(*theTraitsHandle); @@ -967,6 +1001,9 @@ void CIconTabInstance::DrawTitle(CTabInstance* inCurrentTab, ResIDT /*inTitleTra { ::OffsetRect(&theFrame, 0, 1); } + if (! mEnabled) + transform |= kTransformDisabled; + ::PlotIconID(&theFrame, kAlignAbsoluteCenter, transform, mIconID); } diff --git a/mozilla/lib/mac/UserInterface/CTabControl.h b/mozilla/lib/mac/UserInterface/CTabControl.h index 57121e59e51..186c0872c20 100644 --- a/mozilla/lib/mac/UserInterface/CTabControl.h +++ b/mozilla/lib/mac/UserInterface/CTabControl.h @@ -67,7 +67,7 @@ class CTabControl : public LControl Boolean inRefresh); virtual void DoLoadTabs(ResIDT inTabDescResID); - + virtual void SetTabEnable(ResIDT inPageResID, Boolean inEnable); protected: @@ -151,6 +151,7 @@ class CTabInstance Rect mShadeFrame; Int16 mWidth; TString mTitle; + Boolean mEnabled; }; class CTextTabInstance: public CTabInstance diff --git a/mozilla/lib/mac/UserInterface/CTextColumn.cp b/mozilla/lib/mac/UserInterface/CTextColumn.cp new file mode 100644 index 00000000000..9635810dda6 --- /dev/null +++ b/mozilla/lib/mac/UserInterface/CTextColumn.cp @@ -0,0 +1,124 @@ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + + +// This class is a minimal override of PowerPlant's LTextColumn +// to allow instrumentation through QA-Partner. +// +// It should be used everywhere in place of LTextColumn. + +#if 0 //¥¥¥ don't activate QAP in Mozilla yet + +#ifdef PowerPlant_PCH +#include PowerPlant_PCH +#endif + +#include "CTextColumn.h" + + +// --------------------------------------------------------------------------- +// ¥ CTextColumn(LStream*) +// --------------------------------------------------------------------------- +// Construct from the data in a Stream + +CTextColumn::CTextColumn( + LStream* inStream) + + : super(inStream) + , CQAPartnerTableMixin(this) +{ +} + +// --------------------------------------------------------------------------- +// ¥ ~CTextColumn +// --------------------------------------------------------------------------- +// Destructor + +CTextColumn::~CTextColumn() +{ +} + + +#pragma mark - +#if defined(QAP_BUILD) + +//----------------------------------- +void CTextColumn::QapGetListInfo(PQAPLISTINFO pInfo) +//----------------------------------- +{ + TableIndexT outRows, outCols; + + if (pInfo == nil) + return; + + GetTableSize(outRows, outCols); + + // fetch vertical scrollbar Macintosh control + ControlHandle macVScroll = NULL; + LScroller *myScroller = dynamic_cast(GetSuperView()); + if (myScroller != NULL) + { + if (myScroller->GetVScrollbar() != NULL) + macVScroll = myScroller->GetVScrollbar()->GetMacControl(); + } + + pInfo->itemCount = (short)outRows; + pInfo->topIndex = 0; + pInfo->itemHeight = GetRowHeight(0); + pInfo->visibleCount = outRows; + pInfo->vScroll = macVScroll; + pInfo->isMultiSel = false; + pInfo->isExtendSel = false; + pInfo->hasText = true; +} + + +//----------------------------------- +Ptr CTextColumn::QapAddCellToBuf(Ptr pBuf, Ptr pLimit, const STableCell& sTblCell) +//----------------------------------- +{ + Str255 str; + Uint32 len = sizeof(str) - 1; + GetCellData(sTblCell, str, len); + + len = str[0]; + str[++ len] = '\0'; + + if (pBuf + sizeof(short) + len >= pLimit) + return NULL; + + *(unsigned short *)pBuf = sTblCell.row - 1; + if (CellIsSelected(sTblCell)) + *(unsigned short *)pBuf |= 0x8000; + + pBuf += sizeof(short); + +// strcpy(pBuf, &str[1]); // no stdlib here... +// pBuf += len; + + Byte* string = str; // ...let's copy it ourselves + do + { + *pBuf ++ = *(++ string); + } while (*string); + + return pBuf; +} + +#endif //QAP_BUILD + +#endif //0 //¥¥¥ don't activate QAP in Mozilla yet diff --git a/mozilla/lib/mac/UserInterface/CTextColumn.h b/mozilla/lib/mac/UserInterface/CTextColumn.h new file mode 100644 index 00000000000..14bbb08ff50 --- /dev/null +++ b/mozilla/lib/mac/UserInterface/CTextColumn.h @@ -0,0 +1,57 @@ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +// This class is a lightweight override of PowerPlant's LTextColumn +// to provide instrumentation through QA-Partner. +// +// It should be used everywhere in place of LTextColumn. + + +#ifndef CTextColumn_H +#define CTextColumn_H +#pragma once + +#include + +#if 0 //¥¥¥ don't activate QAP in Mozilla yet + +#include + +class CTextColumn : public LTextColumn, public CQAPartnerTableMixin +{ +private: + + typedef LTextColumn super; // This must be private. + +public: + enum { class_ID = 'TxCl' }; + + + CTextColumn(LStream* inStream); + virtual ~CTextColumn(); + +#if defined(QAP_BUILD) + virtual void QapGetListInfo (PQAPLISTINFO pInfo); + virtual Ptr QapAddCellToBuf(Ptr pBuf, Ptr pLimit, const STableCell& sTblCell); +#endif //QAP_BUILD +}; + +#else //0 +#define CTextColumn LTextColumn +#endif //0 //¥¥¥ don't activate QAP in Mozilla yet + +#endif //CTextColumn_H diff --git a/mozilla/lib/mac/UserInterface/CTextTable.h b/mozilla/lib/mac/UserInterface/CTextTable.h index bed9ed9c67e..315a378eb4e 100644 --- a/mozilla/lib/mac/UserInterface/CTextTable.h +++ b/mozilla/lib/mac/UserInterface/CTextTable.h @@ -24,15 +24,15 @@ #pragma import on #endif -#include +#include "CTextColumn.h" #include -class CTextTable : public LTextColumn, public LCommander +class CTextTable : public CTextColumn, public LCommander { public: enum { class_ID = 'Txtb' }; - typedef LTextColumn super; + typedef CTextColumn super; CTextTable( LStream* inStream); diff --git a/mozilla/lib/mac/UserInterface/CToolTipAttachment.cp b/mozilla/lib/mac/UserInterface/CToolTipAttachment.cp index 38d59bdd0b4..701b8b356b7 100644 --- a/mozilla/lib/mac/UserInterface/CToolTipAttachment.cp +++ b/mozilla/lib/mac/UserInterface/CToolTipAttachment.cp @@ -376,7 +376,16 @@ void CToolTipPane::ForceInPortFrame( theHOffset = theWindowPortFrame.left - ioTipFrame.left; // bump it to the right if (ioTipFrame.bottom > theWindowPortFrame.bottom) - theVOffset = theWindowPortFrame.bottom - ioTipFrame.bottom; // bump it up + { + Point mouseLocal; + GetMouse(&mouseLocal); + theVOffset = mouseLocal.v - 1 - ioTipFrame.bottom; // bump it up +// WAS: theVOffset = theWindowPortFrame.bottom - ioTipFrame.bottom; // bump it up +// The original version left the mouse within the tooltip frame. This +// led to the tooltip being deleted every null event, because CMouseDispatcher +// would calculate that the pane that the mouse was in was the tooltip pane +// itself. Solution: move the pane up above the mouse position. + } else if (ioTipFrame.top < theWindowPortFrame.top) theVOffset = theWindowPortFrame.top - ioTipFrame.top; // bump it down diff --git a/mozilla/lib/mac/UserInterface/CToolbarButton.cp b/mozilla/lib/mac/UserInterface/CToolbarButton.cp index c4acaa7a869..ecff61d37f9 100644 --- a/mozilla/lib/mac/UserInterface/CToolbarButton.cp +++ b/mozilla/lib/mac/UserInterface/CToolbarButton.cp @@ -17,6 +17,7 @@ */ #include "CToolbarButton.h" +#include "CToolbarModeManager.h" #include "UGraphicGizmos.h" // "Magic" constants @@ -26,7 +27,7 @@ const Int16 cTextOnlyHeight = 21; CToolbarButton::CToolbarButton(LStream* inStream) : CButton(inStream), - mCurrentMode(defaultMode), + mCurrentMode(CToolbarModeManager::defaultToolbarMode), mOriginalWidth(0), mOriginalHeight(0) { @@ -60,10 +61,10 @@ void CToolbarButton::DrawSelf() DrawButtonContent(); - if (mCurrentMode != eMode_IconsOnly && mTitle.Length() > 0) + if (mCurrentMode != eTOOLBAR_ICONS && mTitle.Length() > 0) DrawButtonTitle(); - if (mCurrentMode != eMode_TextOnly && GetGraphicID() != 0) + if (mCurrentMode != eTOOLBAR_TEXT && GetGraphicID() != 0) DrawButtonGraphic(); if (!IsEnabled() || !IsActive()) @@ -88,17 +89,17 @@ Boolean CToolbarButton::ChangeMode(Int8 inNewMode, SDimension16& outDimensionDel switch (inNewMode) { - case eMode_IconsOnly: + case eTOOLBAR_ICONS: outDimensionDeltas.width = cIconOnlyWidth - oldDimensions.width; outDimensionDeltas.height = cIconOnlyHeight - oldDimensions.height; break; - case eMode_TextOnly: + case eTOOLBAR_TEXT: outDimensionDeltas.width = mOriginalWidth - oldDimensions.width; outDimensionDeltas.height = cTextOnlyHeight - oldDimensions.height; break; - case eMode_IconsAndText: + case eTOOLBAR_TEXT_AND_ICONS: outDimensionDeltas.width = mOriginalWidth - oldDimensions.width; outDimensionDeltas.height = mOriginalHeight - oldDimensions.height; break; @@ -114,7 +115,7 @@ Boolean CToolbarButton::ChangeMode(Int8 inNewMode, SDimension16& outDimensionDel void CToolbarButton::DrawButtonTitle(void) { - if (mCurrentMode == eMode_TextOnly && (!IsActive() || !IsEnabled())) + if (mCurrentMode == eTOOLBAR_TEXT && (!IsActive() || !IsEnabled())) ::TextMode(grayishTextOr); // this is so light you cant see it. CButton::DrawButtonTitle(); @@ -148,7 +149,7 @@ void CToolbarButton::CalcTitleFrame(void) mCachedTitleFrame.right = mCachedTitleFrame.left + ::StringWidth(mTitle);; mCachedTitleFrame.bottom = mCachedTitleFrame.top + theInfo.ascent + theInfo.descent + theInfo.leading;; - if (mCurrentMode != eMode_TextOnly) + if (mCurrentMode != eTOOLBAR_TEXT) { UGraphicGizmos::AlignRectOnRect(mCachedTitleFrame, mCachedButtonFrame, mTitleAlignment); UGraphicGizmos::PadAlignedRect(mCachedTitleFrame, mTitlePadPixels, mTitleAlignment); diff --git a/mozilla/lib/mac/UserInterface/CToolbarButton.h b/mozilla/lib/mac/UserInterface/CToolbarButton.h index 897dbca333c..2aa9a53aac5 100644 --- a/mozilla/lib/mac/UserInterface/CToolbarButton.h +++ b/mozilla/lib/mac/UserInterface/CToolbarButton.h @@ -33,14 +33,9 @@ class CToolbarButton : public CButton { public: - enum { - eMode_IconsOnly = 0, - eMode_TextOnly, - eMode_IconsAndText - }; - - enum { defaultMode = eMode_IconsAndText }; + // button types enum is in CToolbarModeManager.h + enum { class_ID = 'TbBt' }; CToolbarButton(LStream* inStream); diff --git a/mozilla/lib/mac/UserInterface/LCustomizeMenu.cp b/mozilla/lib/mac/UserInterface/LCustomizeMenu.cp index 7f5088eefbb..b6bb5f54501 100644 --- a/mozilla/lib/mac/UserInterface/LCustomizeMenu.cp +++ b/mozilla/lib/mac/UserInterface/LCustomizeMenu.cp @@ -35,7 +35,7 @@ LCustomizeMenu::LCustomizeMenu() // // Size // -void LCustomizeMenu::Size(MenuHandle menu, MenuDefUPP* root, Rect *rect, Point hitPt, short *item) +void LCustomizeMenu::Size(MenuHandle menu, MenuDefUPP* /* root */, Rect * /* rect */, Point /* hitPt */, short * /* item */) { fItemCount = ::CountMItems(menu); int maxWidth = fTextMargin + 4; @@ -105,7 +105,7 @@ short LCustomizeMenu::MeasureItemCommand(short command) // // Draw // -void LCustomizeMenu::Draw(MenuHandle menu, MenuDefUPP* root, Rect *rect, Point hitPt, short *item) +void LCustomizeMenu::Draw(MenuHandle menu, MenuDefUPP* /* root */, Rect *rect, Point /* hitPt */, short * /* item */) { Assert_(fItemCount != 0); Assert_(fItemHeight != 0); @@ -130,7 +130,7 @@ void LCustomizeMenu::DrawItemSeperator(Rect& itemrect ) // DrawItemIcon // ¥¥ÊUnsupport Yet // -void LCustomizeMenu::DrawItemIcon(Rect& itemrect, short iconindex) +void LCustomizeMenu::DrawItemIcon(Rect& /* itemrect */, short /* iconindex */) { Assert_(FALSE); // We current do not support Icon @@ -138,7 +138,7 @@ void LCustomizeMenu::DrawItemIcon(Rect& itemrect, short iconindex) // // DrawItemCommand // -void LCustomizeMenu::DrawItemCommand(Rect& itemrect, short cmd) +void LCustomizeMenu::DrawItemCommand(Rect& /* itemrect */, short cmd) { ::DrawChar(17); ::DrawChar(cmd); @@ -147,7 +147,7 @@ void LCustomizeMenu::DrawItemCommand(Rect& itemrect, short cmd) // DrawItemSubmenuIndicator // ¥¥ÊUnsupport Yet // -void LCustomizeMenu::DrawItemSubmenuIndicator(Rect& itemrect) +void LCustomizeMenu::DrawItemSubmenuIndicator(Rect& /* itemrect */) { Assert_(FALSE); // We current do not support SubmenuIndicator @@ -230,14 +230,14 @@ void LCustomizeMenu::MoveToItemMarkPosition(Rect& itemrect) // // DrawItemText // -void LCustomizeMenu::DrawItemText(Rect& itemrect, Str255 itemtext ) +void LCustomizeMenu::DrawItemText(Rect& /* itemrect */, Str255 itemtext ) { ::DrawString(itemtext); } // // DrawItemMark // -void LCustomizeMenu::DrawItemMark(Rect& itemrect, short mark ) +void LCustomizeMenu::DrawItemMark(Rect& /* itemrect */, short mark ) { ::DrawChar(mark); } @@ -306,7 +306,7 @@ void LCustomizeMenu::DrawItem(MenuHandle menu, int item, Rect& itemrect ) // // Choose // -void LCustomizeMenu::Choose(MenuHandle menu, MenuDefUPP* root, Rect *rect, Point hitPt, short *item) +void LCustomizeMenu::Choose(MenuHandle menu, MenuDefUPP* /* root */, Rect *rect, Point hitPt, short *item) { int olditem = *item; *item = 0; diff --git a/mozilla/lib/mac/UserInterface/Tables/CStandardFlexTable.cp b/mozilla/lib/mac/UserInterface/Tables/CStandardFlexTable.cp index 89fc3b462f2..4ea306e7a59 100755 --- a/mozilla/lib/mac/UserInterface/Tables/CStandardFlexTable.cp +++ b/mozilla/lib/mac/UserInterface/Tables/CStandardFlexTable.cp @@ -55,6 +55,62 @@ #include "cstring.h" #include "CInlineEditField.h" +#include "CPasteSnooper.h" +#include "UDeferredTask.h" + +#pragma mark - + +//======================================================================================== +class CDeferredInlineEditTask +//======================================================================================== +: public CDeferredTask +{ + public: + CDeferredInlineEditTask( + CStandardFlexTable* inView, + const STableCell &inCell, + Rect & inTextRect); + protected: + virtual ExecuteResult ExecuteSelf(); +// data + protected: + CStandardFlexTable* mTable; + Rect mTextRect; + STableCell mCell; + UInt32 mEarliestExecuteTime; +}; // class CDeferredInlineEditTask + +//---------------------------------------------------------------------------------------- +CDeferredInlineEditTask::CDeferredInlineEditTask( + CStandardFlexTable* inView, + const STableCell &inCell, + Rect & inTextRect) +//---------------------------------------------------------------------------------------- +: mTable(inView) +, mCell(inCell) +, mTextRect(inTextRect) +, mEarliestExecuteTime(::TickCount() + GetDblTime()) +{ +} + +//---------------------------------------------------------------------------------------- +CDeferredTask::ExecuteResult CDeferredInlineEditTask::ExecuteSelf() +//---------------------------------------------------------------------------------------- +{ + // Current policy 98/04/07: start inline editing only if mouse stays over area and + // host view remains on duty past the double-click time. + mTable->FocusDraw(); + Point mouseLocal; + ::GetMouse(&mouseLocal); + if (!::PtInRect(mouseLocal, &mTextRect)) + return eDoneDelete; // if mouse left area, cancel inline editing without executing. + if (!mTable->IsOnDuty()) + return eDoneDelete; // if host view is deactivated, cancel inline editing. + if (::TickCount() < mEarliestExecuteTime) + return eWaitStayFront; // still waiting to see + mTable->DoInlineEditing(mCell, mTextRect); + return eDoneDelete; // remove from queue +} // CDeferredInlineEditTask::ExecuteSelf #pragma mark --- CTableHeaderListener @@ -70,29 +126,24 @@ void CTableHeaderListener::ListenToMessage(MessageT inMessage, void *ioParam) #pragma mark --- CTableHeaderListener - -// -// ListenToMessage -// +//---------------------------------------------------------------------------------------- +void CInlineEditorListener::ListenToMessage(MessageT inMessage, void * /*ioParam*/) // Respond to changes in the inline editor -// -void -CInlineEditorListener::ListenToMessage ( MessageT inMessage, void * /*ioParam*/ ) +//---------------------------------------------------------------------------------------- { - switch ( inMessage ) { - + switch ( inMessage ) + { case CInlineEditField::msg_InlineEditFieldChanged: mTable->InlineEditorTextChanged(); - break; - + break; case CInlineEditField::msg_HidingInlineEditField: mTable->InlineEditorDone(); mTable->mRowBeingEdited = LArray::index_Bad; + mTable->SetHiliteDisabled(false); break; - } // case of which message -} // ListenToMessage +} // CInlineEditorListener::ListenToMessage #pragma mark --- CClickTimer @@ -105,7 +156,12 @@ public: CStandardFlexTable* inTable, const STableCell& inCell, const SMouseDownEvent& inMouseDown); +protected: + // The destructor is protected because the right way to delete is is to call either + // NoteSingleClick() or NoteDoubleClick(); virtual ~CClickTimer(); + +public: void NoteDoubleClick(); void NoteSingleClick(); TableIndexT GetClickedRow() { return mCell.row; } @@ -119,6 +175,7 @@ protected: CStandardFlexTable* mTable; STableCell mCell; SMouseDownEvent mMouseDown; // Can't be a reference, orig. is on the stack & dies + Boolean mBusyDeleting; }; // class CClickTimer //---------------------------------------------------------------------------------------- @@ -130,6 +187,7 @@ CClickTimer::CClickTimer( : mTable(inTable) , mCell(inCell) , mMouseDown(inMouseDown) +, mBusyDeleting(false) { mTable->mClickTimer = this; ReverseTheHilite(); // fake a new selection (temporarily). @@ -164,14 +222,23 @@ void CClickTimer::NoteDoubleClick() void CClickTimer::NoteSingleClick() //---------------------------------------------------------------------------------------- { + // Avoid reentrancy when we call mTable->ClickSelect(). + if (mBusyDeleting) + return; + mBusyDeleting = true; try { - // ReverseTheHilite(); // Show the selection again +#if 0 + //ReverseTheHilite(); // Show the selection again // The hiliting is now correct. Turn off hiliting to avoid a double flash. mTable->SetHiliteDisabled(true); mTable->SetFancyDoubleClick(false); mTable->ClickSelect(mCell, mMouseDown); mTable->SetFancyDoubleClick(true); +#else + mTable->SetHiliteDisabled(true); + mTable->LTableView::ClickSelect(mCell, mMouseDown); +#endif } catch (...) { @@ -225,6 +292,7 @@ CStandardFlexTable::CStandardFlexTable(LStream *inStream) , mDropRow(LArray::index_Bad) , mIsInternalDrop(false) , mIsDropBetweenRows(false) +, mAllowDropAfterLastRow(true) , mNameEditor(NULL) , mRowBeingEdited(0) , mInlineListener(this) @@ -240,7 +308,8 @@ CStandardFlexTable::CStandardFlexTable(LStream *inStream) CStandardFlexTable::~CStandardFlexTable() //---------------------------------------------------------------------------------------- { - delete mClickTimer; + if (mClickTimer) + mClickTimer->NoteSingleClick(); } // CStandardFlexTable::~CStandardFlexTable //---------------------------------------------------------------------------------------- @@ -271,9 +340,11 @@ void CStandardFlexTable::FinishCreateSelf() // If an editor for in-place editing exists, find it. Don't worry if one can't be found. mNameEditor = dynamic_cast(FindPaneByID(paneID_InlineEdit)); - if ( mNameEditor ) { - mNameEditor->AddListener ( &mInlineListener ); + if (mNameEditor) + { + mNameEditor->AddListener(&mInlineListener); mNameEditor->SetGrowableBorder(true); + mNameEditor->AddAttachment(new CPasteSnooper(MAKE_RETURNS_SPACES)); } } // CStandardFlexTable::FinishCreateSelf @@ -379,11 +450,12 @@ void CStandardFlexTable::SetUpTableHelpers() { SetTableGeometry( new LFlexTableGeometry(this, mTableHeader) ); SetTableSelector( new LTableRowSelector(this)); - // NOTE: There is a dependency between LTableRowSelector and CThreadView - // because CThreadView::DoSelectThread() needs to select several rows at once. + // NOTE: There is a dependency between LTableRowSelector and + // CThreadView because CThreadView::DoSelectThread() needs to + // select several rows at once. // standard keyboard navigation. - AddAttachment( new CTableKeyAttachment(this) ); + AddAttachment( new CTableRowKeyAttachment(this) ); // We don't need table storage. It's safe to have a null one. // It is NOT safe, to call SetTableStorage(NULL), as its // implementation in LTableView does not check against NULL. @@ -428,7 +500,7 @@ void CStandardFlexTable::DrawSelf() } // CStandardFlexTable::DrawSelf //---------------------------------------------------------------------------------------- -TableIndexT CStandardFlexTable::CountExtraRowsControlledByCell(const STableCell& /*inCell*/) const +TableIndexT CStandardFlexTable::CountExtraRowsControlledByCell(const STableCell&) const //---------------------------------------------------------------------------------------- { return 0; @@ -501,8 +573,13 @@ Boolean CStandardFlexTable::GetHiliteTextRect( return false; cell.col = mCols; Rect cellRect; - if (!GetLocalCellRect(cell, cellRect)) - return false; + // Its inadequate to just use the mCols of the right most cell since if it is not visible + // GetLocalCellRect will return false + while (!GetLocalCellRect(cell, cellRect)) + { + cell.col--; + Assert_( cell.col > 0 ); + } outRect.right = cellRect.right; return true; } // CStandardFlexTable::GetHiliteTextRect @@ -515,6 +592,8 @@ Boolean CStandardFlexTable::GetIconRect( //---------------------------------------------------------------------------------------- { GetDropFlagRect(inLocalRect, outRect); + if (outRect.right > outRect.left) // have a drop flag + outRect.right -= kDropIconWastedSpace; outRect.left = outRect.right + kIconMargin + kIndentPerLevel * GetNestedLevel(inCell.row); outRect.right = outRect.left + kIconWidth; @@ -557,24 +636,24 @@ void CStandardFlexTable::HiliteRow( } // CStandardFlexTable::HiliteRow //---------------------------------------------------------------------------------------- -void CStandardFlexTable :: DoHiliteRgn( RgnHandle inHiliteRgn ) const +void CStandardFlexTable::DoHiliteRgn( RgnHandle inHiliteRgn ) const // Hilite the given area using the system hilite color. Override this to do // something different (like not use the hilite color). //---------------------------------------------------------------------------------------- { UDrawingUtils::SetHiliteModeOn(); // Don't use hilite color, except for inline editing. ::InvertRgn(inHiliteRgn); -} // CStandardFlexTable :: DoHiliteRgn +} // CStandardFlexTable: DoHiliteRgn //---------------------------------------------------------------------------------------- -void CStandardFlexTable :: DoHiliteRect( const Rect & inHiliteRect ) const +void CStandardFlexTable::DoHiliteRect( const Rect & inHiliteRect ) const // Hilite the given area using the system hilite color. Override this to do // something different (like not use the hilite color). //---------------------------------------------------------------------------------------- { UDrawingUtils::SetHiliteModeOn(); // Don't use hilite color, except for inline editing. ::InvertRect(&inHiliteRect); -} // CStandardFlexTable :: DoHiliteRect +} // CStandardFlexTable::DoHiliteRect //---------------------------------------------------------------------------------------- void CStandardFlexTable::Click(SMouseDownEvent &inMouseDown) @@ -598,7 +677,7 @@ void CStandardFlexTable::Click(SMouseDownEvent &inMouseDown) Boolean CStandardFlexTable::ClickDropFlag( const STableCell &inCell, const SMouseDownEvent &inMouseDown) -// Handle drop-flag ("twistee icon") clicks. Return true if handled. +// Handle drop-flag ("twistie icon") clicks. Return true if handled. //---------------------------------------------------------------------------------------- { Boolean isCellExpanded; @@ -607,51 +686,33 @@ Boolean CStandardFlexTable::ClickDropFlag( Rect cellRect, flagRect; GetLocalCellRect(inCell, cellRect); GetDropFlagRect(cellRect, flagRect); - if (::PtInRect(inMouseDown.whereLocal, &flagRect)) + if (::PtInRect(inMouseDown.whereLocal, &flagRect) && FocusDraw()) { - ApplyForeAndBackColors(); - if (FocusDraw() && LDropFlag::TrackClick(flagRect, inMouseDown.whereLocal, isCellExpanded)) + Rect clipRect = flagRect; + clipRect.right -= kDropIconWastedSpace; + StClipRgnState clip(clipRect); + if (LDropFlag::TrackClick(flagRect, inMouseDown.whereLocal, isCellExpanded)) SetCellExpansion(inCell, !isCellExpanded); return true; } } return false; -} +} // CStandardFlexTable::ClickDropFlag //---------------------------------------------------------------------------------------- -Boolean CStandardFlexTable::ClickSelect( +Boolean CStandardFlexTable::HandleFancyDoubleClick( const STableCell &inCell, const SMouseDownEvent &inMouseDown) +// Fancy double-click behavior. There are two reasons for this new feature of 4.5: +// ¥ Double-clicking a thread in a message thread view (for example) should +// not select the new item, because then the selected message would load in +// the message pane of the thread window as well as in the newly-opened message +// window. The user would prefer to maintain the message displayed in the current +// window, and open the double-clicked, different message in the separate window. +// ¥ Selecting a new row can be expensive, because it causes the message/folder +// to load. This loading usually unwanted after a double-click. //---------------------------------------------------------------------------------------- { - Rect cellRect; - GetLocalCellRect(inCell, cellRect); - - FocusDraw(); //to be on the safe side - - // compute the text and icon rectangles and if the click is in them - Rect textRect, iconRect; - GetHiliteTextRect ( inCell.row, textRect ); - GetIconRect ( inCell, cellRect, iconRect ); - bool clickIsInIcon = ::PtInRect(inMouseDown.whereLocal, &iconRect); - bool clickIsInTitle = ::PtInRect(inMouseDown.whereLocal, &textRect); - - // If the click is outside of the icon/title, or if it is in the title (and in-place editing is on), - // then temporarily turn off the fancy double-click stuff since we don't want it to happen. - bool savedFancyDoubleClick = mFancyDoubleClick; - if ( !clickIsInIcon && !clickIsInTitle ) - mFancyDoubleClick = false; // click was outside icon&title - if ( clickIsInTitle && mNameEditor ) - mFancyDoubleClick = false; // click was in title and we're doing inplace editing - - // Fancy double-click behavior. There are two reasons for this new feature of 5.0: - // ¥ Double-clicking a thread in a message thread view (for example) should - // not select the new item, because then the selected message would load in - // the message pane of the thread window as well as in the newly-opened message - // window. The user would prefer to maintain the message displayed in the current - // window, and open the double-clicked, different message in the separate window. - // ¥ Selecting a new row can be expensive, because it causes the message/folder - // to load. This loading usually unwanted after a double-click. if (mFancyDoubleClick && !CellIsSelected(inCell) && (inMouseDown.macEvent.modifiers & shiftKey) == 0 @@ -674,8 +735,45 @@ Boolean CStandardFlexTable::ClickSelect( mClickTimer->NoteDoubleClick(); OpenRow(inCell.row); } - return false; + return true; } + return false; +} // CStandardFlexTable::HandleFancyDoubleClick + +//---------------------------------------------------------------------------------------- +Boolean CStandardFlexTable::ClickSelect( + const STableCell &inCell, + const SMouseDownEvent &inMouseDown) +//---------------------------------------------------------------------------------------- +{ + Rect cellRect; + GetLocalCellRect(inCell, cellRect); + + FocusDraw(); // To be on the safe side + + // Compute the text and icon rectangles and if the click is in them + Rect textRect, iconRect; + GetHiliteTextRect(inCell.row, textRect); + GetIconRect(inCell, cellRect, iconRect); + Boolean clickIsInIcon = ::PtInRect(inMouseDown.whereLocal, &iconRect); + Boolean clickIsInTitle = ::PtInRect(inMouseDown.whereLocal, &textRect); + + // If the click is outside of the icon/title, or if it is in the title + // (and in-place editing is on), then temporarily turn off the fancy double-click + // stuff since we don't want it to happen. Use a StValueChanger stack object, + // which will restore the state even on an exception or return statement. + StValueChanger changer(mFancyDoubleClick, mFancyDoubleClick); + if (!clickIsInIcon && !clickIsInTitle) + mFancyDoubleClick = false; // click was outside icon&title + if (clickIsInTitle && mNameEditor) + mFancyDoubleClick = false; // click was in title and we're doing inplace editing + +#define CHECK_DRAGS_BEFORE_DOUBLECLICK 1 +#if !CHECK_DRAGS_BEFORE_DOUBLECLICK + // The way it was before 98/04/03 + if (HandleFancyDoubleClick(inCell, inMouseDown)) + return false; +#endif // 0, 1, >=2 rows selected are the values that change command-enabling configurations. int selectedRowCountForCommandStatus = GetSelectedRowCount(); @@ -683,13 +781,132 @@ Boolean CStandardFlexTable::ClickSelect( selectedRowCountForCommandStatus = 2; Boolean result = false; - // - // There are two cases here: user clicks in the hilite column and they don't click in the - // hilite column. If they do, only select if the click is in the icon or the icon text. Any - // other click w/in that column unselects or start a marquee selection. If they click outside - // the hilite column, process as normal. - // - if ( (inCell.col != GetHiliteColumn()) || clickIsInIcon || clickIsInTitle ) { + // There are two cases here: user clicks in the hilite column and they don't click in + // the hilite column. If they do, only select if the click is in the icon or the icon + // text. Any other click w/in that column unselects or start a marquee selection. If + // they click outside the hilite column, process as normal. + + if (inCell.col != GetHiliteColumn() || clickIsInIcon || clickIsInTitle) + { +#if CHECK_DRAGS_BEFORE_DOUBLECLICK + // Experimental, new way 98/04/03. The restraints are: + // ¥ Drags should be checked first. + // ¥ In the spirit of fancy double click, drags of unselected items + // should be allowed if fancyDoubleClick is in force. + // ¥ Fancy double-click must be checked before calling LTableView::ClickSelect + // (because the FDC detector calls it eventually as appropriate). + // ¥ Selection must occur before context menus are informed of the click. + // This is because context menus perform commands on the current selection. + // Therefore, + // DRAG before DOUBLE-CLICK DETECTION before SELECTION before CONTEXT MENUS. + + // Preflight to determine drag/click/contextmenu. + CContextMenuAttachment::EClickState mouseResult + = CContextMenuAttachment::WaitMouseAction( + inMouseDown.whereLocal, + inMouseDown.macEvent.when); + + if (! CellInitiatesDrag(inCell) && mouseResult == CContextMenuAttachment::eMouseDragging) + mouseResult = CContextMenuAttachment::eMouseTimeout; + switch (mouseResult) + { + case CContextMenuAttachment::eMouseDragging: + // We are dragging, and may be dragging a non-selected item, which is + // permissible now. + // First cancel any previous double-click in progress. This will select + // the cell previously clicked, by the way. + if (mClickTimer) + mClickTimer->NoteSingleClick(); + if (!mFancyDoubleClick) + { + // Normal case + LTableView::ClickSelect(inCell, inMouseDown); + DragSelection(inCell, inMouseDown); + result = true; + } + else if (CellIsSelected(inCell)) + { + DragSelection(inCell, inMouseDown); + // cell and the other selected cells + result = false; + } + else if (userCanceledErr == DragRow(inCell.row, inMouseDown)) + { + // We tried to drag the unselected row. + // userCanceledErr means the drag did not really occur. Select the + // item in this case. + LTableView::ClickSelect(inCell, inMouseDown); + result = true; + } + goto cmd_status; // because we changed the selection. + + case CContextMenuAttachment::eMouseTimeout: + // We are showing the context menu + // First cancel any previous double-click in progress. This will select + // the cell previously clicked, by the way. + if (mClickTimer) + mClickTimer->NoteSingleClick(); + + CContextMenuAttachment::SExecuteParams params; + params.inMouseDown = &inMouseDown; + + // First call ClickSelect to select the cell before showing the menu + LTableView::ClickSelect(inCell, inMouseDown); + + // If the preflight test is a sane strategy, then the call we will now + // make should always show the popup menu. However, the user may + // examine the popup menu and track out. The call should then return + // true, and we should handle it like a click by falling through: + if (!ExecuteAttachments( + CContextMenuAttachment::msg_ContextMenu, + (void*)¶ms)) + { + break; + } + // else fall through and handle the click + + case CContextMenuAttachment::eMouseUpEarly: + + // CLICK! + if (HandleFancyDoubleClick(inCell, inMouseDown)) + return false; + if (!LTableView::ClickSelect(inCell, inMouseDown)) + return false; + // become target + if (!IsTarget()) + SwitchTarget(this); + + // Check if the click is in the title of the icon. If so, and an editor is + // present and we're not doing a shift-selection extension and it's not a + // double click then invoke the inline editor. Otherwise process the click + // normally. (whew!) + // + // The reason for not inline editing on a double-click is that it allows the + // user to double-click anywhere on the item to open it, like in the Finder. + // Doing a double-click to edit an item doesn't make sense and the user + // would get confused. + // ¥¥¥Double click check doesn't work right now.....will fix later....¥¥¥ + // open selection if we've got the right click count + if (clickIsInTitle + && mNameEditor + && !(inMouseDown.macEvent.modifiers & shiftKey) + && GetClickCount() != 2) + CDeferredTaskManager::Post1( + new CDeferredInlineEditTask(this, inCell, textRect), + this); + if (GetClickCount() == mClickCountToOpen) + { + // Cancel inline editing. Probably redundant. + if (mNameEditor) + mNameEditor->UpdateEdit(nil, nil, nil); + OpenSelection(); + } + result = true; + + break; + } // switch + +#else if (LTableView::ClickSelect(inCell, inMouseDown)) { // Handle it ourselves if the popup attachment doesn't want it. @@ -706,19 +923,23 @@ Boolean CStandardFlexTable::ClickSelect( if (!IsTarget()) SwitchTarget(this); - // check if the click is in the title of the icon. If so, and an editor is + // Check if the click is in the title of the icon. If so, and an editor is // present and we're not doing a shift-selection extension and it's not a - // double click then invoke the inline editor. Otherwise process the click normally. - // (whew!) + // double click then invoke the inline editor. Otherwise process the click + // normally. (whew!) // // The reason for not inline editing on a double-click is that it allows the - // user to double-click anywhere on the item to open it, like in the Finder. Doing - // a double-click to edit an item doesn't make sense and the user would get - // confused. ¥¥¥Double click check doesn't work right now.....will fix later....¥¥¥ - if ( clickIsInTitle && mNameEditor && !(inMouseDown.macEvent.modifiers & shiftKey) - && GetClickCount() != 2 ) - DoInlineEditing ( inCell, textRect ); - else { + // user to double-click anywhere on the item to open it, like in the Finder. + // Doing a double-click to edit an item doesn't make sense and the user + // would get confused. + // ¥¥¥Double click check doesn't work right now.....will fix later....¥¥¥ + if (clickIsInTitle + && mNameEditor + && !(inMouseDown.macEvent.modifiers & shiftKey) + && GetClickCount() != 2) + DoInlineEditing(inCell, textRect); + else + { // open selection if we've got the right click count if (GetClickCount() == mClickCountToOpen) OpenSelection(); @@ -727,14 +948,16 @@ Boolean CStandardFlexTable::ClickSelect( result = true; } } +#endif // CHECK_DRAGS_BEFORE_DOUBLECLICK } // if click in icon or text - else { + else + { // since the click is not in the icon and not in the text, the selection should be - // cleared before we try to show any context menus. This is possibly faster than - // calling UnselectAllCells() because it only iterates over the selection, not the whole table. - static const Rect empty = { 0, 0, 0, 0 }; - UnselectCellsNotInSelectionOutline(empty); + // cleared before we try to show any context menus. + UnselectAllCells(); + if (mClickTimer) + mClickTimer->NoteSingleClick(); CContextMenuAttachment::SExecuteParams params; params.inMouseDown = &inMouseDown; if (ExecuteAttachments(CContextMenuAttachment::msg_ContextMenu, (void*)¶ms)) @@ -742,7 +965,6 @@ Boolean CStandardFlexTable::ClickSelect( } cmd_status: - mFancyDoubleClick = savedFancyDoubleClick; int newSelectedRowCountForCommandStatus = GetSelectedRowCount(); if (newSelectedRowCountForCommandStatus > 2) newSelectedRowCountForCommandStatus = 2; @@ -767,10 +989,10 @@ void CStandardFlexTable::ClickSelf(const SMouseDownEvent &inMouseDown) if (ClickDropFlag(hitCell, inMouseDown)) return; - // See if the cell selects. If so go ahead and process it (could be a drag or selection - // outline). If the cell does not select, the cell may still really want the click (like - // the "marked read message" column in mail/news. If it does, give it the click, otherwise - // start doing a marquee selection. + // See if the cell selects. If so go ahead and process it (could be a drag or + // selection outline). If the cell does not select, the cell may still really want + // the click (like the "marked read message" column in mail/news. If it does, give + // it the click, otherwise start doing a marquee selection. if ( CellSelects(hitCell) ) { if ( ClickSelect(hitCell, inMouseDown) ) ClickCell(hitCell, inMouseDown); @@ -782,63 +1004,61 @@ void CStandardFlexTable::ClickSelf(const SMouseDownEvent &inMouseDown) HandleSelectionTracking(inMouseDown); } } - else { - // since the click is not in any cell, the selection should be cleared before we try to - // show the context menus. This is possibly faster than calling UnselectAllCells() because - // it only iterates over the selection, not the whole table. - static const Rect empty = { 0, 0, 0, 0 }; - UnselectCellsNotInSelectionOutline(empty); + else + { + // since the click is not in any cell, the selection should be cleared before + // we try to show the context menus. + UnselectAllCells(); CContextMenuAttachment::SExecuteParams params; params.inMouseDown = &inMouseDown; if ( ExecuteAttachments(CContextMenuAttachment::msg_ContextMenu, (void*)¶ms) ) HandleSelectionTracking(inMouseDown); - } - + } } // CStandardFlexTable::ClickSelf - -// -// DoInlineEditing -// +//---------------------------------------------------------------------------------------- +void CStandardFlexTable::DoInlineEditing( const STableCell &inCell ) // Perform the necessary setup for inline editing of a row's main text and then show the edit field. // This version of the routine is public and does not require any external knowledge of table internals // besides the cell that we should edit. Most of the work is done by calling the routine below -// -void -CStandardFlexTable::DoInlineEditing ( const STableCell &inCell ) +//---------------------------------------------------------------------------------------- { Rect textRect; - GetHiliteTextRect ( inCell.row, textRect ); - DoInlineEditing ( inCell, textRect ); - + GetHiliteTextRect( inCell.row, textRect ); + DoInlineEditing( inCell, textRect ); } // DoInlineEditing -// -// DoInlineEditing -// -// Perform the necessary setup for inline editing of a row's main text and then show the edit field -// -void -CStandardFlexTable::DoInlineEditing ( const STableCell &inCell, Rect & inTextRect ) +//---------------------------------------------------------------------------------------- +void CStandardFlexTable::DoInlineEditing(const STableCell &inCell, Rect& inTextRect) +// Perform the necessary setup for inline editing of a row's main text and then show +// the edit field +//---------------------------------------------------------------------------------------- { - mRowBeingEdited = inCell.row; - if ( !CanDoInlineEditing() ) { // bail if inline editing is temporarily turned off + mRowBeingEdited = inCell.row; // do this first so derived classes can check it. + if (!CanDoInlineEditing()) // bail if inline editing is temporarily turned off + { mRowBeingEdited = LArray::index_Bad; return; } -#if 0 - // erase the text rectangle so that when the text field shrinks, you won't see the old name - // behind it. This is kinda skanky, but we need to make sure we draw the background color - // correctly. - //¥¥¥This doesn't work. + // Erase the text rectangle so that when the text field shrinks, you won't see the + // old name behind it. This is kinda skanky, but we need to make sure we draw the + // background color correctly. + // I also believe it is unnecessary, because it didn't solve the problem of the cell + // being redrawn on a refresh, so and so that had to be done anyway. A better way + // is to invalidate the rectangle, and make the table smart about not drawing the + // text when editing is going on. - jrm 98/04/02 + #if 1 + ::InvalRect(&inTextRect); // table, which is inline-edit aware, will erase the text. + SetHiliteDisabled(true); // Don't draw hilite rects, either. + #else RGBColor backColor; - ::GetCPixel ( inTextRect.right - 1, inTextRect.top - 1, &backColor ); + ::GetCPixel(inTextRect.right - 1, inTextRect.top, &backColor); ::RGBBackColor(&backColor); - ::EraseRect ( &inTextRect ); -#endif + ::EraseRect(&inTextRect); + #endif SPoint32 imagePoint; LocalToImagePoint(topLeft(inTextRect), imagePoint); @@ -851,16 +1071,19 @@ CStandardFlexTable::DoInlineEditing ( const STableCell &inCell, Rect & inTextRec SelectCell(STableCell(mRowBeingEdited, GetHiliteColumn())); SetNotifyOnSelectionChange(true); - char nameString[256]; - GetHiliteText(mRowBeingEdited, nameString, 255, &inTextRect); - - mNameEditor->UpdateEdit(LStr255(nameString), &imagePoint, nil); + // Need 512 bytes for the text result, because of the &*(&^% way GetHiliteText + // works now. + char nameString[512]; + GetHiliteText(mRowBeingEdited, nameString, sizeof(nameString), &inTextRect); + InsetRect(&inTextRect, -2, -2); + inTextRect.bottom += 2; + mNameEditor->ResizeFrameTo(inTextRect.right - inTextRect.left, + inTextRect.bottom - inTextRect.top, true); + mNameEditor->UpdateEdit(CStr255(nameString), &imagePoint, nil); SelectionChanged(); - } // DoInlineEditing - //---------------------------------------------------------------------------------------- Boolean CStandardFlexTable::CellSelects(const STableCell& /*inCell*/) const // Determines if a cell is allowed to select the row. @@ -869,18 +1092,20 @@ Boolean CStandardFlexTable::CellSelects(const STableCell& /*inCell*/) const return true; } // CStandardFlexTable::CellSelects - //---------------------------------------------------------------------------------------- void CStandardFlexTable::HandleSelectionTracking ( const SMouseDownEvent & inMouseDown ) // Set up everything to start tracking a selection marquee //---------------------------------------------------------------------------------------- { + if (mClickTimer) + mClickTimer->NoteSingleClick(); + // bail if the table specifically doesn't want the tracking. if ( !TableDesiresSelectionTracking() ) return; // Click is outside of any Cell. Unselect everything if the shift key is up. - if ( !(inMouseDown.macEvent.modifiers & shiftKey) ) + if ( !(inMouseDown.macEvent.modifiers & shiftKey) && !(inMouseDown.macEvent.modifiers & cmdKey)) UnselectAllCells(); // track the mouse for doing drag selection @@ -897,34 +1122,44 @@ void CStandardFlexTable::TrackSelection( const SMouseDownEvent & inMouseDown ) { Point originalLoc = inMouseDown.whereLocal; - Rect selectionRect = { 0, 0, 0, 0 }, iconHotSpotRect = { 0, 0, 0, 0 }; - Rect cellHotSpotRect = { 0, 0, 0, 0 }; + Rect selectionRect = { 0, 0, 0, 0 }; + Rect cellHotSpotRect = { 0, 0, 0, 0 }, iconHotSpotRect = { 0, 0, 0, 0 }; + + Boolean shiftKeyDown = (inMouseDown.macEvent.modifiers & shiftKey) != 0; + Boolean cmdKeyDown = (inMouseDown.macEvent.modifiers & cmdKey) != 0; Point lastMousePoint = { 0, 0 }, curMousePoint = { 0, 0 }, curOrigin = { 0, 0 }; - UInt32 currentRow = 0L, currentCol = 0L, maxRows = 0L, maxColumns = 0L; + TableIndexT currentRow = 0L, currentCol = 0L, maxRows = 0L, maxColumns = 0L; - STableCell topLeftCell( 0, 0 ); - STableCell botRightCell( 0, 0 ); - STableCell currentCell( 0, 0 ); + // may get a null selector for some tables not using the table row selector + LTableRowSelector *theSelector = dynamic_cast(GetTableSelector()); + StRegion previousSelection; - StColorPenState oldPenState; + if (theSelector != nil) + theSelector->MakeSelectionRegion(previousSelection, GetHiliteColumn()); //LTableRowSelector inherits from LArray, so can call copy constructor + + StColorPenState oldPenState; + + GetTableSize( maxRows, maxColumns ); + + STableCell topLeftCell( 0, 0 ); + STableCell botRightCell( 0, 0 ); + STableCell oldTopLeftCell( maxRows, 0 ); // initial values important for optimization below + STableCell oldBotRightCell( 1, 0 ); + + FocusDraw(); - // mTableView->GetTableSize( maxRows, maxColumns ); - SetNotifyOnSelectionChange(false); - while ( ::StillDown() ) { - + while ( ::StillDown() ) + { ::GetMouse( &curMousePoint ); - if ( (curMousePoint.v != lastMousePoint.v) || (curMousePoint.h != lastMousePoint.h) ) { - - currentCell.row = 0; - currentCell.col = 0; - + if (curMousePoint.v != lastMousePoint.v || curMousePoint.h != lastMousePoint.h) + { ::PenPat( &qd.gray ); ::PenMode( patXor ); - ::PenSize( 2, 2 ); + ::PenSize( 1, 1 ); if ( !::EmptyRect(&selectionRect) ) ::FrameRect( &selectionRect ); @@ -950,29 +1185,120 @@ void CStandardFlexTable::TrackSelection( const SMouseDownEvent & inMouseDown ) if ( AutoScrollImage(curMousePoint) ) FocusDraw(); - UnselectCellsNotInSelectionOutline(selectionRect); + FetchIntersectingCells( selectionRect, topLeftCell, botRightCell ); + + STableCell theCell(0, GetHiliteColumn()); + + //Do this inline now, because we need to get a some more local variables + //UnselectCellsNotInSelectionOutline(selectionRect); + + if (!shiftKeyDown && !cmdKeyDown) + { + // Deselect cells not in selection rect + while ( GetNextSelectedRow(theCell.row) ) + { + if ( !HitCellHotSpot( theCell, selectionRect) ) + UnselectCell( theCell ); + } + } else if (shiftKeyDown) + { + // Only deselect cells that have left the current selection marquee, + // i.e. those that are neither in the marquee, nor the previous selection + while ( GetNextSelectedRow(theCell.row) ) + { + Point thePt; + theCell.ToPoint(thePt); + if ( !HitCellHotSpot( theCell, selectionRect) && !::PtInRgn(thePt, previousSelection)) { + UnselectCell( theCell ); + } + } + + } else if (cmdKeyDown) + { + // Put the selection back to its previous state for cells that are no longer + // covered by the marquee + + // optimization to reduce the amount of looping here + TableIndexT extentTop = MIN(topLeftCell.row, oldTopLeftCell.row); + TableIndexT extentBottom = MAX(botRightCell.row, oldBotRightCell.row); + + if (extentBottom > mRows) + extentBottom = mRows; + + theCell.row = extentTop; + + while ( theCell.row <= extentBottom) + { + if ( !HitCellHotSpot( theCell, selectionRect) ) + { + Point thePt; + theCell.ToPoint(thePt); + Boolean alreadySelected = CellIsSelected( theCell ); + if (::PtInRgn(thePt, previousSelection)) { + if ( !alreadySelected) SelectCell( theCell ); + } else { + if ( alreadySelected ) UnselectCell( theCell ); + } + } + theCell.row ++; + } + } + // find what cells are in w/in the rectangle and select them if the rectangle // encloses/touches the cell hot spot (usually the icon or icon text). - FetchIntersectingCells( selectionRect, topLeftCell, botRightCell ); - for ( currentRow = topLeftCell.row; currentRow <= botRightCell.row; currentRow++ ) { - for ( currentCol = topLeftCell.col; currentCol <= botRightCell.col; currentCol++ ) { - + + for ( currentRow = topLeftCell.row; currentRow <= botRightCell.row; currentRow++ ) + { + STableCell currentCell( currentRow, GetHiliteColumn() ); + + // We are assuming now that all descendents from CStandardFlex table + // have row-based selection. Since this assumption is also made elsewhere + // (e.g. in xxxxx) we should be safe. The class hierarchy should make it + // explicit though. + /* + for ( currentCol = topLeftCell.col; currentCol <= botRightCell.col; currentCol++ ) + { currentCell.row = currentRow; currentCell.col = currentCol; - - if ( !CellIsSelected(currentCell) && HitCellHotSpot(currentCell, selectionRect) ) { + if (!CellIsSelected(currentCell) && HitCellHotSpot(currentCell, selectionRect)) SelectCell( currentCell ); + } // for each column + */ + + if (cmdKeyDown) + { + // When the marquee hits a cell, toggle the select for that cell + + if ( HitCellHotSpot(currentCell, selectionRect) ) + { + Point thePt; + currentCell.ToPoint(thePt); + + if ( ::PtInRgn(thePt, previousSelection) ) + UnselectCell( currentCell ); + else + SelectCell( currentCell ); } - } // for each column + } else + { + if (!CellIsSelected(currentCell) && HitCellHotSpot(currentCell, selectionRect)) + SelectCell( currentCell ); + } + } // for each row + FocusDraw(); + + oldTopLeftCell = topLeftCell; + oldBotRightCell = botRightCell; + oldPenState.Save(); ::PenPat( &qd.gray ); ::PenMode( patXor ); - ::PenSize( 2, 2 ); + ::PenSize( 1, 1 ); ::FrameRect( &selectionRect ); } // if mouse has moved @@ -983,8 +1309,17 @@ void CStandardFlexTable::TrackSelection( const SMouseDownEvent & inMouseDown ) SelectionChanged(); if ( !::EmptyRect(&selectionRect) ) + { + FocusDraw(); // who knows what went on inside "SelectionChanged()"? + + ::PenPat( &qd.gray ); + ::PenMode( patXor ); + ::PenSize( 1, 1 ); ::FrameRect( &selectionRect ); + oldPenState.Normalize(); + } + } // TrackSelection //---------------------------------------------------------------------------------------- @@ -1012,6 +1347,24 @@ void CStandardFlexTable::UnselectCellsNotInSelectionOutline( const Rect & inSele } // UnselectCellsNotInSelectionOutline +//---------------------------------------------------------------------------------------- +void CStandardFlexTable::GetLocalCellRectAnywhere( const STableCell &inCell, Rect &outCellRect) const +// Unlike GetLocalCellRect(), this returns a valid rectangle whether or not this cell +// is in view +//---------------------------------------------------------------------------------------- +{ + Int32 cellLeft, cellTop, cellRight, cellBottom; + mTableGeometry->GetImageCellBounds(inCell, cellLeft, cellTop, cellRight, cellBottom); + + SPoint32 imagePt; + imagePt.h = cellLeft; + imagePt.v = cellTop; + ImageToLocalPoint(imagePt, topLeft(outCellRect)); + outCellRect.right = outCellRect.left + (cellRight - cellLeft); + outCellRect.bottom = outCellRect.top + (cellBottom - cellTop); + +} + //---------------------------------------------------------------------------------------- Boolean CStandardFlexTable::HitCellHotSpot( const STableCell &inCell, const Rect &inTotalSelectionRect ) @@ -1020,25 +1373,33 @@ Boolean CStandardFlexTable::HitCellHotSpot( const STableCell &inCell, const Rect Boolean result = false; TableIndexT hiliteCol = GetHiliteColumn(); - FocusDraw(); //to be on the safe side + //FocusDraw(); //to be on the safe side, but it's too slow - if ( hiliteCol ) { + if ( hiliteCol ) + { if ( hiliteCol == inCell.col ) { Rect cellRect; - GetLocalCellRect(inCell, cellRect); + GetLocalCellRectAnywhere(inCell, cellRect); + Rect textRect, iconRect; - GetHiliteTextRect ( inCell.row, textRect ); - GetIconRect ( inCell, cellRect, iconRect ); + GetHiliteTextRect( inCell.row, textRect ); + GetIconRect( inCell, cellRect, iconRect ); if ( ::SectRect(&textRect, &inTotalSelectionRect, &textRect) || ::SectRect(&iconRect, &inTotalSelectionRect, &iconRect) ) result = true; } } - else { - Rect cellRect = { 0, 0, 0, 0 }; - GetLocalCellRect( inCell, cellRect ); - result = ::SectRect( &cellRect, &inTotalSelectionRect, &cellRect ); + else // check for any overlap with the row + { + Rect leftCellRect = { 0, 0, 0, 0 }, rightCellRect = { 0, 0, 0, 0 }; + + STableCell leftCell(inCell.row, 1); + STableCell rightCell(inCell.row, mCols); + GetLocalCellRectAnywhere( leftCell, leftCellRect ); + GetLocalCellRectAnywhere( rightCell, rightCellRect ); + leftCellRect.right = rightCellRect.right; + result = ::SectRect( &leftCellRect, &inTotalSelectionRect, &leftCellRect ); } return result; @@ -1066,6 +1427,43 @@ void CStandardFlexTable::DontBeTarget() LCommander::DontBeTarget(); } // CStandardFlexTable::DontBeTarget +// ===== BEGINCEXTable Refugees + +//---------------------------------------------------------------------------------------- +void CStandardFlexTable::RefreshRowRange(TableIndexT inStartRow, TableIndexT inEndRow) +//---------------------------------------------------------------------------------------- +{ + TableIndexT topRow, botRow; + if ( inStartRow < inEndRow ) { + topRow = inStartRow; botRow = inEndRow; + } else { + topRow = inEndRow; botRow = inStartRow; + } + RefreshCellRange(STableCell(topRow, 1), STableCell(botRow, mCols)); +} + +//---------------------------------------------------------------------------------------- +void CStandardFlexTable::ReadSavedTableStatus(LStream *inStatusData) +//---------------------------------------------------------------------------------------- +{ + if ( inStatusData != nil ) + { + + Assert_(mTableHeader != nil); + + mTableHeader->ReadColumnState(inStatusData); + } +} + +//---------------------------------------------------------------------------------------- +void CStandardFlexTable::WriteSavedTableStatus(LStream *outStatusData) +//---------------------------------------------------------------------------------------- +{ + Assert_(mTableHeader != nil); + mTableHeader->WriteColumnState(outStatusData); +} +// ===== END CEXTable Refugee functions + //---------------------------------------------------------------------------------------- PaneIDT CStandardFlexTable::GetCellDataType(const STableCell &inCell) const //---------------------------------------------------------------------------------------- @@ -1249,45 +1647,38 @@ TableIndexT CStandardFlexTable::GetHiliteColumn() const return LArray::index_Bad; // default is to hilite the whole row. } // CStandardFlexTable::GetHiliteColumn - -// -// ComputeItemDropAreas -// -// When a drag goes over a cell that contains a non-folder, divide the node in half. The top -// half will represent dropping above the item, the bottom after. -// -void -CStandardFlexTable :: ComputeItemDropAreas ( const Rect & inLocalCellRect, Rect & oTop, - Rect & oBottom ) +//---------------------------------------------------------------------------------------- +void CStandardFlexTable::ComputeItemDropAreas( + const Rect& inLocalCellRect, + Rect& outTop, + Rect& outBottom ) +// When a drag goes over a cell that contains a non-folder, divide the node in half. The +// top half will represent dropping above the item, the bottom after. +//---------------------------------------------------------------------------------------- { - oBottom = oTop = inLocalCellRect; - uint16 midPt = (oTop.bottom - oTop.top) / 2; - oTop.bottom = oTop.top + midPt; - oBottom.top = oTop.bottom + 1; - + outBottom = outTop = inLocalCellRect; + uint16 midPt = (outTop.bottom - outTop.top) / 2; + outTop.bottom = outTop.top + midPt; + outBottom.top = outTop.bottom + 1; } // ComputeItemDropAreas // ComputeItemDropAreas - -// -// ComputeFolderDropAreas -// -// When a drag goes over a cell that contains a folder, divide the cell area into 3 parts. The middle -// area, which corresponds to a drop on the folder takes up the majority of the cell space with the -// top and bottom areas (corresponding to drop before and drop after, respectively) taking up the rest -// at the ends. -// -void -CStandardFlexTable :: ComputeFolderDropAreas ( const Rect & inLocalCellRect, Rect & oTop, - Rect & oBottom ) +//---------------------------------------------------------------------------------------- +void CStandardFlexTable::ComputeFolderDropAreas( + const Rect& inLocalCellRect, + Rect& outTop, + Rect& outBottom ) +// When a drag goes over a cell that contains a folder, divide the cell area into 3 parts. +// The middle area, which corresponds to a drop on the folder takes up the majority of +// the cell space with the top and bottom areas (corresponding to drop before and drop +// after, respectively) taking up the rest at the ends. +//---------------------------------------------------------------------------------------- { const Uint8 capAreaHeight = 3; - - oBottom = oTop = inLocalCellRect; - oTop.bottom = oTop.top + capAreaHeight; - oBottom.top = oBottom.bottom - capAreaHeight; - -} // ComputeFolderDropAreas + outBottom = outTop = inLocalCellRect; + outTop.bottom = outTop.top + capAreaHeight; + outBottom.top = outBottom.bottom - capAreaHeight; +} // ComputeFolderDropAreas //---------------------------------------------------------------------------------------- void CStandardFlexTable::InsideDropArea(DragReference inDragRef) @@ -1316,7 +1707,7 @@ void CStandardFlexTable::InsideDropArea(DragReference inDragRef) // Find the index of where we want to drop the item and if it is between two rows // of if it is on a row (can only happen if row is a container). - bool newIsDropBetweenRows = false; + Boolean newIsDropBetweenRows = false; TableIndexT newDropRow = LArray::index_Bad; if ( rowMouseIsOver >= 1 ) { @@ -1371,15 +1762,20 @@ void CStandardFlexTable::InsideDropArea(DragReference inDragRef) HiliteDropRow(oldDropRow, mIsDropBetweenRows); mIsDropBetweenRows = newIsDropBetweenRows; - if (newDropRow > LArray::index_Bad) + if (newDropRow > LArray::index_Bad && newDropRow <= mRows) { mDropRow = newDropRow; // so that we'll hilite HiliteDropRow(newDropRow, mIsDropBetweenRows); } else + { mDropRow = LArray::index_Bad; + } } + if (! mAllowDropAfterLastRow) + mCanAcceptCurrentDrag = (mDropRow != LArray::index_Bad); + } // CStandardFlexTable::InsideDropArea //---------------------------------------------------------------------------------------- @@ -1471,6 +1867,7 @@ void CStandardFlexTable::DrawCell( localRect = insetRect; ::EraseRect(&inLocalRect); + // Save pen state ApplyTextStyle(inCell.row); if ( mRowBeingEdited != inCell.row ) DrawCellContents(inCell, insetRect); @@ -1619,30 +2016,31 @@ void CStandardFlexTable::ScrollImageBy( } // CStandardFlexTable::ScrollImageBy //---------------------------------------------------------------------------------------- -void CStandardFlexTable::DragSelection( +OSErr CStandardFlexTable::DragSelection( const STableCell& inCell, const SMouseDownEvent& inMouseDown ) //---------------------------------------------------------------------------------------- { #pragma unused(inCell) + if (!FocusDraw()) + return userCanceledErr; + DragReference dragRef = 0; - - if (!FocusDraw()) return; - + OSErr trackResult = noErr; try { StRegion dragRgn; OSErr err = ::NewDrag(&dragRef); ThrowIfOSErr_(err); AddSelectionToDrag(dragRef, dragRgn); - if (inMouseDown.macEvent.modifiers & optionKey != 0) + if ((inMouseDown.macEvent.modifiers & optionKey) != 0) { - CursHandle copyDragCursor = ::GetCursor(6608); // finder's copy-drag cursor + CursHandle copyDragCursor = ::GetCursor(curs_CopyDrag); // finder's copy-drag cursor if (copyDragCursor != nil) ::SetCursor(*copyDragCursor); } - (void) ::TrackDrag(dragRef, &(inMouseDown.macEvent), dragRgn); + trackResult = ::TrackDrag(dragRef, &(inMouseDown.macEvent), dragRgn); } catch( ... ) { @@ -1650,8 +2048,47 @@ void CStandardFlexTable::DragSelection( if (dragRef != 0) ::DisposeDrag(dragRef); + return trackResult; } // CStandardFlexTable::DragSelection +//---------------------------------------------------------------------------------------- +OSErr CStandardFlexTable::DragRow( + TableIndexT inRow, + const SMouseDownEvent& inMouseDown ) +//---------------------------------------------------------------------------------------- +{ + if (!FocusDraw()) + return userCanceledErr; + + DragReference dragRef = 0; + OSErr trackResult = noErr; + try + { + StRegion dragRgn; + OSErr err = ::NewDrag(&dragRef); + ThrowIfOSErr_(err); + AddRowToDrag(inRow, dragRef, dragRgn); + if ((inMouseDown.macEvent.modifiers & optionKey) != 0) + { + CursHandle copyDragCursor = ::GetCursor(curs_CopyDrag); // finder's copy-drag cursor + if (copyDragCursor != nil) + ::SetCursor(*copyDragCursor); + } + trackResult = ::TrackDrag(dragRef, &(inMouseDown.macEvent), dragRgn); + } + catch(OSErr err) + { + trackResult = err; + } + catch( ... ) + { + } + + if (dragRef != 0) + ::DisposeDrag(dragRef); + return trackResult; +} // CStandardFlexTable::DragRow + //---------------------------------------------------------------------------------------- void CStandardFlexTable::AddSelectionToDrag(DragReference inDragRef, RgnHandle inDragRgn) //---------------------------------------------------------------------------------------- @@ -1678,6 +2115,28 @@ void CStandardFlexTable::AddSelectionToDrag(DragReference inDragRef, RgnHandle i ::OffsetRgn(inDragRgn, p.h, p.v); } // CStandardFlexTable::AddSelectionToDrag +//---------------------------------------------------------------------------------------- +void CStandardFlexTable::AddRowToDrag( + TableIndexT inRow, + DragReference inDragRef, + RgnHandle inDragRgn) +//---------------------------------------------------------------------------------------- +{ + AddRowDataToDrag(inRow, inDragRef); + GetRowDragRgn(inRow, inDragRgn); + + StRegion tempRgn; + ::CopyRgn(inDragRgn, tempRgn); + ::InsetRgn(tempRgn, 1, 1); + ::DiffRgn(inDragRgn, tempRgn, inDragRgn); + + // Convert the region to global coordinates + Point p; + p.h = p.v = 0; + ::LocalToGlobal(&p); + ::OffsetRgn(inDragRgn, p.h, p.v); +} // CStandardFlexTable::AddRowToDrag + //---------------------------------------------------------------------------------------- void CStandardFlexTable::ChangeSort(const LTableHeader::SortChange* /*inSortChange*/) //---------------------------------------------------------------------------------------- @@ -1695,7 +2154,7 @@ void CStandardFlexTable::GetDropFlagRect( outFlagRect.top = inLocalCellRect.top + vDiff; outFlagRect.bottom = outFlagRect.top + 12; - outFlagRect.left = inLocalCellRect.left + 3; + outFlagRect.left = inLocalCellRect.left + 2; // was 3 outFlagRect.right = outFlagRect.left + 16; } // CStandardFlexTable::GetDropFlagRect @@ -1930,12 +2389,14 @@ void CStandardFlexTable::QapGetListInfo(PQAPLISTINFO pInfo) LScroller *myScroller = dynamic_cast(GetSuperView()); if (myScroller != NULL) { - if (myScroller->GetVScrollbar() != NULL) - macVScroll = myScroller->GetVScrollbar()->GetMacControl(); + LStdControl* vScrollPane = dynamic_cast + (myScroller->FindPaneByID(PaneIDT_VerticalScrollBar)); + if (vScrollPane) + macVScroll = vScrollPane->GetMacControl(); } pInfo->itemCount = (short)outRows; - pInfo->topIndex = topLeftCell.row; + pInfo->topIndex = topLeftCell.row - 1; // must start at 0 even though in QAP-script, Select("#1") selects the first line pInfo->itemHeight = GetRowHeight(0); pInfo->visibleCount = botRightCell.row - topLeftCell.row + 1; pInfo->vScroll = macVScroll; diff --git a/mozilla/lib/mac/UserInterface/Tables/CStandardFlexTable.h b/mozilla/lib/mac/UserInterface/Tables/CStandardFlexTable.h index 356cd6e310c..f8b6b6e7ec5 100755 --- a/mozilla/lib/mac/UserInterface/Tables/CStandardFlexTable.h +++ b/mozilla/lib/mac/UserInterface/Tables/CStandardFlexTable.h @@ -31,6 +31,7 @@ #include //#include +#include "NetscapeDragFlavors.h" #include "LTableViewHeader.h" // Need LTableHeader here, need the whole thing in the .cp file. // Might as well go the whole hog. @@ -39,7 +40,6 @@ class CStandardFlexTable; class CClickTimer; class CInlineEditField; - //======================================================================================== class CTableHeaderListener : public LListener //======================================================================================== @@ -55,7 +55,7 @@ protected: class CInlineEditorListener : public LListener { public: - CInlineEditorListener ( CStandardFlexTable* inTable ) : mTable(inTable) { } + CInlineEditorListener( CStandardFlexTable* inTable ) : mTable(inTable) { } protected: void ListenToMessage(MessageT inMessage, void *ioParam); CStandardFlexTable* mTable; @@ -79,6 +79,7 @@ private: friend class CTableHeaderListener; friend class CClickTimer; friend class CInlineEditorListener; + friend class CDeferredInlineEditTask; public: enum { class_ID = 'sfTb', @@ -100,17 +101,19 @@ public: virtual Boolean GetNotifyOnSelectionChange(); void SetRightmostVisibleColumn(UInt16 inLastDesiredColumn); - // an externally public way to tell the table to begin an inplace edit. This is - // useful when handling menu commands, etc and not mouse clicks in the table. void DoInlineEditing ( const STableCell & inCell ) ; + // a public way to tell the table to begin an in-place edit. This is + // useful when handling menu commands, etc and not mouse clicks in the table. - virtual void RefreshCellRange( - const STableCell &inTopLeft, - const STableCell &inBotRight); // Overridden to fix a bug in PP. - protected: - enum { kMinRowHeight = 18, kDistanceFromIconToText = 5, kIconMargin = 4, kIndentPerLevel = 10, - kIconWidth = 16 }; + enum { + kMinRowHeight = 18 + , kDistanceFromIconToText = 5 + , kDropIconWastedSpace = 4 + , kIconMargin = 1 + , kIndentPerLevel = 14 + , kIconWidth = 16 + }; // for in-place editing, give the CInlineEditor this paneID. enum { paneID_InlineEdit = 'EDIT' } ; @@ -130,36 +133,66 @@ protected: virtual void DrawSelf(); virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent); + virtual void RefreshCellRange( + const STableCell &inTopLeft, + const STableCell &inBotRight); // Overridden to fix a bug in PP. virtual void Click(SMouseDownEvent &inMouseDown); virtual void BeTarget(); virtual void DontBeTarget(); +// ------------------------------------------------------------ +// CEXTable Refugees +// ------------------------------------------------------------ +public: + void SelectScrollCell(const STableCell &inCell) + { + SelectCell(inCell); + ScrollCellIntoFrame(inCell); + } + + void RefreshRowRange(TableIndexT inStartRow, TableIndexT inEndRow); + void ReadSavedTableStatus(LStream *inStatusData); + void WriteSavedTableStatus(LStream *outStatusData); // ------------------------------------------------------------ // Sorting // ------------------------------------------------------------ +protected: virtual void ChangeSort(const LTableHeader::SortChange* inSortChange); // ------------------------------------------------------------ // Selection, MouseDowns // ------------------------------------------------------------ +public: + void SetFancyDoubleClick(Boolean inFancy) { mFancyDoubleClick = inFancy; } + +protected: virtual Boolean ClickSelect( const STableCell &inCell, const SMouseDownEvent &inMouseDown); + virtual void ClickSelf(const SMouseDownEvent &inMouseDown); + + Boolean HandleFancyDoubleClick( + const STableCell &inCell, + const SMouseDownEvent &inMouseDown); + virtual Boolean ClickDropFlag( const STableCell &inCell, const SMouseDownEvent &inMouseDown); virtual Boolean CellSelects(const STableCell& inCell) const; - virtual Boolean CellWantsClick ( const STableCell & /*inCell*/ ) const { return false; } - void SetFancyDoubleClick(Boolean inFancy) { mFancyDoubleClick = inFancy; } + virtual Boolean CellWantsClick( const STableCell & /*inCell*/ ) const { return false; } void SetHiliteDisabled(Boolean inDisable) { mHiliteDisabled = inDisable; } - virtual void HandleSelectionTracking ( const SMouseDownEvent & inMouseDown ) ; - virtual void TrackSelection ( const SMouseDownEvent & inMouseDown ) ; - virtual Boolean HitCellHotSpot ( const STableCell &inCell, + virtual void HandleSelectionTracking( const SMouseDownEvent & inMouseDown ) ; + virtual void TrackSelection( const SMouseDownEvent & inMouseDown ) ; + virtual Boolean HitCellHotSpot( const STableCell &inCell, const Rect &inTotalSelectionRect ) ; - virtual void UnselectCellsNotInSelectionOutline ( const Rect & selectionRect ) ; + + // the the cell rect in local coords even if scrolled out the the view + virtual void GetLocalCellRectAnywhere( const STableCell &inCell, Rect &outCellRect) const; + + virtual void UnselectCellsNotInSelectionOutline( const Rect & selectionRect ) ; // override to turn off selection outline tracking - virtual Boolean TableDesiresSelectionTracking ( ) { return true; } + virtual Boolean TableDesiresSelectionTracking( ) { return true; } virtual const TableIndexT* GetUpdatedSelectionList(TableIndexT& outSelectionSize); // Returns a ONE-BASED list of TableIndexT, as it should. @@ -169,6 +202,7 @@ protected: public: Boolean GetNextSelectedRow(TableIndexT& inOutAfterRow) const; Boolean GetLastSelectedRow(TableIndexT& inOutBeforeRow) const; + protected: void SelectRow(TableIndexT inRow); void ScrollRowIntoFrame(TableIndexT inRow); @@ -195,7 +229,7 @@ protected: virtual void InlineEditorTextChanged( ) { } virtual void InlineEditorDone( ) { } virtual void DoInlineEditing( const STableCell &inCell, Rect & inTextRect ); - virtual bool CanDoInlineEditing( ) { return true; } + virtual Boolean CanDoInlineEditing( ) { return true; } virtual void DrawCell( const STableCell &inCell, @@ -242,7 +276,7 @@ protected: // ------------------------------------------------------------ protected: virtual void SetCellExpansion(const STableCell& /* inCell */, Boolean /* inExpand */) {} - virtual Boolean CellHasDropFlag(const STableCell& /* inCell */, Boolean& /* outIsExpanded */) const { return true; } + virtual Boolean CellHasDropFlag(const STableCell& /* inCell */, Boolean& /* outIsExpanded */) const { return false; } virtual Boolean CellInitiatesDrag(const STableCell& /* inCell */) const { return false; } virtual void GetDropFlagRect( const Rect& inLocalCellRect, Rect& outFlagRect) const; @@ -252,9 +286,21 @@ protected: // ------------------------------------------------------------ // Drag Support // ------------------------------------------------------------ - virtual void DragSelection(const STableCell& inCell, const SMouseDownEvent &inMouseDown); - virtual void AddSelectionToDrag(DragReference inDragRef, RgnHandle inDragRgn); - virtual void AddRowDataToDrag( TableIndexT /* inRow */, + virtual OSErr DragSelection( + const STableCell& inCell, + const SMouseDownEvent &inMouseDown); + virtual OSErr DragRow( + TableIndexT inRow, + const SMouseDownEvent& inMouseDown); + virtual void AddSelectionToDrag( + DragReference inDragRef, + RgnHandle inDragRgn); + virtual void AddRowToDrag( + TableIndexT inRow, + DragReference inDragRef, + RgnHandle inDragRgn); + virtual void AddRowDataToDrag( + TableIndexT /* inRow */, DragReference /* inDragRef */ ) {}; virtual void InsideDropArea(DragReference inDragRef); virtual void EnterDropArea(DragReference inDragRef, Boolean inDragHasLeftSender); @@ -274,9 +320,16 @@ protected: virtual Boolean RowCanAcceptDropBetweenAbove( DragReference inDragRef, TableIndexT inDropRow); - virtual Boolean RowIsContainer ( const TableIndexT & /* inRow */ ) const { return false; } - void ComputeItemDropAreas ( const Rect & inLocalCellRect, Rect & oTop, Rect & oBottom ) ; - void ComputeFolderDropAreas ( const Rect & inLocalCellRect, Rect & oTop, Rect & oBottom ) ; + virtual Boolean RowIsContainer( + const TableIndexT & /* inRow */ ) const { return false; } + void ComputeItemDropAreas( + const Rect& inLocalCellRect, + Rect& outTop, + Rect& outBottom ); + void ComputeFolderDropAreas( + const Rect & inLocalCellRect, + Rect& outTop, + Rect& outBottom ); // ------------------------------------------------------------ // Miscellany @@ -329,7 +382,7 @@ public: // ------------------------------------------------------------ #if defined(QAP_BUILD) public: - virtual void QapGetListInfo (PQAPLISTINFO pInfo); + virtual void QapGetListInfo(PQAPLISTINFO pInfo); virtual Ptr QapAddCellToBuf(Ptr pBuf, Ptr pLimit, const STableCell& sTblCell); virtual void GetQapRowText(TableIndexT inRow, char* outText, UInt16 inMaxBufferLength) const; #endif @@ -354,6 +407,7 @@ protected: RGBColor mDropColor; Boolean mIsInternalDrop; // a drop of one row on another ? Boolean mIsDropBetweenRows; // changing order + Boolean mAllowDropAfterLastRow; // true to allow drops in the whitespace after the table CInlineEditField* mNameEditor; // used for inline editing TableIndexT mRowBeingEdited; diff --git a/mozilla/lib/mac/UserInterface/Tables/CTableKeyAttachment.cp b/mozilla/lib/mac/UserInterface/Tables/CTableKeyAttachment.cp index 27e82fbc6a4..bfa1edebc21 100644 --- a/mozilla/lib/mac/UserInterface/Tables/CTableKeyAttachment.cp +++ b/mozilla/lib/mac/UserInterface/Tables/CTableKeyAttachment.cp @@ -19,7 +19,8 @@ #include "CTableKeyAttachment.h" #include -#include +#include "StSetBroadcasting.h" +#include "CSpecialTableView.h" //testing #include "XP_Trace.h" @@ -30,6 +31,9 @@ CTableKeyAttachment::CTableKeyAttachment(CSpecialTableView* inView) { mTableView = dynamic_cast(mViewToScroll); Assert_(mTableView); + + // set getting keyups to bullet-proof us from someone messing with the System Event Mask + mGettingKeyUps = (::LMGetSysEvtMask() & keyUpMask); } CTableKeyAttachment::~CTableKeyAttachment() @@ -64,14 +68,22 @@ void CTableKeyAttachment::ExecuteSelf( TableIndexT theRowCount, theColCount; mTableView->GetTableSize(theRowCount, theColCount); - if (theKey == char_DownArrow || theKey == char_UpArrow) { - if (eventParam->what == keyDown || eventParam->what == autoKey) { - mTableView->SetNotifyOnSelectionChange(false); - } else if (eventParam->what == keyUp) + if (mGettingKeyUps) + { + if (theKey == char_DownArrow || theKey == char_UpArrow) { - mTableView->SetNotifyOnSelectionChange(true); - mTableView->SelectionChanged(); - return; + if (eventParam->what == keyDown || eventParam->what == autoKey) { + mTableView->SetNotifyOnSelectionChange(false); + } else if (eventParam->what == keyUp) + { + mTableView->SetNotifyOnSelectionChange(true); + mTableView->SelectionChanged(); + return; + } + } else { + // the only key-ups we want are arrows, and we've already done all we need with them + if (eventParam->what == keyUp) + return; } } @@ -154,12 +166,152 @@ CTableKeyAttachment::SelectCell( const STableCell& inCell, Boolean multiple) { if (!multiple) { - Boolean oldNotify = mTableView->GetNotifyOnSelectionChange(); - - mTableView->SetNotifyOnSelectionChange(false); + StSetBroadcasting saveBroadcastState((CStandardFlexTable *)mTableView, false); mTableView->UnselectAllCells(); - mTableView->SetNotifyOnSelectionChange(oldNotify); } mTableView->ScrollCellIntoFrame(inCell); // Do this before selecting (avoids turds) mTableView->SelectCell(inCell); } + + +#pragma mark - + + +CTableRowKeyAttachment::CTableRowKeyAttachment(CSpecialTableView* inView) + : CTableKeyAttachment(inView) +{ +} + +CTableRowKeyAttachment::~CTableRowKeyAttachment() +{ +} + + +void CTableRowKeyAttachment::ExecuteSelf(MessageT inMessage, void *ioParam) +{ + // In communicator, keyup events are turned on. This is for the benefit of Java + // applets, and we don't want to handle them for key scrolling in tables. + + // Well, we do actually. If we get a keyDown event, or autokey events, we don't + // want to update the list until the user lets go. So we turn off broadcasting + // until we get a keyUp. We also don't want to change the selection on the keyup, + // since we've already done that for the corresponding keyDown/autoKey. + + if (inMessage != msg_KeyPress) + return; + + EventRecord* eventParam = (EventRecord *)ioParam; + + mExecuteHost = false; + Int16 theKey = eventParam->message & charCodeMask; + Boolean bShiftDown = (eventParam->modifiers & shiftKey) != 0; + Boolean bControlDown = (eventParam->modifiers & controlKey) != 0; + // get the table dimensions + TableIndexT theRowCount, theColCount; + mTableView->GetTableSize(theRowCount, theColCount); + + if (mGettingKeyUps) + { + if (theKey == char_DownArrow || theKey == char_UpArrow) + { + if (eventParam->what == keyDown || eventParam->what == autoKey) { + mTableView->SetNotifyOnSelectionChange(false); + } else if (eventParam->what == keyUp) + { + mTableView->SetNotifyOnSelectionChange(true); + mTableView->SelectionChanged(); + return; + } + } else { + // the only key-ups we want are arrows, and we've already done all we need with them + if (eventParam->what == keyUp) + return; + } + } + + switch (theKey) + { + case char_PageUp: + case char_PageDown: + LKeyScrollAttachment::ExecuteSelf(inMessage, ioParam); + break; + case char_DownArrow: + if (!bControlDown) + { + // Get the last currently selected row + TableIndexT rows, cols; + + mTableView->GetTableSize(rows, cols); + + STableCell theCell(rows, 1); + // We don't want to use GetNextCell() here, because we don't want + // the overhead of stepping through each cell on the row. We know + // that all the cells in a selected row are selected. + while (mTableView->IsValidRow(theCell.row)) + { + if ( mTableView->CellIsSelected(theCell) ) + break; + + theCell.row --; + } + + if (mTableView->IsValidRow(theCell.row) ) // get the one after the selected cell + theCell.row ++; + else // select the last cell + { + theCell.row = rows; + theCell.col = 1; + } + if (mTableView->IsValidCell(theCell)) + SelectCell(theCell, bShiftDown); + break; + } + // else falls through + + case char_End: + { + STableCell theLastCell(theRowCount, 1); // still the first column + SelectCell(theLastCell, bShiftDown); + } + break; + + case char_UpArrow: + if (!bControlDown) + { + // Get the first currently selected row + STableCell theCell(1, 1); + + while (mTableView->IsValidRow(theCell.row)) + { + if ( mTableView->CellIsSelected(theCell) ) + break; + + theCell.row ++; + } + + if (mTableView->IsValidRow(theCell.row) ) // get the one before the selected cell + theCell.row --; + else // select the first cell + { + theCell.row = 1; + theCell.col = 1; + } + if (mTableView->IsValidCell(theCell)) + SelectCell(theCell, bShiftDown); + break; + } + // else falls through + + case char_Home: + { + STableCell theFirstCell(1, 1); + if (mTableView->IsValidCell(theFirstCell)) + SelectCell(theFirstCell, bShiftDown); + } + break; + + default: + mExecuteHost = true; // Some other key, let host respond + break; + } +} diff --git a/mozilla/lib/mac/UserInterface/Tables/CTableKeyAttachment.h b/mozilla/lib/mac/UserInterface/Tables/CTableKeyAttachment.h index 8bac434ae6e..4277f805a2e 100644 --- a/mozilla/lib/mac/UserInterface/Tables/CTableKeyAttachment.h +++ b/mozilla/lib/mac/UserInterface/Tables/CTableKeyAttachment.h @@ -37,4 +37,20 @@ class CTableKeyAttachment : public LKeyScrollAttachment void *ioParam); CSpecialTableView* mTableView; // safe cast of the view in the base class. + + Boolean mGettingKeyUps; // true if the app is receiving keyups +}; + +// a key attachment class that is optimized for row-selection tables +class CTableRowKeyAttachment : public CTableKeyAttachment +{ + public: + CTableRowKeyAttachment(CSpecialTableView* inView); + virtual ~CTableRowKeyAttachment(); + + protected: + + virtual void ExecuteSelf( + MessageT inMessage, + void *ioParam); }; \ No newline at end of file diff --git a/mozilla/lib/mac/UserInterface/Tables/LTableHeader.cp b/mozilla/lib/mac/UserInterface/Tables/LTableHeader.cp index 92845a3ddab..4c7840adf2a 100644 --- a/mozilla/lib/mac/UserInterface/Tables/LTableHeader.cp +++ b/mozilla/lib/mac/UserInterface/Tables/LTableHeader.cp @@ -64,7 +64,7 @@ LTableHeader::LTableHeader( LStream *inStream ) ResIDT theBevelTraitsID; mColumnData = NULL; - mColumnCount = mLastVisibleColumn = 0; + mColumnCount = mLastShowableColumn = mLastVisibleColumn = 0; *inStream >> mHeaderFlags; @@ -134,6 +134,11 @@ void LTableHeader::DrawSelf() Rect sect; LocateColumn(i, r); + + // Hack to tidy up 1-pixel offset of last header + if (i == mLastVisibleColumn) + r.right ++; + SColumnData* cData = GetColumnData(i); // Checking against the update rgn is necessary because we sometimes @@ -172,7 +177,7 @@ void LTableHeader::DrawSelf() DrawColumnBackground(r, false); } CalcLocalFrameRect(r); - r.left = r.right - kColumnHidingWidgetWidth; + r.left = r.right - kColumnHidingWidgetWidth + 1; DrawColumnBackground(r, false); // Draw the column hiding widget @@ -183,12 +188,12 @@ void LTableHeader::DrawSelf() r.bottom -= 1; // Hate this, but the position had to be adjusted. - jrm. r.left -= 1; if (mLastVisibleColumn <= 1) - if (mColumnCount == 1) - iconID = kColumnHiderDisabledIcon; + if (mLastShowableColumn == 1) + iconID = kColumnHiderDisabledIcon; // neither hide nor show possible else - iconID = kColumnHiderHideDisabledIcon; + iconID = kColumnHiderHideDisabledIcon; // show is possible else - if (mLastVisibleColumn == mColumnCount) + if (mLastVisibleColumn == mLastShowableColumn) iconID = kColumnHiderShowDisabledIcon; else iconID = kColumnHiderEnabledIcon; @@ -254,11 +259,11 @@ Boolean LTableHeader::IsInHorizontalSizeArea( SInt16 left = inLocalPt.h + 2; SInt16 right = inLocalPt.h - 2; - // Start at the division between the first and second columns + // start at the division between the first and second columns // Go up to the division between the last visible and the following one, // if there is one. SInt16 lastColumnToCheck = mLastVisibleColumn; - if (mColumnCount > mLastVisibleColumn) + if (mLastShowableColumn > mLastVisibleColumn) lastColumnToCheck++; SColumnData* cRightNeigbor = *mColumnData + 1; for (outLeftColumn = 1; @@ -300,7 +305,7 @@ void LTableHeader::Click(SMouseDownEvent &inEvent) // Handle clicks in the column hiding widget if (CanHideColumns() && (inEvent.whereLocal.h > GetHeaderWidth())) { - if (mColumnCount == 1 && mLastVisibleColumn == 1) + if (mLastShowableColumn == 1 && mLastVisibleColumn == 1) return; // no hiding/showing possible. // The right arrow hides the rightmost column and the left arrow // shows it. @@ -310,7 +315,7 @@ void LTableHeader::Click(SMouseDownEvent &inEvent) : leftSide; if (mLastVisibleColumn > 1 && side == rightSide) ShowHideRightmostColumn(false); // hide - else if (mLastVisibleColumn < mColumnCount && side == leftSide) + else if (mLastVisibleColumn < mLastShowableColumn && side == leftSide) ShowHideRightmostColumn(true); // show. } else @@ -546,7 +551,7 @@ void LTableHeader::ResizeColumn( else if (inLeftColumnDelta < 0) { // Move as many columns onscreen as will fit - while (mLastVisibleColumn + 1 <= mColumnCount + while (mLastVisibleColumn + 1 <= mLastShowableColumn && GetWidthOfRange(inLeftColumn + 1, mLastVisibleColumn + 1) <= newSpace) { mLastVisibleColumn++; @@ -640,7 +645,7 @@ void LTableHeader::ShowHideRightmostColumn(Boolean inShow) // mLastVisibleColumn is the rightmost visible column. //----------------------------------- { - Assert_((inShow && mLastVisibleColumn < mColumnCount) || + Assert_((inShow && mLastVisibleColumn < mLastShowableColumn) || (!inShow && mLastVisibleColumn > 1)); ColumnIndexT savedLastVisibleColumn = mLastVisibleColumn; @@ -778,13 +783,15 @@ Boolean LTableHeader::RedistributeSpace( // OK, if we get this far, then some columns were able to resize // (sumOfWidths != inOldSpace), and there's merely a rounding error to adjust. int signedUnit = roundingError < 0 ? -1 : +1; -#ifdef DEBUG - int maxRound = (inToColumn - inFromColumn + 2) / 2; +//#ifdef DEBUG +// int maxRound = (inToColumn - inFromColumn + 2) / 2; // Assert_(roundingError * signedUnit <= maxRound); -#endif +//#endif static int rovingIndex = 0; const Int16 initialError = roundingError; const int initialIndex = rovingIndex; + Int16 panicCount = 0; + while (roundingError) { rovingIndex++; @@ -801,6 +808,9 @@ Boolean LTableHeader::RedistributeSpace( cData->columnWidth += signedUnit; roundingError -= signedUnit; } + + if (++panicCount > 100) + break; } return true; } // LTableHeader::RedistributeSpace @@ -1276,6 +1286,14 @@ Boolean LTableHeader::CanColumnSort(ColumnIndexT inColumn) const return GetColumnData(inColumn)->CanSort(); } +//----------------------------------- +Boolean LTableHeader::CanColumnShow(ColumnIndexT inColumn) const +//----------------------------------- +{ + CheckLegal(inColumn); + return GetColumnData(inColumn)->CanShow(); +} + //----------------------------------- LTableHeader::ColumnIndexT LTableHeader::GetSortedColumn(PaneIDT &outHeaderPane) const //----------------------------------- @@ -1361,6 +1379,16 @@ void LTableHeader::ReadColumnState( LStream * inStream, Boolean inMoveHeaders) StHandleLocker locker((Handle)mColumnData); inStream->GetBytes(*mColumnData, dataSize); + // find the last showable column + for (UInt16 i = 1; i <= mColumnCount; i++) + { + // non-showing cols must be at the end + Assert_( CanColumnShow(i) ? true : i > mLastVisibleColumn); + + if (CanColumnShow(i)) + mLastShowableColumn = i; + } + ConvertWidthsToAbsolute(); ComputeColumnPositions(); diff --git a/mozilla/lib/mac/UserInterface/Tables/LTableHeader.h b/mozilla/lib/mac/UserInterface/Tables/LTableHeader.h index 583d8afb50b..42c3065de8c 100644 --- a/mozilla/lib/mac/UserInterface/Tables/LTableHeader.h +++ b/mozilla/lib/mac/UserInterface/Tables/LTableHeader.h @@ -138,14 +138,20 @@ public: { return (flags & kColumnDoesNotDisplayTitle) == 0; } + Boolean CanShow() const + { + return (flags & kColumnDoesNotShow) == 0; + } + private: enum { - kColumnDoesNotSort = 1<<0 - , kColumnDoesNotResize = 1<<1 - , kColumnSuppressSortIcon = 1<<2 - , kColumnDoesNotMove = 1<<3 - , kColumnDoesNotDisplayTitle = 1<<4 + kColumnDoesNotSort = 1<<0 + , kColumnDoesNotResize = 1<<1 + , kColumnSuppressSortIcon = 1<<2 + , kColumnDoesNotMove = 1<<3 + , kColumnDoesNotDisplayTitle = 1<<4 + , kColumnDoesNotShow = 1<<5 }; public: enum { kMinWidth = 16 }; @@ -216,9 +222,11 @@ protected: // Boolean CanColumnResize(ColumnIndexT inColumn) const; Boolean CanColumnSort(ColumnIndexT inColumn) const; + Boolean CanColumnShow(ColumnIndexT inColumn) const; Boolean ColumnHasSortIcon(ColumnIndexT inColumn) const; Boolean CanHideColumns() const; +#ifdef Debug_Signal void CheckVisible(ColumnIndexT inIndex) const { Assert_(inIndex > 0 && inIndex <= mLastVisibleColumn); @@ -231,14 +239,19 @@ protected: { Assert_(inIndex >= 0 && inIndex <= mColumnCount); } - +#else + void CheckVisible(ColumnIndexT /*inIndex*/) const { } + void CheckLegal(ColumnIndexT /*inIndex*/) const { } + void CheckLegalHigh(ColumnIndexT /*inIndex*/) const { } +#endif //Debug_Signal + LPane* GetColumnPane(ColumnIndexT inColumn); protected: enum { kColumnMargin = 2, - kColumnHidingWidgetWidth = 15 + kColumnHidingWidgetWidth = 16 }; HeaderFlags mHeaderFlags; @@ -247,6 +260,7 @@ protected: SBevelColorDesc mSortedBevel; ColumnIndexT mColumnCount; // 1-based count of all columns + ColumnIndexT mLastShowableColumn; // 1-based count of cols that can show ColumnIndexT mLastVisibleColumn; // 1-based index of rightmost visible column ColumnIndexT mSortedColumn; // 1-based index of sorted columns Boolean mSortedBackwards; diff --git a/mozilla/lib/mac/UserInterface/Tables/LTableRowSelector.cp b/mozilla/lib/mac/UserInterface/Tables/LTableRowSelector.cp index 0d8a1d9b252..f92415f9965 100644 --- a/mozilla/lib/mac/UserInterface/Tables/LTableRowSelector.cp +++ b/mozilla/lib/mac/UserInterface/Tables/LTableRowSelector.cp @@ -143,6 +143,16 @@ LTableRowSelector::DoSelect( const TableIndexT inRow, if (inRow < 1 || inRow > GetCount()) return; + // Make sure for a single selector only 1 row is selected + if ( inSelect && !mAllowMultiple ) + { + if ( mSelectedRowCount > 0 ) + { + DoSelectAll(false, false); + mSelectedRowCount = 0; // to be safe + } + } + char oldRowValue; FetchItemAt(inRow, &oldRowValue); char newRowValue = (inSelect) ? 1 : 0; @@ -211,7 +221,7 @@ LTableRowSelector::DoSelectAll(Boolean inSelect, Boolean inNotify) UInt32 nCols, nRows; mTableView->GetTableSize(nRows, nCols); - if (nRows) // Prevents bug: DoSelectRange won't check! + if (nRows > 0) // Prevents bug: DoSelectRange won't check! DoSelectRange(1, nRows, inSelect, inNotify); else { @@ -462,3 +472,68 @@ LTableRowSelector::RemoveRows( Uint32 inHowMany, if (selectionChanged) mTableView->SelectionChanged(); } + +void +LTableRowSelector::MakeSelectionRegion(RgnHandle ioRgnHandle, TableIndexT hiliteColumn) +{ + Assert_(ioRgnHandle); + + ::SetEmptyRgn(ioRgnHandle); + + Boolean inSelection = false; + TableIndexT selectionStart; + TableIndexT nRows = GetCount(); + + StRegion tempRgn; + + for (TableIndexT row = 1; row <= nRows; row ++) + { + Boolean rowSelected; + + FetchItemAt(row, &rowSelected); + + // I'm trying to reduce the number of region operations here + if (rowSelected && !inSelection) // start of selection group + { + selectionStart = row; + inSelection = true; + + } else if (!rowSelected && inSelection) // end of selection group + { + Rect selectRect = {selectionStart, hiliteColumn, row, hiliteColumn + 1}; + + ::RectRgn(tempRgn, &selectRect); + ::UnionRgn(tempRgn, ioRgnHandle, ioRgnHandle); + inSelection = false; + } + } + // do the last group if necessary + if (inSelection) + { + Rect selectRect = {selectionStart, hiliteColumn, nRows + 1, hiliteColumn + 1}; + + ::RectRgn(tempRgn, &selectRect); + ::UnionRgn(tempRgn, ioRgnHandle, ioRgnHandle); + } +} + + +void +LTableRowSelector::SetSelectionFromRegion(RgnHandle inRgnHandle) +{ + Assert_(inRgnHandle); + + TableIndexT nRows = GetCount(); + + UnselectAllCells(); + + STableCell theCell(1, 1); + + for (theCell.row = 1; theCell.row <= nRows; theCell.row ++) + { + Point thePoint = { /* cast */theCell.row, 1}; //v, h + + if ( ::PtInRgn(thePoint, inRgnHandle) ) + DoSelect(theCell.row, true, true, true); + } +} \ No newline at end of file diff --git a/mozilla/lib/mac/UserInterface/Tables/LTableRowSelector.h b/mozilla/lib/mac/UserInterface/Tables/LTableRowSelector.h index 0dfe06f0c43..8b68e23f5f2 100644 --- a/mozilla/lib/mac/UserInterface/Tables/LTableRowSelector.h +++ b/mozilla/lib/mac/UserInterface/Tables/LTableRowSelector.h @@ -66,6 +66,9 @@ public: TableIndexT GetSelectedRowCount() const { return mSelectedRowCount; } virtual void DoSelect(TableIndexT inRow, Boolean inSelect, Boolean inHilite, Boolean inNotify = false); + virtual void MakeSelectionRegion(RgnHandle ioRgnHandle, TableIndexT hiliteColumn); + virtual void SetSelectionFromRegion(RgnHandle inRgnHandle); + protected: virtual void DoSelectAll(Boolean inSelect, Boolean inNotify); void DoSelectRange(TableIndexT inFrom, TableIndexT inTo, Boolean inSelect, Boolean inNotify); @@ -78,9 +81,5 @@ protected: TableIndexT mExtensionRow; Boolean mAllowMultiple; TableIndexT mSelectedRowCount; - RgnHandle mAddToSelection; - RgnHandle mRemoveFromSelection; - RgnHandle mInvertSelection; - }; diff --git a/mozilla/lib/mac/UserInterface/UGraphicGizmos.cp b/mozilla/lib/mac/UserInterface/UGraphicGizmos.cp index ecd124f9330..1f06d0e8a4b 100644 --- a/mozilla/lib/mac/UserInterface/UGraphicGizmos.cp +++ b/mozilla/lib/mac/UserInterface/UGraphicGizmos.cp @@ -1205,7 +1205,7 @@ Boolean UGraphicGizmos::GetTingeColorsFromColorTable ( // ¥ FindInColorTable // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -RGBColor UGraphicGizmos::FindInColorTable(CTabHandle inColorTable, Int16 inColorID) +void UGraphicGizmos::FindInColorTable(CTabHandle inColorTable, Int16 inColorID, RGBColor &outColor) { RGBColor theFoundColor = { 0, 0, 0 }; @@ -1218,17 +1218,18 @@ RGBColor UGraphicGizmos::FindInColorTable(CTabHandle inColorTable, Int16 inColor } } - return theFoundColor; + outColor = theFoundColor; } // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // ¥ MixColor // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ -RGBColor UGraphicGizmos::MixColor( +void UGraphicGizmos::MixColor( const RGBColor& inLightColor, const RGBColor& inDarkColor, - Int16 inShade) + Int16 inShade, + RGBColor& outColor) { RGBColor theMixedColor; @@ -1241,7 +1242,7 @@ RGBColor UGraphicGizmos::MixColor( theMixedColor.green = (Int32) (inLightColor.green - inDarkColor.green) * inShade / 15 + inDarkColor.green; theMixedColor.blue = (Int32) (inLightColor.blue - inDarkColor.blue) * inShade / 15 + inDarkColor.blue; - return theMixedColor; + outColor = theMixedColor; } // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ diff --git a/mozilla/lib/mac/UserInterface/UGraphicGizmos.h b/mozilla/lib/mac/UserInterface/UGraphicGizmos.h index fbbd987bf4c..50612d751ca 100644 --- a/mozilla/lib/mac/UserInterface/UGraphicGizmos.h +++ b/mozilla/lib/mac/UserInterface/UGraphicGizmos.h @@ -193,14 +193,16 @@ class UGraphicGizmos RGBColor &outLightTinge, RGBColor &outDarkTinge); - static RGBColor FindInColorTable( - CTabHandle inColorTable, - Int16 inColorID); + static void FindInColorTable( + CTabHandle inColorTable, + Int16 inColorID, + RGBColor& outColor); - static RGBColor MixColor( + static void MixColor( const RGBColor& inLightColor, const RGBColor& inDarkColor, - Int16 inShade); + Int16 inShade, + RGBColor& outColor); static void DrawArithPattern( const Rect& inFrame, diff --git a/mozilla/lib/mac/UserInterface/UStdDialogs.cp b/mozilla/lib/mac/UserInterface/UStdDialogs.cp index 56ae70db3a5..1df918e5929 100644 --- a/mozilla/lib/mac/UserInterface/UStdDialogs.cp +++ b/mozilla/lib/mac/UserInterface/UStdDialogs.cp @@ -37,8 +37,6 @@ const PaneIDT okAlertBtnID = 900; const PaneIDT cancelAlertBtnID = 901; - - // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // ¥ StStdDialogHandler // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ @@ -233,6 +231,20 @@ void StStdDialogHandler::SetText(PaneIDT id, ConstStr255Param value) GetPane(id)->SetDescriptor(value); } +void StStdDialogHandler::CopyNumberValue(PaneIDT fromPaneId, PaneIDT toPaneId) +{ + GetPane(toPaneId)->SetValue(GetControl(fromPaneId)->GetValue()); +} + +void StStdDialogHandler::CopyTextValue(PaneIDT fromPaneId, PaneIDT toPaneId) +{ + Str255 theValueText; + + GetPane(fromPaneId)->GetDescriptor(theValueText); + GetPane(toPaneId)->SetDescriptor(theValueText); +} + + void StStdDialogHandler::SetNumberText(PaneIDT id, SInt32 value) { Str255 s; diff --git a/mozilla/lib/mac/UserInterface/UStdDialogs.h b/mozilla/lib/mac/UserInterface/UStdDialogs.h index df0d8639544..1318b1b5bda 100644 --- a/mozilla/lib/mac/UserInterface/UStdDialogs.h +++ b/mozilla/lib/mac/UserInterface/UStdDialogs.h @@ -107,6 +107,8 @@ class StStdDialogHandler : public StDialogHandler void SetNumberText(PaneIDT id, SInt32 value); void GetText(PaneIDT id, Str255 value); SInt32 GetNumberText(PaneIDT id); + void CopyTextValue(PaneIDT fromPaneId, PaneIDT toPaneId); + void CopyNumberValue(PaneIDT fromPaneId, PaneIDT toPaneId); protected: diff --git a/mozilla/lib/mac/UserInterface/UTearOffPalette.cp b/mozilla/lib/mac/UserInterface/UTearOffPalette.cp index 29ba82587e6..9352c2684bd 100644 --- a/mozilla/lib/mac/UserInterface/UTearOffPalette.cp +++ b/mozilla/lib/mac/UserInterface/UTearOffPalette.cp @@ -1040,7 +1040,7 @@ void CTearOffManager::CloseFloatingWindow(ResIDT inWinID) // Opens the Floating Window void CTearOffManager::OpenFloatingWindow( ResIDT inWinID, - Point inTopLeft, + Point /* inTopLeft */, Boolean inSideways, UInt8 visibility, Str255 &title) diff --git a/mozilla/lib/makefile.win b/mozilla/lib/makefile.win index e2270bb965d..0f3fbbfc259 100755 --- a/mozilla/lib/makefile.win +++ b/mozilla/lib/makefile.win @@ -29,6 +29,8 @@ #//------------------------------------------------------------------------ DEPTH=.. +include <$(DEPTH)\config\config.mak> + #//------------------------------------------------------------------------ #// #// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...) @@ -43,6 +45,11 @@ DIRS= libi18n htmldlgs libparse layout libstyle !ifdef MOZ_OJI DIRS= $(DIRS) plugin !endif +DIRS= $(DIRS) \ +!ifdef MOZ_MAIL_NEWS + libaddr \ +!endif + libparse #//------------------------------------------------------------------------ #// diff --git a/mozilla/lib/plugin/npglue.cpp b/mozilla/lib/plugin/npglue.cpp index 09fcdc58146..82a10db298f 100644 --- a/mozilla/lib/plugin/npglue.cpp +++ b/mozilla/lib/plugin/npglue.cpp @@ -52,6 +52,10 @@ static np_handle *np_alist = NULL; int np_debug = 0; +#ifdef XP_MAC +XP_Bool gForcingRedraw = FALSE; +#endif /* XP_MAC */ + NPNetscapeFuncs npp_funcs; /* @@ -2106,6 +2110,16 @@ npn_invalidateregion(NPP npp, NPRegion invalidRegion) } } +#ifdef XP_MAC +/* + Used only in CHTMLView::GetCurrentPort(). +*/ +XP_Bool NPL_IsForcingRedraw() +{ + return gForcingRedraw; +} +#endif /* XP_MAC */ + void NP_EXPORT npn_forceredraw(NPP npp) { @@ -2116,7 +2130,13 @@ npn_forceredraw(NPP npp) } if (instance && !instance->windowed) { +#ifdef XP_MAC + gForcingRedraw = TRUE; +#endif /* XP_MAC */ CL_CompositeNow(CL_GetLayerCompositor(instance->layer)); +#ifdef XP_MAC + gForcingRedraw = FALSE; +#endif /* XP_MAC */ } } diff --git a/mozilla/lib/xp/Makefile b/mozilla/lib/xp/Makefile index d7e279181a9..5c8751fc3dc 100644 --- a/mozilla/lib/xp/Makefile +++ b/mozilla/lib/xp/Makefile @@ -19,6 +19,8 @@ DEPTH = ../.. +include $(DEPTH)/config/config.mk + MODULE = xp LIBRARY_NAME = xp @@ -57,6 +59,10 @@ ifeq ($(STAND_ALONE_JAVA),1) CSRCS = xp_qsort.c endif +ifeq ($(MOZ_MAIL_NEWS),1) +CSRCS += xp_md5.c +endif + include $(DEPTH)/config/rules.mk EMACS = lemacs diff --git a/mozilla/lib/xp/xp_file.c b/mozilla/lib/xp/xp_file.c index e9e73e18762..39755722f43 100644 --- a/mozilla/lib/xp/xp_file.c +++ b/mozilla/lib/xp/xp_file.c @@ -130,6 +130,7 @@ XP_File XP_FileOpen( const char* name, XP_FileType type, case xpProxyConfig: + case xpJSConfig: case xpSocksConfig: case xpNewsRC: case xpSNewsRC: @@ -696,6 +697,12 @@ xp_FileName (const char *name, XP_FileType type, char* buf, char* configBuf) name = buf; break; } + case xpJSConfig: + { + sprintf(buf, "%.900s/failover.jsc", conf_dir); + name = buf; + break; + } case xpTemporary: { if (*name != '/') @@ -836,6 +843,7 @@ xp_FileName (const char *name, XP_FileType type, char* buf, char* configBuf) case xpMimeTypes: case xpSocksConfig: case xpMailFolder: + case xpUserPrefs: #ifdef BSDI /* In bsdi, mkdir fails if the directory name is terminated * with a '/'. - dp @@ -1020,9 +1028,13 @@ xp_FileName (const char *name, XP_FileType type, char* buf, char* configBuf) case xpNewsSort: sprintf(buf, "%.800s/xover-cache/%.128snetscape-newsrule", conf_dir, name); break; + case xpMailSort: #ifndef OLD_UNIX_FILES - sprintf(buf, "%.900s/mailrule", conf_dir); + if (name && strlen(name) > 0) + sprintf(buf, "%.900s/imap/%s/mailrule", conf_dir, name); + else + sprintf(buf, "%.900s/mailrule", conf_dir); #else /* OLD_UNIX_FILES */ sprintf(buf, "%.900s/.netscape-mailrule", conf_dir); #endif /* OLD_UNIX_FILES */ @@ -1530,12 +1542,15 @@ int XP_MakeDirectoryR(const char* name, XP_FileType type) { char separator; int result = 0; + int skipfirst; char * finalName; -#if defined(XP_WIN) || defined(XP_OS2) +#ifdef XP_WIN separator = '\\'; + skipfirst = 3; #elif defined XP_UNIX separator = '/'; + skipfirst = 1; #endif finalName = WH_FileName(name, type); if ( finalName ) @@ -1544,17 +1559,24 @@ int XP_MakeDirectoryR(const char* name, XP_FileType type) char * currentEnd; int err = 0; XP_StatStruct s; - dirPath = XP_STRDUP( finalName ); - if (dirPath == NULL) - return -1; + dirPath = XP_STRDUP( finalName ); /* XXX: why?! */ + if (dirPath == NULL) + { + XP_FREE( finalName ); + return -1; + } - currentEnd = XP_STRCHR(dirPath, separator); +#ifdef XP_WIN + /* WH_FileName() must return a drive letter else skipfirst is bogus */ + XP_ASSERT( dirPath[1] == ':' ); +#endif + currentEnd = XP_STRCHR(dirPath + skipfirst, separator); /* Loop through every part of the directory path */ while (currentEnd != 0) { char savedChar; - savedChar = currentEnd[1]; - currentEnd[1] = 0; + savedChar = currentEnd[0]; + currentEnd[0] = 0; if ( XP_Stat(dirPath, &s, xpURL ) != 0) err = XP_MakeDirectory(dirPath, xpURL); if ( err != 0) @@ -1562,7 +1584,7 @@ int XP_MakeDirectoryR(const char* name, XP_FileType type) XP_ASSERT( FALSE ); /* Could not create the directory? */ break; } - currentEnd[1] = savedChar; + currentEnd[0] = savedChar; currentEnd = XP_STRCHR( ¤tEnd[1], separator); } if ( err == 0 ) diff --git a/mozilla/lib/xp/xp_wrap.c b/mozilla/lib/xp/xp_wrap.c index 78ff1770dde..b2176ba7eb5 100644 --- a/mozilla/lib/xp/xp_wrap.c +++ b/mozilla/lib/xp/xp_wrap.c @@ -57,10 +57,18 @@ do \ *out++ = b; \ } while (0) +#undef OUTPUTSTR +#define OUTPUTSTR(s) \ +do \ +{ \ + const char *p = s; \ + while(*p) {OUTPUT(*p); p++;} \ +} while (0) + #undef OUTPUT_MACHINE_NEW_LINE #if defined(XP_WIN) || defined(XP_OS2) -#define OUTPUT_MACHINE_NEW_LINE() \ +#define OUTPUT_MACHINE_NEW_LINE(c) \ do \ { \ OUTPUT(CR); \ @@ -68,18 +76,28 @@ do \ } while (0) #else #ifdef XP_MAC -#define OUTPUT_MACHINE_NEW_LINE() OUTPUT(CR) +#define OUTPUT_MACHINE_NEW_LINE(c) \ +do \ +{ \ + OUTPUT(CR); \ + if (c) OUTPUT(LF); \ +} while (0) #else -#define OUTPUT_MACHINE_NEW_LINE() OUTPUT(LF) +#define OUTPUT_MACHINE_NEW_LINE(c) \ +do \ +{ \ + if (c) OUTPUT(CR); \ + OUTPUT(LF); \ +} while (0) #endif #endif #undef OUTPUT_NEW_LINE -#define OUTPUT_NEW_LINE() \ +#define OUTPUT_NEW_LINE(c) \ do \ { \ - OUTPUT_MACHINE_NEW_LINE(); \ + OUTPUT_MACHINE_NEW_LINE(c); \ beginningOfLine = in; \ currentColumn = 0; \ lastBreakablePos = NULL; \ @@ -87,7 +105,7 @@ do \ #undef NEW_LINE -#define NEW_LINE() \ +#define NEW_LINE(c) \ do \ { \ if ((*in == CR) && (*(in + 1) == LF)) \ @@ -98,12 +116,13 @@ do \ { \ in++; \ } \ - OUTPUT_NEW_LINE(); \ + OUTPUT_NEW_LINE(c); \ } while (0) -unsigned char * -XP_WordWrap(int charset, unsigned char *str, int maxColumn, int checkQuoting) +static unsigned char * +xp_word_wrap(int charset, unsigned char *str, int maxColumn, int checkQuoting, + const char *prefix, int addCRLF) { unsigned char *beginningOfLine; int byteWidth; @@ -146,7 +165,8 @@ XP_WordWrap(int charset, unsigned char *str, int maxColumn, int checkQuoting) } if (*in) { - NEW_LINE(); + NEW_LINE(addCRLF); + if (prefix) OUTPUTSTR(prefix); } else { @@ -169,7 +189,8 @@ XP_WordWrap(int charset, unsigned char *str, int maxColumn, int checkQuoting) OUTPUT(*p++); } } - NEW_LINE(); + NEW_LINE(addCRLF); + if (prefix) OUTPUTSTR(prefix); continue; } byteWidth = INTL_CharLen(charset, in); @@ -189,38 +210,43 @@ XP_WordWrap(int charset, unsigned char *str, int maxColumn, int checkQuoting) { OUTPUT(*p++); } + if (addCRLF && (*end == ' ' || *end == '\t')) + { + OUTPUT(*end); + } in = lastBreakablePos; - OUTPUT_NEW_LINE(); + OUTPUT_NEW_LINE(addCRLF); + if (prefix) OUTPUTSTR(prefix); continue; } } if ( - ( - ((in[0] == ' ') || (in[0] == '\t')) && - ((in[1] != ' ') && (in[1] != '\t')) - ) || - ( - (INTL_CharSetType(charset) == MULTIBYTE) && - ( - ((!(in[0] & 0x80)) && (in[1] & 0x80)) || - ( - (in[0] & 0x80) && - (INTL_KinsokuClass(charset, in) != - PROHIBIT_END_OF_LINE) && - (!(in[byteWidth] & 0x80)) - ) || - ( - (in[0] & 0x80) && - (INTL_KinsokuClass(charset, in) != - PROHIBIT_END_OF_LINE) && - (in[byteWidth] & 0x80) && - (INTL_KinsokuClass(charset, &in[byteWidth]) != - PROHIBIT_BEGIN_OF_LINE) - ) - ) - ) - ) + ( + ((in[0] == ' ') || (in[0] == '\t')) && + ((in[1] != ' ') && (in[1] != '\t')) + ) || + ( + (INTL_CharSetType(charset) == MULTIBYTE) && + ( + ((!(in[0] & 0x80)) && (in[1] & 0x80)) || + ( + (in[0] & 0x80) && + (INTL_KinsokuClass((int16)charset, in) != + PROHIBIT_END_OF_LINE) && + (!(in[byteWidth] & 0x80)) + ) || + ( + (in[0] & 0x80) && + (INTL_KinsokuClass((int16)charset, in) != + PROHIBIT_END_OF_LINE) && + (in[byteWidth] & 0x80) && + (INTL_KinsokuClass((int16)charset, &in[byteWidth]) != + PROHIBIT_BEGIN_OF_LINE) + ) + ) + ) + ) { lastBreakablePos = in + byteWidth; } @@ -243,6 +269,18 @@ XP_WordWrap(int charset, unsigned char *str, int maxColumn, int checkQuoting) return ret; } +unsigned char * +XP_WordWrap(int charset, unsigned char *str, int maxColumn, int checkQuoting) +{ + return xp_word_wrap(charset, str, maxColumn, checkQuoting, NULL, 0); +} + +unsigned char * +XP_WordWrapWithPrefix(int charset, unsigned char *str, int maxColumn, + int checkQuoting, const char *prefix, int addCRLF) +{ + return xp_word_wrap(charset, str, maxColumn, checkQuoting, prefix, addCRLF); +} #else /* XP_WORD_WRAP_NEW_CODE */ diff --git a/mozilla/modules/libnls/headers/resbund.h b/mozilla/modules/libnls/headers/resbund.h index 1aac3094e24..556a4c0ed94 100644 --- a/mozilla/modules/libnls/headers/resbund.h +++ b/mozilla/modules/libnls/headers/resbund.h @@ -42,8 +42,11 @@ #ifndef _RESBUND #define _RESBUND - + +#if 0 #include +#endif + #include "ptypes.h" #include "unistring.h" #include "locid.h" diff --git a/mozilla/modules/libpref/public/Makefile b/mozilla/modules/libpref/public/Makefile index ac847047f41..a1ee3859a69 100644 --- a/mozilla/modules/libpref/public/Makefile +++ b/mozilla/modules/libpref/public/Makefile @@ -19,6 +19,6 @@ DEPTH = ../../.. MODULE = pref -EXPORTS = prefapi.h prefldap.h +EXPORTS= prefapi.h prefldap.h include $(DEPTH)/config/rules.mk diff --git a/mozilla/modules/libpref/public/makefile.win b/mozilla/modules/libpref/public/makefile.win index c45005c7125..790610f9adf 100644 --- a/mozilla/modules/libpref/public/makefile.win +++ b/mozilla/modules/libpref/public/makefile.win @@ -20,6 +20,6 @@ IGNORE_MANIFEST=1 MODULE=pref DEPTH=..\..\.. -EXPORTS=prefapi.h prefldap.h +EXPORTS=prefapi.h prefldap.h include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/modules/libpref/public/prefapi.h b/mozilla/modules/libpref/public/prefapi.h index c8f4012a32a..63d6c6506e7 100644 --- a/mozilla/modules/libpref/public/prefapi.h +++ b/mozilla/modules/libpref/public/prefapi.h @@ -341,6 +341,19 @@ PR_EXTERN(int) PREF_ClearUserPref(const char *pref_name); PR_EXTERN(int) PREF_CreateChildList(const char* parent_node, char **child_list); PR_EXTERN(char*) PREF_NextChild(char *child_list, int *index); +/* + * Copies parts of the hierarchy from one root to another. + For example, PREF_CopyPrefsTree("mail","newmail") copies all + the "mail." prefs to "newmail." prefs. It does not delete the + source tree; you should do that yourself. + + Either srcRoot or destRoot can be empty strings, to denote + the root of the entire tree, but cannot be NULL. + * + * +*/ +PR_EXTERN(int) PREF_CopyPrefsTree(const char *srcRoot, const char *destRoot); + /* // // The callback function will get passed the pref_node which triggered the call diff --git a/mozilla/modules/libpref/src/prefapi.c b/mozilla/modules/libpref/src/prefapi.c index f68c615baa7..747f515d5ad 100644 --- a/mozilla/modules/libpref/src/prefapi.c +++ b/mozilla/modules/libpref/src/prefapi.c @@ -16,6 +16,19 @@ * Reserved. */ + /** USAGE NOTE: + + + This file (prefapi.c) is being obsoleted, and functions previously declared + here are migrating to preffunc.cpp in this module. If you make changes + in this file, please be sure to check preffunc.cpp to ensure that similar + changes are made in that file. + + Currently Windows uses preffunc.cpp and the other platforms use prefapi.c. + + + **/ + #include "jsapi.h" #include "xp_core.h" #include "xp_mcom.h" @@ -159,7 +172,7 @@ void pref_Alert(char* msg); int pref_HashPref(const char *key, PrefValue value, PrefType type, PrefAction action); /* -- Platform specific function extern */ -#if !defined(XP_OS2) +#if !defined(XP_WIN) && !defined(XP_OS2) extern JSBool pref_InitInitialObjects(void); #endif @@ -217,7 +230,7 @@ int pref_OpenFile(const char* filename, XP_Bool is_error_fatal, XP_Bool verifyHa long fileLength; stats.st_size = 0; - if ( stat(filename, &stats) == -1 ) + if ( stat(filename, (struct stat *) &stats) == -1 ) return PREF_ERROR; fileLength = stats.st_size; @@ -1793,6 +1806,131 @@ PREF_NextChild(char *child_list, int *index) return child; } +/*---------------------------------------------------------------------------------------- +* pref_copyTree +* +* A recursive function that copies all the prefs in some subtree to +* another subtree. Either srcPrefix or dstPrefix can be empty strings, +* but not NULL pointers. Preferences in the destination are created if +* they do not already exist; otherwise the old values are replaced. +* +* Example calls: +* +* Copy all the prefs to another tree: pref_copyTree("", "temp", "") +* +* Copy all the prefs under mail. to newmail.: pref_copyTree("mail", "newmail", "mail") +* +--------------------------------------------------------------------------------------*/ +int pref_copyTree(const char *srcPrefix, const char *destPrefix, const char *curSrcBranch) +{ + int result = PREF_NOERROR; + + char* children = NULL; + + if ( PREF_CreateChildList(curSrcBranch, &children) == PREF_NOERROR ) + { + int index = 0; + int srcPrefixLen = XP_STRLEN(srcPrefix); + char* child = NULL; + + while ( (child = PREF_NextChild(children, &index)) != NULL) + { + int prefType; + char *destPrefName = NULL; + char *childStart = (srcPrefixLen > 0) ? (child + srcPrefixLen + 1) : child; + + XP_ASSERT( XP_STRNCMP(child, curSrcBranch, srcPrefixLen) == 0 ); + + if (*destPrefix > 0) + destPrefName = PR_smprintf("%s.%s", destPrefix, childStart); + else + destPrefName = PR_smprintf("%s", childStart); + + if (!destPrefName) + { + result = PREF_OUT_OF_MEMORY; + break; + } + + if ( ! PREF_PrefIsLocked(destPrefName) ) /* returns true if the prefs exists, and is locked */ + { + /* PREF_GetPrefType masks out the other bits of the pref flag, so we only + every get the values in the switch. + */ + prefType = PREF_GetPrefType(child); + + switch (prefType) + { + case PREF_STRING: + { + char *prefVal = NULL; + + result = PREF_CopyCharPref(child, &prefVal); + if (result == PREF_NOERROR) + result = PREF_SetCharPref(destPrefName, prefVal); + + XP_FREEIF(prefVal); + } + break; + + case PREF_INT: + { + int32 prefValInt; + + result = PREF_GetIntPref(child, &prefValInt); + if (result == PREF_NOERROR) + result = PREF_SetIntPref(destPrefName, prefValInt); + } + break; + + case PREF_BOOL: + { + XP_Bool prefBool; + + result = PREF_GetBoolPref(child, &prefBool); + if (result == PREF_NOERROR) + result = PREF_SetBoolPref(destPrefName, prefBool); + } + break; + + case PREF_ERROR: + /* this is probably just a branch. Since we can have both + a.b and a.b.c as valid prefs, this is OK. + */ + break; + + default: + /* we should never get here */ + XP_ASSERT(FALSE); + break; + } + + } /* is not locked */ + + XP_FREEIF(destPrefName); + + /* Recurse */ + if (result == PREF_NOERROR || result == PREF_VALUECHANGED) + result = pref_copyTree(srcPrefix, destPrefix, child); + } + + XP_FREE(children); + } + + return result; +} + + +PR_IMPLEMENT(int) +PREF_CopyPrefsTree(const char *srcRoot, const char *destRoot) +{ + XP_ASSERT(srcRoot != NULL); + XP_ASSERT(destRoot != NULL); + + return pref_copyTree(srcRoot, destRoot, srcRoot); +} + + /* Adds a node to the beginning of the callback list. */ PR_IMPLEMENT(void) PREF_RegisterCallback(const char *pref_node, @@ -2042,7 +2180,6 @@ pref_ErrorReporter(JSContext *cx, const char *message, { char *last; - int i, j, k, n; const char *s, *t; last = PR_sprintf_append(0, "An error occurred reading the startup configuration file. " diff --git a/mozilla/modules/libpref/src/prefapi.cpp b/mozilla/modules/libpref/src/prefapi.cpp index f68c615baa7..747f515d5ad 100644 --- a/mozilla/modules/libpref/src/prefapi.cpp +++ b/mozilla/modules/libpref/src/prefapi.cpp @@ -16,6 +16,19 @@ * Reserved. */ + /** USAGE NOTE: + + + This file (prefapi.c) is being obsoleted, and functions previously declared + here are migrating to preffunc.cpp in this module. If you make changes + in this file, please be sure to check preffunc.cpp to ensure that similar + changes are made in that file. + + Currently Windows uses preffunc.cpp and the other platforms use prefapi.c. + + + **/ + #include "jsapi.h" #include "xp_core.h" #include "xp_mcom.h" @@ -159,7 +172,7 @@ void pref_Alert(char* msg); int pref_HashPref(const char *key, PrefValue value, PrefType type, PrefAction action); /* -- Platform specific function extern */ -#if !defined(XP_OS2) +#if !defined(XP_WIN) && !defined(XP_OS2) extern JSBool pref_InitInitialObjects(void); #endif @@ -217,7 +230,7 @@ int pref_OpenFile(const char* filename, XP_Bool is_error_fatal, XP_Bool verifyHa long fileLength; stats.st_size = 0; - if ( stat(filename, &stats) == -1 ) + if ( stat(filename, (struct stat *) &stats) == -1 ) return PREF_ERROR; fileLength = stats.st_size; @@ -1793,6 +1806,131 @@ PREF_NextChild(char *child_list, int *index) return child; } +/*---------------------------------------------------------------------------------------- +* pref_copyTree +* +* A recursive function that copies all the prefs in some subtree to +* another subtree. Either srcPrefix or dstPrefix can be empty strings, +* but not NULL pointers. Preferences in the destination are created if +* they do not already exist; otherwise the old values are replaced. +* +* Example calls: +* +* Copy all the prefs to another tree: pref_copyTree("", "temp", "") +* +* Copy all the prefs under mail. to newmail.: pref_copyTree("mail", "newmail", "mail") +* +--------------------------------------------------------------------------------------*/ +int pref_copyTree(const char *srcPrefix, const char *destPrefix, const char *curSrcBranch) +{ + int result = PREF_NOERROR; + + char* children = NULL; + + if ( PREF_CreateChildList(curSrcBranch, &children) == PREF_NOERROR ) + { + int index = 0; + int srcPrefixLen = XP_STRLEN(srcPrefix); + char* child = NULL; + + while ( (child = PREF_NextChild(children, &index)) != NULL) + { + int prefType; + char *destPrefName = NULL; + char *childStart = (srcPrefixLen > 0) ? (child + srcPrefixLen + 1) : child; + + XP_ASSERT( XP_STRNCMP(child, curSrcBranch, srcPrefixLen) == 0 ); + + if (*destPrefix > 0) + destPrefName = PR_smprintf("%s.%s", destPrefix, childStart); + else + destPrefName = PR_smprintf("%s", childStart); + + if (!destPrefName) + { + result = PREF_OUT_OF_MEMORY; + break; + } + + if ( ! PREF_PrefIsLocked(destPrefName) ) /* returns true if the prefs exists, and is locked */ + { + /* PREF_GetPrefType masks out the other bits of the pref flag, so we only + every get the values in the switch. + */ + prefType = PREF_GetPrefType(child); + + switch (prefType) + { + case PREF_STRING: + { + char *prefVal = NULL; + + result = PREF_CopyCharPref(child, &prefVal); + if (result == PREF_NOERROR) + result = PREF_SetCharPref(destPrefName, prefVal); + + XP_FREEIF(prefVal); + } + break; + + case PREF_INT: + { + int32 prefValInt; + + result = PREF_GetIntPref(child, &prefValInt); + if (result == PREF_NOERROR) + result = PREF_SetIntPref(destPrefName, prefValInt); + } + break; + + case PREF_BOOL: + { + XP_Bool prefBool; + + result = PREF_GetBoolPref(child, &prefBool); + if (result == PREF_NOERROR) + result = PREF_SetBoolPref(destPrefName, prefBool); + } + break; + + case PREF_ERROR: + /* this is probably just a branch. Since we can have both + a.b and a.b.c as valid prefs, this is OK. + */ + break; + + default: + /* we should never get here */ + XP_ASSERT(FALSE); + break; + } + + } /* is not locked */ + + XP_FREEIF(destPrefName); + + /* Recurse */ + if (result == PREF_NOERROR || result == PREF_VALUECHANGED) + result = pref_copyTree(srcPrefix, destPrefix, child); + } + + XP_FREE(children); + } + + return result; +} + + +PR_IMPLEMENT(int) +PREF_CopyPrefsTree(const char *srcRoot, const char *destRoot) +{ + XP_ASSERT(srcRoot != NULL); + XP_ASSERT(destRoot != NULL); + + return pref_copyTree(srcRoot, destRoot, srcRoot); +} + + /* Adds a node to the beginning of the callback list. */ PR_IMPLEMENT(void) PREF_RegisterCallback(const char *pref_node, @@ -2042,7 +2180,6 @@ pref_ErrorReporter(JSContext *cx, const char *message, { char *last; - int i, j, k, n; const char *s, *t; last = PR_sprintf_append(0, "An error occurred reading the startup configuration file. " diff --git a/mozilla/modules/libpref/src/win/res/prefdll.rc b/mozilla/modules/libpref/src/win/res/prefdll.rc index dceacfaca87..9daaee6f52d 100644 --- a/mozilla/modules/libpref/src/win/res/prefdll.rc +++ b/mozilla/modules/libpref/src/win/res/prefdll.rc @@ -1,22 +1,20 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - - +//* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +//* +//* The contents of this file are subject to the Netscape Public License +//* Version 1.0 (the "NPL"); you may not use this file except in +//* compliance with the NPL. You may obtain a copy of the NPL at +//* http://www.mozilla.org/NPL/ +//* +//* Software distributed under the NPL is distributed on an "AS IS" basis, +//* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +//* for the specific language governing rights and limitations under the +//* NPL. +//* +//* The Initial Developer of this code under the NPL is Netscape +//* Communications Corporation. Portions created by Netscape are +//* Copyright (C) 1998 Netscape Communications Corporation. All Rights +//* Reserved. +//* //Microsoft Developer Studio generated resource script. // @@ -67,12 +65,12 @@ BEGIN VALUE "Comments", "XP Preferences reflected via JavaScript\0" VALUE "CompanyName", "Netscape Communications Corp. \0" VALUE "FileDescription", "prefdll\0" - VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "FileVersion", "1.0.0.1\0" VALUE "InternalName", "prefdll\0" VALUE "LegalCopyright", "Copyright © 1996\0" VALUE "OriginalFilename", "prefdll.dll\0" VALUE "ProductName", "Netscape Communications Corp. prefdll\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "ProductVersion", "4.05\0" END END BLOCK "VarFileInfo" @@ -84,6 +82,334 @@ END #endif // !_MAC +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_LOGIN_DIALOG DIALOG DISCARDABLE 0, 0, 270, 156 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Profile Manager" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Start Communicator",IDOK,123,135,86,14 + COMBOBOX IDC_PROFILES,101,83,138,80,CBS_DROPDOWNLIST | + CBS_OWNERDRAWVARIABLE | CBS_HASSTRINGS | WS_VSCROLL | + WS_GROUP | WS_TABSTOP + EDITTEXT IDC_PASSWORD,101,104,138,12,ES_PASSWORD | ES_AUTOHSCROLL | + WS_GROUP + PUSHBUTTON "Edit Profiles...",IDC_PROFILE_EDIT,7,135,71,14 + PUSHBUTTON "Exit",IDCANCEL,213,135,50,14,WS_GROUP + LTEXT "If your personal profile doesn't exist on this machine, choosing\nGuest will prompt you for the name of your roaming server.", + IDC_STATIC,48,47,215,26 + CONTROL "",IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,7,7,32, + 32 + CONTROL "Welcome to Communicator",IDC_STATIC,"Static", + SS_LEFTNOWORDWRAP | WS_GROUP,48,7,215,8 + LTEXT "To access your personal profile, passwords, and certificates\nplease enter your profile name and password.", + IDC_STATIC,48,23,215,21 + LTEXT "Profile Name",IDC_PROFILE_NAME,48,85,49,8 + LTEXT "Password",IDC_PASSWORD_TEXT,48,106,32,8 +END + +IDD_NEWPROF_INTRO DIALOG DISCARDABLE 0, 0, 268, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Creating a New Profile" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "CREATING A NEW PROFILE",IDC_INTRO_TITLE,7,7,173,10,NOT + WS_GROUP + LTEXT "Communicator stores information about your settings, preferences, bookmarks, and stored messages in your personal profile.", + IDC_INTRO1,7,22,254,17 + LTEXT "If you are sharing this copy of Communicator with other users, you can use profiles to keep each user's information separate. To do this, each user should create his or her own profile and optionally protect it with a password.", + IDC_INTRO2,7,43,254,27 + LTEXT "If you are the only person using this copy of Communicator, you must create at least one profile. If you would like, you can create multiple profiles for yourself to store different sets of settings and preferences.", + IDC_INTRO3,7,73,254,26 + LTEXT "For example, you may want to have separate profiles for business and personal use.", + IDC_INTRO4,7,104,254,26 + LTEXT "To begin creating your profile, click Next.",IDC_INTRO5, + 7,136,254,11,NOT WS_GROUP +END + +IDD_NEWPROF_NAME DIALOG DISCARDABLE 0, 0, 235, 156 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Name and Email" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "To begin creating a new profile, enter the name and email address for the person whose profile is being created.", + IDC_NAME_INTRO,7,7,221,21 + LTEXT "This information will be saved in the preferences of the new profile.", + IDC_NAME_INTRO2,7,33,221,15 + LTEXT "Full Name:",IDC_STATIC,7,54,34,8 + EDITTEXT IDC_EDIT_NAME,7,66,120,14,ES_AUTOHSCROLL + LTEXT "(e.g. John Smith)",IDC_STATIC,134,68,54,8 + LTEXT "Email Address (if available):",IDC_STATIC,7,94,86,8 + EDITTEXT IDC_EDIT_ADDRESS,7,107,120,14,ES_AUTOHSCROLL + LTEXT "(e.g. jsmith@company.com)",IDC_STATIC,134,109,88,8 + LTEXT "Please click Next to continue",IDC_STATIC,7,141,93,8 +END + +IDD_NEWPROF_DIRS DIALOG DISCARDABLE 0, 0, 235, 156 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Directory Setup" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "If you create several profiles, you will be able to tell them apart by their names. You may use the name provided here or enter a different one.", + IDC_NAME_INTRO,7,7,221,21 + LTEXT "Profile Name:",IDC_STATIC,7,37,43,8 + EDITTEXT IDC_EDIT_PROFILE,7,49,120,14,ES_AUTOHSCROLL + LTEXT "Your user settings, preferences, bookmarks, and stored messages will be kept in the directory given below. We recommend that you use the default directory already listed.", + IDC_STATIC,7,74,221,28 + EDITTEXT IDC_EDIT_PROFILE_DIR,7,107,120,14,ES_AUTOHSCROLL + LTEXT "Please click Next to continue",IDC_STATIC,7,141,93,8 +END + +IDD_NEWPROF_SMTP DIALOG DISCARDABLE 0, 0, 235, 156 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Outgoing Mail Server Setup" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Communicator now has enough information to set up your basic profile. However, Communicator needs additional information if you want to send or receive email or use discussion groups.", + IDC_MAIL_INTRO1,7,7,221,29 + LTEXT "If you do not know the information requested, please contact your system administrator or Internet Service Provider.", + IDC_STATIC,7,35,221,19 + LTEXT "Click Finish if you want to start Communicator and continue entering your mail and discussion group information later.", + IDC_STATIC,7,131,221,18 + LTEXT "Click Next to continue entering information.", + IDC_STATIC,7,120,221,8 + EDITTEXT IDC_EDIT_SMTP_HOST,7,81,142,14,ES_AUTOHSCROLL + LTEXT "Outgoing mail (SMTP) server:",IDC_STATIC,7,68,93,8 +END + +IDD_NEWPROF_MSERVER DIALOG DISCARDABLE 0, 0, 235, 170 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Incoming Mail Server Setup" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "The information below is needed before you can receive mail. If you do not know the information requested, please contact your system administrator or Internet Service Provider.", + IDC_STATIC,7,7,221,26 + LTEXT "Click Finish if you want to start Communicator and continue entering your mail and discussion group information later.", + IDC_STATIC,7,145,221,18 + LTEXT "Click Next to continue entering information.", + IDC_STATIC,7,135,221,8 + LTEXT "Incoming Mail Server:",IDC_STATIC,7,66,69,8 + EDITTEXT IDC_EDIT_MAIL_SERVER,7,75,120,14,ES_AUTOHSCROLL + LTEXT "Mail server user name:",IDC_STATIC,7,37,72,8 + EDITTEXT IDC_EDIT_MAIL_USER,7,46,120,14,ES_AUTOHSCROLL + LTEXT "(e.g. jsmith)",IDC_STATIC,134,48,36,8 + LTEXT "Mail Server type:",IDC_STATIC,7,97,54,8 + CONTROL "&POP3",IDC_RADIO_POP,"Button",BS_AUTORADIOBUTTON,7,107, + 35,10 + CONTROL "&IMAP",IDC_RADIO_IMAP,"Button",BS_AUTORADIOBUTTON,7,119, + 33,10 +END + +IDD_NEWPROF_NNTP DIALOG DISCARDABLE 0, 0, 234, 170 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Discussion Groups Server" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "The information below is needed before you can read discussion groups. If you do not know the information requested, please contact your system administrator or Internet Service Provider.", + IDC_STATIC,7,7,220,26 + LTEXT "Click Finish to start Communicator using your new profile.", + IDC_STATIC,7,154,220,9 + LTEXT "&Port:",IDC_STATIC,7,67,16,8 + EDITTEXT IDC_EDIT_NEWS_PORT,26,64,38,14,ES_AUTOHSCROLL | + ES_NUMBER + LTEXT "&News (NNTP) server:",IDC_STATIC,7,37,68,8 + EDITTEXT IDC_EDIT_NEWS_SERVER,7,46,110,14,ES_AUTOHSCROLL + CONTROL "&Secure",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,74,66,41,10 +END + +IDD_NEWPROF_NETNAME DIALOG DISCARDABLE 0, 0, 235, 156 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Name and Email" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "To create a new profile, enter your name and email address. This information will be saved in the preferences of the new profile.", + IDC_NAME_INTRO,7,7,221,19 + LTEXT "Your profile will be called ""[profname]"".", + IDC_NAME_INTRO2,7,30,221,15 + LTEXT "Full Name:",IDC_STATIC,7,54,34,8 + EDITTEXT IDC_EDIT_NAME,7,66,120,14,ES_AUTOHSCROLL + LTEXT "(e.g. John Smith)",IDC_STATIC,134,68,54,8 + LTEXT "Email Address (if available):",IDC_STATIC,7,94,86,8 + EDITTEXT IDC_EDIT_ADDRESS,7,107,120,14,ES_AUTOHSCROLL + LTEXT "(e.g. jsmith@company.com)",IDC_STATIC,134,109,88,8 + LTEXT "Please click Finish to create your profile and start Communicator.", + IDC_STATIC,7,141,221,8 +END + +IDD_NEWPROF_NETINTRO DIALOG DISCARDABLE 0, 0, 250, 186 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Creating a New Profile" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "CREATING A NEW PROFILE",IDC_INTRO_TITLE,7,7,173,10,NOT + WS_GROUP + LTEXT "Communicator stores information about your settings, preferences, bookmarks, and stored messages in your personal profile.", + IDC_INTRO1,7,22,236,22 + LTEXT "If you like, you can create multiple profiles to store different sets of settings and preferences; for example, you may want to have separate profiles for business and personal use, or a profile for use while you are travelling.", + IDC_INTRO2,7,44,236,35,NOT WS_VISIBLE + LTEXT "To begin creating your profile, click Next.",IDC_INTRO4, + 7,168,196,11,NOT WS_GROUP +END + +IDD_LOGIN_GUEST DIALOG DISCARDABLE 0, 0, 241, 318 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Guest Login" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Login",IDOK,131,298,50,14 + PUSHBUTTON "Cancel",IDCANCEL,186,298,50,14 + EDITTEXT IDC_EDIT_NAME,67,56,153,13,ES_AUTOHSCROLL | WS_GROUP + EDITTEXT IDC_PASSWORD,67,72,153,13,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "Please enter your login information to retrieve your networked profile. You may also choose to store your remote profile information on this computer for easy access the next time you log in.", + IDC_GUEST_INTRO,7,7,227,28 + GROUPBOX "User Information",IDC_STATIC,7,40,227,71 + LTEXT "User Name:",IDC_STATIC,14,59,43,8 + LTEXT "Password:",IDC_STATIC,14,75,34,8 + PUSHBUTTON "Advanced >>",IDC_ADVANCED,7,117,50,14 + CONTROL "Remember my login information",IDC_STORE_LOCAL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,68,92,113,10 + CONTROL "LDAP Server (Netscape Directory Server)", + IDC_LDAP_SERVER,"Button",BS_AUTORADIOBUTTON | NOT + WS_VISIBLE | WS_GROUP | WS_TABSTOP,17,130,165,10 + CONTROL "HTTP Server (Netscape Enterprise Server)", + IDC_HTTP_SERVER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, + 17,180,165,10 + EDITTEXT IDC_LDAP_ADDRESS,89,144,114,13,ES_AUTOHSCROLL | WS_GROUP + EDITTEXT IDC_LDAP_SEARCHBASE,89,160,114,13,ES_AUTOHSCROLL | + WS_GROUP + EDITTEXT IDC_HTTP_ADDRESS,89,195,114,13,ES_AUTOHSCROLL + GROUPBOX "Server information",IDC_SERVER_INFO,7,114,227,101,NOT + WS_VISIBLE + LTEXT "Address:",IDC_STATIC,35,146,43,8 + LTEXT "Search Base:",IDC_STATIC,35,162,45,8 + LTEXT "Base URL:",IDC_STATIC,35,196,43,8 + GROUPBOX "Files/File Groups",IDC_STATIC,7,220,227,72 + CONTROL "Bookmarks",IDC_BOOKMARKS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,27,235,81,10 + CONTROL "Cookies",IDC_COOKIES,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,27,248,81,10 + CONTROL "Mail Filters",IDC_FILTERS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,27,261,81,10 + CONTROL "Address Book",IDC_ADDBOOK,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,27,274,81,10 + CONTROL "User Preferences",IDC_SUGGESTIONS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,127,235,81,10 + CONTROL "History",IDC_HISTORY,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,127,248,81,10 + CONTROL "Java Security",IDC_JAVA,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,127,261,81,10 + CONTROL "Certificates",IDC_SECURITY_TYPE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,127,274,81,10 +END + +IDD_NEWPROF_REMOTEINTRO DIALOG DISCARDABLE 0, 0, 268, 188 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Creating a New Profile" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "CREATING A NEW PROFILE",IDC_INTRO_TITLE,7,7,173,10,NOT + WS_GROUP + LTEXT "Communicator stores information about your settings, preferences, bookmarks, and stored messages in your personal profile.", + IDC_INTRO1,7,22,254,17 + LTEXT "Because you are using a remote profile, your can access your profile information from other computers. However, if you use this computer often, Communicator can store some of your profile information on this computer.", + IDC_INTRO2,7,43,254,27 + LTEXT "Storing your profile information on this computer will make it more convenient to log in to your remote profile and will allow you to access your remote profile while your are offline or not connected to a network.", + IDC_INTRO3,7,73,254,26 + LTEXT "To begin creating your profile, click Next.",IDC_INTRO5, + 7,170,254,11,NOT WS_GROUP +END + +IDD_UPDATE_STATUS DIALOG DISCARDABLE 0, 0, 250, 74 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Updating files to new profile directory..." +FONT 8, "MS Sans Serif" +BEGIN + CTEXT "",IDC_FILENAME_AREA,11,17,230,13 + RTEXT "Category",IDC_CATEGORY,167,6,66,9 + CTEXT "Note: If you have large mail or news folders, some of these operations may take a while. Please be patient.", + IDC_TEXT1,19,54,208,19 +END + +IDD_NEWPROF_COUNTRY DIALOG DISCARDABLE 0, 0, 235, 156 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Country Selection" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Click Finish to start Communicator using your new profile.", + IDC_STATIC,7,140,220,9 + LTEXT "Communicator can preset content depending on what country you live in. Please chose your country from the choices below:", + IDC_STATIC,7,7,215,24 + COMBOBOX IDC_COUNTRY,50,47,155,30,CBS_DROPDOWN | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + LTEXT "Country:",IDC_STATIC,7,51,27,8 +END + +IDD_PROF_PWONLY DIALOG DISCARDABLE 0, 0, 188, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Profile Password" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,77,74,50,14 + PUSHBUTTON "Exit",IDCANCEL,131,74,50,14 + EDITTEXT IDC_PASSWORD,48,39,132,14,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "Password:",IDC_STATIC,7,41,34,8 + LTEXT "Please enter the password for this profile or choose Exit to exit Communicator.", + IDC_STATIC,7,7,174,18 +END + +IDD_LOGIN_PROFMGR DIALOG DISCARDABLE 0, 0, 247, 185 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Profile Manager" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Return to Communicator",IDOK,99,164,86,14 + PUSHBUTTON "Cancel",IDCANCEL,190,164,50,14 + LISTBOX IDC_LIST1,7,78,162,73,LBS_SORT | LBS_OWNERDRAWVARIABLE | + LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | + WS_TABSTOP + PUSHBUTTON "New...",IDC_NEW,179,79,61,14 + PUSHBUTTON "Rename...",IDC_RENAME,179,96,61,14,WS_DISABLED + PUSHBUTTON "Delete...",IDC_DELETE,179,130,61,14 + PUSHBUTTON "Change Password",IDC_EDIT_PW,179,113,61,14,WS_DISABLED + LTEXT "Communicator stores information about your settings, preferences, bookmarks, and stored messages in your personal profile.", + IDC_STATIC,7,7,233,16 + LTEXT "Click New to create a new profile, or select a profile and click the appropriate button to rename, delete, or change its pasword.", + IDC_STATIC,7,26,233,17 + LTEXT "When you are finished, click Return to Communicator to select a profile and start Communicator.", + IDC_STATIC,7,49,233,19 +END + +IDD_NEWPROF_UPGRADE DIALOG DISCARDABLE 0, 0, 237, 157 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Creating a New Profile" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "An older version of Netscape Navigator was found on your machine. Would you like to move or copy your existing user files into your profile directory, or would you like to ignore your existing files?", + IDC_STATIC,7,7,220,30 + CONTROL "Move my existing user files to the new profile directory.", + IDC_RADIO_MOVE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,32, + 40,195,11 + CONTROL "Copy my existing user files to the new profile directory.", + IDC_RADIO_COPY,"Button",BS_AUTORADIOBUTTON,32,73,179,12 + CONTROL "Ignore my existing files. Create a new profile from scratch.", + IDC_RADIO_NEWPROFILE,"Button",BS_AUTORADIOBUTTON,31,111, + 199,11 + LTEXT "This will allow both Netscape Communicator and any older versions of the software to share the files. ", + IDC_STATIC,46,53,176,18 + LTEXT "Requires additonal disk space and changes will diverge between the two copies.", + IDC_STATIC,46,87,161,18 + LTEXT "Click Finish to move/copy files and start Communicator.", + IDC_FINISHTEXT,7,142,223,8,NOT WS_VISIBLE + LTEXT "Click Next to create a new profile.",IDC_NEXTTEXT,7,142, + 223,8,NOT WS_VISIBLE +END + + #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // @@ -109,6 +435,74 @@ END #endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_HEAD_BITMAP BITMAP DISCARDABLE "head.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_PROF_PWONLY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 181 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END + + IDD_LOGIN_PROFMGR, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 240 + TOPMARGIN, 7 + BOTTOMMARGIN, 178 + END + + IDD_NEWPROF_UPGRADE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 230 + TOPMARGIN, 7 + BOTTOMMARGIN, 150 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_INSUFFICIENT_DISKSPACE_COPY + "Insufficient disk space!\n\nUnable to copy %s:\n %s\nto directory:\n %s\n\nPlease free up %s MB of disk space and then press O.K.\n\nIf you press Cancel, this directory will not get copied and you will not be able to access your old data files." + IDS_INSUFFICIENT_DISKSPACE_MOVE + "Insufficient disk space!\n\nUnable to move %s:\n %s\nto directory:\n %s\n\nPlease free up %s MB of disk space and then press O.K.\n\nIf you press Cancel, this directory will not get moved and you will not be able to access your old data files." + IDS_UNABLETRANSFER_SUBDIR + """Unable to copy %s.\n\nDestination directory is a subdirectory of the source directory.""" + IDS_MAIL_DIR "Mail directory" + IDS_NEWS_DIR "News directory" + IDS_CACHE_DIR "Cache directory" + IDS_COPYING_FILE "Copying file: " + IDS_MOVING_FILE "Moving file: " + IDS_GENERAL_FILES "General Files" + IDS_SECURITY_FILES "Security Files" + IDS_NETWORK_FILES "Network Files" + IDS_DEFAULT_FILES "Default Files" + IDS_DELETING_PROFILE "Deleting a profile will remove the item from your Communicator login and can not be undone. If you proceed with the deletion, you may also choose to have Communicator delete your data files, including your saved mail and certificates. Would you like to delete your profile? (For now, choose Yes to delete the profile and files, no for the profile but to leave the files, and Cancel to not delete)." +END + #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// @@ -120,7 +514,7 @@ END // Generated from the TEXTINCLUDE 3 resource. // -#include "init.rc" + ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff --git a/mozilla/modules/libpref/src/win/res/resource.h b/mozilla/modules/libpref/src/win/res/resource.h index 48905274b9a..1886bc31bcc 100644 --- a/mozilla/modules/libpref/src/win/res/resource.h +++ b/mozilla/modules/libpref/src/win/res/resource.h @@ -20,14 +20,104 @@ // Microsoft Developer Studio generated include file. // Used by prefdll.rc // +#define IDS_INSUFFICIENT_DISKSPACE_COPY 1 +#define IDS_INSUFFICIENT_DISKSPACE_MOVE 2 +#define IDS_UNABLETRANSFER_SUBDIR 3 +#define IDS_MAIL_DIR 4 +#define IDS_NEWS_DIR 5 +#define IDS_CACHE_DIR 6 +#define IDS_COPYING_FILE 7 +#define IDS_MOVING_FILE 8 +#define IDS_GENERAL_FILES 9 +#define IDS_SECURITY_FILES 10 +#define IDS_NETWORK_FILES 11 +#define IDS_DEFAULT_FILES 12 +#define IDS_DELETING_PROFILE 13 +#define IDB_HEAD_BITMAP 102 +#define IDC_PROFILE_EDIT 1000 +#define IDC_PASSWORD 1001 +#define IDC_PROFILES 1002 +#define IDC_PROFILE_NAME 1003 +#define IDC_COMBO1 1004 +#define IDC_PASSWORD_TEXT 1004 +#define IDC_INTRO_TITLE 1007 +#define IDC_INTRO1 1008 +#define IDC_INTRO2 1009 +#define IDC_INTRO3 1010 +#define IDC_INTRO4 1011 +#define IDC_INTRO5 1012 +#define IDC_NAME_INTRO 1013 +#define IDC_NAME_INTRO2 1014 +#define IDC_EDIT_NAME 1015 +#define IDC_EDIT_ADDRESS 1016 +#define IDC_EDIT_PROFILE 1017 +#define IDC_EDIT_PROFILE_DIR 1018 +#define IDC_MAIL_INTRO1 1019 +#define IDC_EDIT_MAIL_USER 1020 +#define IDC_EDIT_SMTP_HOST 1021 +#define IDC_EDIT_MAIL_SERVER 1022 +#define IDC_RADIO_POP 1023 +#define IDC_RADIO_IMAP 1024 +#define IDC_EDIT_NEWS_SERVER 1025 +#define IDC_EDIT_NEWS_PORT 1026 +#define IDC_CHECK1 1027 +#define IDC_GUEST_INTRO 1028 +#define IDC_STORE_LOCAL 1029 +#define IDC_SERVER_INFO 1030 +#define IDC_LDAP_SERVER 1031 +#define IDC_LDAP_ADDRESS 1032 +#define IDC_LDAP_SEARCHBASE 1033 +#define IDC_HTTP_SERVER 1034 +#define IDC_LIST1 1034 +#define IDC_HTTP_ADDRESS 1035 +#define IDC_NEW 1035 +#define IDC_BOOKMARKS 1036 +#define IDC_RENAME 1036 +#define IDC_COOKIES 1037 +#define IDC_DELETE 1037 +#define IDC_FILTERS 1038 +#define IDC_EDIT_PW 1038 +#define IDC_ADDBOOK 1039 +#define IDC_SELECTEDBOOKMARKS 1040 +#define IDC_SUGGESTIONS 1041 +#define IDC_JAVA 1042 +#define IDC_SECURITY_TYPE 1043 +#define IDC_ADVANCED 1044 +#define IDC_FILENAME_AREA 1045 +#define IDC_CATEGORY 1046 +#define IDC_TEXT1 1048 +#define IDC_COUNTRY 1049 +#define IDC_NEXTTEXT 1050 +#define IDC_FINISHTEXT 1051 +#define IDC_HISTORY 1052 +#define IDC_RADIO_COPY 1450 +#define IDC_RADIO_NEWPROFILE 1451 +#define IDC_RADIO_MOVE 1452 +#define IDD_LOGIN_DIALOG 3101 +#define IDD_NEWPROF_INTRO 3106 +#define IDD_NEWPROF_NAME 3107 +#define IDD_NEWPROF_DIRS 3108 +#define IDD_NEWPROF_SMTP 3109 +#define IDD_NEWPROF_MSERVER 3110 +#define IDD_NEWPROF_NNTP 3111 +#define IDD_NEWPROF_NETINTRO 3112 +#define IDD_NEWPROF_NETNAME 3113 +#define IDD_LOGIN_GUEST 3114 +#define IDD_NEWPROF_REMOTEINTRO 3115 +#define IDD_PROFILE_UPGRADE_STATUS 3116 +#define IDD_UPDATE_STATUS 3116 +#define IDD_NEWPROF_COUNTRY 3117 +#define IDD_PROF_PWONLY 3118 +#define IDD_LOGIN_PROFMGR 3119 +#define IDD_NEWPROF_UPGRADE 3120 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 3121 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_CONTROL_VALUE 109 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/mozilla/modules/libpref/src/win/winpref.js b/mozilla/modules/libpref/src/win/winpref.js index 51a1bbb5cc5..48d1ec391e0 100644 --- a/mozilla/modules/libpref/src/win/winpref.js +++ b/mozilla/modules/libpref/src/win/winpref.js @@ -18,10 +18,10 @@ platform.windows = true; -pref("browser.bookmark_window_showwindow", 1); // SW_NORMAL -pref("mailnews.folder_window_showwindow", 1); // SW_NORMAL -pref("mailnews.thread_window_showwindow", 1); // SW_NORMAL -pref("mailnews.message_window_showwindow", 1); // SW_NORMAL +pref("browser.bookmark_window_showwindow", 1); // SW_NORMAL +pref("mailnews.folder_window_showwindow", 1); // SW_NORMAL +pref("mailnews.thread_window_showwindow", 1); // SW_NORMAL +pref("mailnews.message_window_showwindow", 1); // SW_NORMAL pref("browser.bookmark_columns_win", ""); pref("mailnews.folder_columns_win", ""); @@ -32,7 +32,7 @@ pref("news.category_columns_win", ""); pref("custtoolbar.personal_toolbar_folder", "x234htz7"); pref("custtoolbar.has_toolbar_folder", true); -pref("custtoolbar.personal_toolbar.Version", ""); +pref("custtoolbar.personal_toolbar.Version", ""); pref("custtoolbar.Browser.Navigation_Toolbar.position", 0); pref("custtoolbar.Browser.Navigation_Toolbar.showing", true); pref("custtoolbar.Browser.Navigation_Toolbar.open", true); @@ -81,10 +81,10 @@ pref("intl.font2.win.fixed_font", "Courier New"); pref("intl.font2.win.fixed_size", 10); pref("intl.font260.win.mimecharset", "Shift_JIS"); -pref("intl.font260.win.prop_font", "Times New Roman"); -pref("intl.font260.win.prop_size", 10); -pref("intl.font260.win.fixed_font", "Courier New"); -pref("intl.font260.win.fixed_size", 10); +pref("intl.font260.win.prop_font", "Times New Roman"); +pref("intl.font260.win.prop_size", 10); +pref("intl.font260.win.fixed_font", "Courier New"); +pref("intl.font260.win.fixed_size", 10); pref("intl.font263.win.mimecharset", "big5"); pref("intl.font263.win.prop_font", "Times New Roman"); @@ -140,9 +140,15 @@ pref("intl.font254.win.prop_size", 12); pref("intl.font254.win.fixed_font", "Courier New"); pref("intl.font254.win.fixed_size", 10); -pref("taskbar.x", -1); +pref("taskbar.x", -1); pref("taskbar.y", -1); pref("taskbar.floating", true); pref("taskbar.horizontal", false); pref("taskbar.ontop", true); pref("taskbar.button_style", -1); + +pref("netinst.profile.show_profile_wizard", true); + +//The following pref is internal to Communicator. Please +//do *not* place it in the docs... +pref("netinst.profile.show_dir_overwrite_msg", true); diff --git a/mozilla/modules/makefile.win b/mozilla/modules/makefile.win index 99e3adece45..a219da26cdc 100644 --- a/mozilla/modules/makefile.win +++ b/mozilla/modules/makefile.win @@ -37,7 +37,7 @@ include <$(DEPTH)/config/liteness.mak> #// #// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...) #// (these must come before the common makefiles are included) -#// +#// #// DIRS - There are subdirectories to process #// #//------------------------------------------------------------------------ @@ -74,6 +74,10 @@ DIRS= \ rdf \ schedulr \ xml \ +!ifdef MOZ_CALENDAR + calendar \ + libnls \ +!endif oji #//------------------------------------------------------------------------ diff --git a/mozilla/modules/progress/public/pw_public.h b/mozilla/modules/progress/public/pw_public.h index a5ac1932581..d2f8528b139 100644 --- a/mozilla/modules/progress/public/pw_public.h +++ b/mozilla/modules/progress/public/pw_public.h @@ -122,6 +122,9 @@ void PW_DestroyProgressContext(MWContext * context); void PW_AssociateWindowWithContext(MWContext * context, pw_ptr pw); +pw_ptr PW_GetAssociatedWindowForContext(MWContext *context); + XP_END_PROTOS #endif + diff --git a/mozilla/modules/progress/src/pw_mac.cpp b/mozilla/modules/progress/src/pw_mac.cpp index 3ee886243b4..1a6ee4ed197 100644 --- a/mozilla/modules/progress/src/pw_mac.cpp +++ b/mozilla/modules/progress/src/pw_mac.cpp @@ -31,13 +31,14 @@ #include "CPatternProgressBar.h" #include "UDesktop.h" -#define PW_WINDOW_ID 5102 +#define kProgressStandardWindowID 5050 +#define kProgressModalWindowID 5051 class CProgressMac: public LListener { public: - LWindow * fWindow; - LCaption * fLine1, * fLine2, * fLine3; + LWindow *fWindow; + LCaption *fLine1, *fLine2, *fLine3; CPatternProgressBar * fProgress; PW_CancelCallback fCancelcb; @@ -73,36 +74,26 @@ public: CProgressMac::CProgressMac(PW_WindowType type) { + ResIDT windowID; + fCancelcb = NULL; fCancelClosure = NULL; - -// Create the window -// Our default resource stores an application modal, need to change the resource -// before loading it in - - - SWINDResourceH theWIND = NULL; - - if ( type == pwStandard ) + + switch (type) { - theWIND = (SWINDResourceH) ::GetResource('WIND', PW_WINDOW_ID); - if ( theWIND ) - { - HLock( (Handle)theWIND ); - (*theWIND)->procID = 4; - } + case pwApplicationModal: + windowID = kProgressModalWindowID; + break; + case pwStandard: + windowID = kProgressStandardWindowID; + break; + default: + XP_ASSERT(false); // invalid window type } - LCommander::SetDefaultCommander(CFrontApp::GetApplication()); - fWindow = LWindow::CreateWindow( PW_WINDOW_ID, NULL ); + fWindow = LWindow::CreateWindow( windowID, (type == pwApplicationModal) ? NULL : LCommander::GetTopCommander()); ThrowIfNil_(fWindow); - if ( type == pwStandard ) - { - (*theWIND)->procID = 5; // revert - HUnlock( (Handle)theWIND ); - } - fLine1 = (LCaption*)fWindow->FindPaneByID('LIN1'); fLine2 = (LCaption*)fWindow->FindPaneByID('LIN2'); fLine3 = (LCaption*)fWindow->FindPaneByID('LIN3'); @@ -291,3 +282,4 @@ void PW_SetProgressValue(pw_ptr pw, int32 value) } #pragma export off + diff --git a/mozilla/modules/progress/src/pw_win.cpp b/mozilla/modules/progress/src/pw_win.cpp index fed23e7be48..3b0206a18f0 100644 --- a/mozilla/modules/progress/src/pw_win.cpp +++ b/mozilla/modules/progress/src/pw_win.cpp @@ -28,6 +28,29 @@ #include "winli.h" #include "cast.h" +/* XXX - Talk to Dhiren, He'll need to deal with this in merge */ +#ifndef MOZ_LOC_INDEP +pw_ptr PW_Create( MWContext * parent, /* Parent window, can be NULL */ + PW_WindowType type /* What kind of window ? Modality, etc */ + ) +{ + return NULL; +} + +void PW_SetCancelCallback(pw_ptr pw, + PW_CancelCallback cancelcb, + void * cancelClosure){} +void PW_Show(pw_ptr pw){} +void PW_Hide(pw_ptr pw){} +void PW_Destroy(pw_ptr pw){} +void PW_SetWindowTitle(pw_ptr pw, const char * title){} +void PW_SetLine1(pw_ptr pw, const char * text){} +void PW_SetLine2(pw_ptr pw, const char * text){} +void PW_SetProgressText(pw_ptr pw, const char * text){} +void PW_SetProgressRange(pw_ptr pw, int32 minimum, int32 maximum){} +void PW_SetProgressValue(pw_ptr pw, int32 value){} + +#else pw_ptr PW_Create( MWContext * parent, /* Parent window, can be NULL */ PW_WindowType type /* What kind of window ? Modality, etc */ ) @@ -153,4 +176,5 @@ void PW_SetProgressValue(pw_ptr pw, int32 value) } #endif +#endif diff --git a/mozilla/modules/progress/src/pwcommon.cpp b/mozilla/modules/progress/src/pwcommon.cpp index 28f15fc3c70..9284585c00d 100644 --- a/mozilla/modules/progress/src/pwcommon.cpp +++ b/mozilla/modules/progress/src/pwcommon.cpp @@ -42,8 +42,7 @@ char * pw_PromptPassword(MWContext * context, const char * Msg); void pw_EnableClicking(MWContext * context); void pw_AllConnectionsComplete(MWContext * context); void pw_SetProgressBarPercent(MWContext *context, int32 percent); -void pw_SetCallNetlibAllTheTime(MWContext *context); -void pw_ClearCallNetlibAllTheTime(MWContext *context); + /* This struct encapsulates the data we need to store in our progress context */ @@ -80,8 +79,8 @@ MWContext * PW_CreateProgressContext() if (newMWContext == NULL) return NULL; -// XP_AddContextToList(newMWContext); newMWContext->type = MWContextProgressModule; + XP_AddContextToList(newMWContext); XP_InitializeContext(newMWContext); // Assign all the functions newMWContext->funcs = (ContextFuncs*) XP_ALLOC(sizeof(ContextFuncs)); @@ -102,11 +101,8 @@ MWContext * PW_CreateProgressContext() newMWContext->funcs->EnableClicking = pw_EnableClicking; newMWContext->funcs->AllConnectionsComplete = pw_AllConnectionsComplete; newMWContext->funcs->SetProgressBarPercent = pw_SetProgressBarPercent; - newMWContext->funcs->SetCallNetlibAllTheTime = pw_SetCallNetlibAllTheTime; - newMWContext->funcs->ClearCallNetlibAllTheTime = pw_ClearCallNetlibAllTheTime; - - newMWContext->mime_data = (struct MimeDisplayData *)p_context; /* Hackily overloading a part of MWContext */ + newMWContext->prInfo = (PrintInfo *)p_context; /* Hackily overloading a part of MWContext */ return newMWContext; } @@ -114,8 +110,8 @@ void PW_DestroyProgressContext(MWContext * context) { if (context) { -// XP_RemoveContextFromList(context); - pw_ptr pw = ((pw_environment *)(context->mime_data))->progressWindow; + XP_RemoveContextFromList(context); + pw_ptr pw = ((pw_environment *)(context->prInfo))->progressWindow; XP_FREEIF( context->funcs); XP_FREEIF(context); } @@ -123,7 +119,7 @@ void PW_DestroyProgressContext(MWContext * context) void PW_AssociateWindowWithContext(MWContext * context, pw_ptr pw) { - pw_environment * e = (pw_environment *)(context->mime_data); + pw_environment * e = (pw_environment *)(context->prInfo); XP_Bool doReset; if (context->type != MWContextProgressModule) @@ -140,6 +136,19 @@ void PW_AssociateWindowWithContext(MWContext * context, pw_ptr pw) } } +pw_ptr PW_GetAssociatedWindowForContext(MWContext *context) +{ + pw_environment * e = (pw_environment *)(context->prInfo); + + if (context->type != MWContextProgressModule) + { + XP_ASSERT(FALSE); + return NULL; + } + + return e->progressWindow; +} + #ifdef XP_MAC #pragma export off #endif @@ -147,7 +156,7 @@ void PW_AssociateWindowWithContext(MWContext * context, pw_ptr pw) void pw_Progress(MWContext * cx, const char *msg) { - pw_ptr pw = ((pw_environment *)(cx->mime_data))->progressWindow; + pw_ptr pw = ((pw_environment *)(cx->prInfo))->progressWindow; if (pw) PW_SetLine2(pw, msg); } @@ -159,7 +168,7 @@ void pw_Alert(MWContext * /*cx*/, const char *msg) void pw_GraphProgressInit(MWContext *context, URL_Struct* /*URL_s*/, int32 content_length) { - pw_environment * pe = (pw_environment *)context->mime_data; + pw_environment * pe = (pw_environment *)context->prInfo; pe->outstandingURLs += 1; @@ -170,11 +179,16 @@ void pw_GraphProgressInit(MWContext *context, URL_Struct* /*URL_s*/, int32 conte if (pe->outstandingURLs == 1) /* First URL got started, set the start time */ pe->start_time_secs = XP_TIME(); + + if ( pe->progressWindow ) + { + PW_SetProgressRange( pe->progressWindow, 0, pe->total_bytes); + } } void pw_GraphProgressDestroy(MWContext *context, URL_Struct* /*URL_s*/, int32 /*content_length*/, int32 /*total_bytes_read*/) { - pw_environment * pe = (pw_environment *)context->mime_data; + pw_environment * pe = (pw_environment *)context->prInfo; pe->outstandingURLs -= 1; if ( pe->outstandingURLs == 0) @@ -192,62 +206,98 @@ void pw_GraphProgressDestroy(MWContext *context, URL_Struct* /*URL_s*/, int32 /* } } -void pw_GraphProgress(MWContext *context, URL_Struct* /*URL_s*/, int32 /*bytes_received*/, int32 bytes_since_last_time, int32 /*content_length*/) +void pw_GraphProgress(MWContext *context, URL_Struct* /*URL_s*/, int32 /*bytes_received*/, int32 bytes_since_last_time, int32 content_length) { - pw_environment * pe = (pw_environment *)context->mime_data; + pw_environment * pe = (pw_environment *)context->prInfo; const char * progressText; pe->bytes_received += bytes_since_last_time; if (pe->progressWindow) { - progressText = XP_ProgressText( pe->hasUnknownSizeURLs ? 0 : pe->total_bytes, + // should document the use of content length, may need another for li verify. + if (content_length == -2) { + char * output = NULL; + output = (char*) XP_ALLOC( 300 ); + if ( !output ) { + progressText= NULL; + PW_SetLine2( pe->progressWindow, progressText); + } else { + // REMIND put the text in the xp strings bucket for l10n + sprintf(output, "Synchronizing item %d of %d.", pe->bytes_received,pe->total_bytes); + PW_SetLine2( pe->progressWindow, output); + if (pe->total_bytes > 0) { + sprintf(output, "%d%%.", (pe->bytes_received * 100) / pe->total_bytes); + PW_SetProgressText( pe->progressWindow, output); + } + XP_FREE(output); + } + } + else { + progressText = XP_ProgressText( pe->hasUnknownSizeURLs ? 0 : pe->total_bytes, pe->bytes_received, pe->start_time_secs, XP_TIME()); - PW_SetProgressText( pe->progressWindow, progressText); + PW_SetProgressText( pe->progressWindow, progressText); + } + + PW_SetProgressValue( pe->progressWindow, pe->bytes_received ); } } void pw_SetProgressBarPercent(MWContext *context, int32 percent) { - pw_environment * pe = (pw_environment *)context->mime_data; + pw_environment * pe = (pw_environment *)context->prInfo; if (pe->progressWindow) { PW_SetProgressValue( pe->progressWindow, percent); } } -XP_Bool pw_Confirm(MWContext* /*context*/, const char* /*Msg*/) +XP_Bool pw_Confirm(MWContext* context, const char* msg) { +//#if defined(XP_MAC) || defined(XP_UNIX) +// return XP_Confirm( context, msg ); +//#else XP_ASSERT(FALSE); return FALSE; -// return FE_Confirm(NULL, Msg); +//#endif } -char* pw_Prompt(MWContext * /*context*/, const char * /*Msg*/, const char * /*dflt*/) +char* pw_Prompt(MWContext * /*context*/, const char * Msg, const char * dflt) { +//#if defined(XP_MAC) +// return XP_Prompt(NULL, Msg, dflt); +//#else XP_ASSERT(FALSE); return NULL; -// return FE_Prompt(NULL, Msg, dflt); +//#endif } char* pw_PromptWithCaption(MWContext * /*context */, const char * /* caption */, const char * /*Msg*/, const char * /*dflt*/) { + XP_ASSERT(FALSE); return NULL; // FE_PromptWithCaption(NULL, caption, Msg, dflt); } -XP_Bool pw_PromptUsernameAndPassword(MWContext *,const char * /* prompt */,char ** /* username */ , char ** /* password */) +XP_Bool pw_PromptUsernameAndPassword(MWContext * c,const char * prompt,char ** username, char ** password) { - //return FE_PromptUsernameAndPassword(NULL, prompt, username, password); +//#if defined(XP_MAC) || defined(XP_UNIX) +// return XP_PromptUsernameAndPassword(c, prompt, username, password); +//#else + XP_ASSERT(FALSE); return FALSE; +//#endif } -char * pw_PromptPassword(MWContext * /*context*/, const char * /*Msg*/) +char * pw_PromptPassword(MWContext *context, const char * Msg) { - // return FE_PromptPassword(NULL, Msg); +//#if defined(XP_MAC) || defined(XP_UNIX) +// return XP_PromptPassword(context, Msg); +//#else + XP_ASSERT(FALSE); return NULL; +//#endif } - void pw_EnableClicking(MWContext * /*context*/) { } @@ -256,13 +306,3 @@ void pw_AllConnectionsComplete(MWContext * /*context*/) { } -void pw_SetCallNetlibAllTheTime(MWContext * /*context*/) -{ - XP_ASSERT(FALSE); -} - -void pw_ClearCallNetlibAllTheTime(MWContext * /*context*/) -{ - XP_ASSERT(FALSE); -} - diff --git a/mozilla/modules/rdf/Makefile b/mozilla/modules/rdf/Makefile index 34c7162e53c..3595be9482a 100644 --- a/mozilla/modules/rdf/Makefile +++ b/mozilla/modules/rdf/Makefile @@ -4,4 +4,6 @@ DEPTH = ../.. DIRS = classes include src +INCLUDE = $(INCLUDE) -I$(DEPTH)/modules/libimg/public + include $(DEPTH)/config/rules.mk diff --git a/mozilla/modules/rdf/macbuild/RDF.Prefix b/mozilla/modules/rdf/macbuild/RDF.Prefix index 3a9d3a492a2..cb9c171b169 100644 --- a/mozilla/modules/rdf/macbuild/RDF.Prefix +++ b/mozilla/modules/rdf/macbuild/RDF.Prefix @@ -23,5 +23,9 @@ // // +<<<<<<< RDF.Prefix #include "MacPrefix_debug.h" +======= +#include "MacPrefix.h" +>>>>>>> 3.1.16.2 #include "RDFConfig.h" diff --git a/mozilla/modules/rdf/src/Makefile b/mozilla/modules/rdf/src/Makefile index a8ce7f17314..28db70a3bcb 100644 --- a/mozilla/modules/rdf/src/Makefile +++ b/mozilla/modules/rdf/src/Makefile @@ -24,7 +24,7 @@ MODULE = rdf LIBRARY_NAME = $(LITE_PREFIX)rdf LIBXP = $(DIST)/lib/libxp.$(LIB_SUFFIX) -REQUIRES = nspr dbm java js htmldlgs util img layer pref +REQUIRES = nspr dbm java js htmldlgs util img layer pref ldap JNI_GEN = netscape.rdf.core.NativeRDF netscape.rdf.core.NativeRDFEnumeration diff --git a/mozilla/modules/rdf/src/ldap2rdf.c b/mozilla/modules/rdf/src/ldap2rdf.c index 7b6ffcb6063..5904ae21e2f 100644 --- a/mozilla/modules/rdf/src/ldap2rdf.c +++ b/mozilla/modules/rdf/src/ldap2rdf.c @@ -22,12 +22,15 @@ For more information on RDF, look at the RDF section of www.mozilla.org */ +/* + XXX Someone needs to get this up to speed again +*/ +#if 0 #ifdef MOZ_LDAP #include "ldap2rdf.h" #include "utils.h" - /* statics */ static PRHashTable *ldap2rdfHash; static PRHashTable *invldap2rdfHash; @@ -39,7 +42,7 @@ static PRBool ldap2rdfInitedp = 0; RDFT MakeLdapStore (char* url) { - RDF_Translator ntr = (RDF_Translator)getMem(sizeof(RDF_TranslatorStruct)); + RDFT ntr = (RDFT)getMem(sizeof(RDF_TranslatorStruct)); ntr->assert = ldapAssert; ntr->unassert = ldapUnassert; ntr->getSlotValue = ldapGetSlotValue; @@ -543,3 +546,5 @@ ldapContainerp (RDF_Resource u) #endif /* MOZ_LDAP */ +#endif + diff --git a/mozilla/modules/rdf/src/makefile.win b/mozilla/modules/rdf/src/makefile.win index 22eafdc4e26..bf91429c6c2 100644 --- a/mozilla/modules/rdf/src/makefile.win +++ b/mozilla/modules/rdf/src/makefile.win @@ -45,7 +45,7 @@ SPFPROG = .\$(OBJDIR)\spf2ldif.exe MODULE=rdf LIBRARY_NAME=rdf -REQUIRES=nspr dbm java js htmldlgs util img layer pref +REQUIRES=nspr dbm java js htmldlgs util img layer pref ldap C_OBJS=.\$(OBJDIR)\vocab.obj \ .\$(OBJDIR)\mcf.obj \ @@ -82,6 +82,7 @@ LINCS=-I$(XPDIST)\public\nspr -I$(XPDIST)\public\dbm \ -I$(XPDIST)\public\java -I$(XPDIST)\public\js \ -I$(XPDIST)\public\htmldlgs -I$(XPDIST)\public\util \ -I$(XPDIST)\public\img -I$(XPDIST)\public\layer \ + -I$(XPDIST)\public\ldap \ -I$(XPDIST)\public\pref !endif diff --git a/mozilla/modules/security/freenav/rosetta.h b/mozilla/modules/security/freenav/rosetta.h index 477b0751026..c8816d9990b 100644 --- a/mozilla/modules/security/freenav/rosetta.h +++ b/mozilla/modules/security/freenav/rosetta.h @@ -15,6 +15,66 @@ * Reserved. */ +#define HG87729 +#define HG92192 FALSE +#define HG21872 +#define HG12021 FALSE +#define HG92725 +#define HG83738 +#define HG29292 +#define HG28926 +#define HG29822 +#define HG29832 +#define HG83734 +#define HG73252 +#define HG93733 +#define HG29828 +#define HG38276 +#define HG36527 xpNewsRC +#define HG98333 FALSE +#define HG73267 FALSE +#define HG87366 if (!port) port = NEWS_PORT; +#define HG83765 +#define HG37630 +#define HG83178 +#define HG78636 +#define HG72688 FALSE +#define HG83737 +#define HG71654 +#define HG93663 +#define HG73622 +#define HG87355 +#define HG25525 +#define HG26477 +#define HG78365 +#define HG89732 +#define HG87535 +#define HG87963 +#define HG91476 +#define HG78271 +#define HG25167 return 0; +#define HG98726 +#define HG82798 +#define HG87266 +#define HG19826 +#define HG82266 +#define HG18262 +#define HG12765 +#define HG16236 +#define HG16215 +#define HG28366 +#define HG18763 +#define HG28736 +#define HG28361 +#define HG23837 +#define HG65276 TRUE +#define HG38467 "Sorry, no can do." +#define HG84636 +#define HG48362 +#define HG72626 +#define HG38376 +#define HG38262 +#define HG37252 #define HG93634 #define HG56817 #define HG43241 @@ -30,6 +90,7 @@ #define HG69136 #define HG86722 #define HG87489 +#define HG22864 #define HG40560 #define HG33086 #define HG17928 @@ -48,3 +109,532 @@ #define HG82168 #define HG29989 #define HG48722 +#define HG47352 +#define HG05988 +#define HG05989 +#define HG83344 +#define HG73299 +#define HG00374 +#define HG83666 +#define HG77677 "msgpane.h" +#define HG77678 +#define HG72266 +#define HG72267 XP_STRDUP +#define HG29872 +#define HG52442 +#define HG42322 +#define HG72530 +#define HG52421 +#define HG52987 +#define HG72224 XP_STRDUP +#define HG62294 XP_STRDUP +#define HG52286 +#define HG64384 +#define HG99874 "msgsend.h" +#define HG83647 +#define HG62453 +#define HG42326 +#define HG52432 +#define HG62239 +#define HG42420 +#define HG42933 +#define HG52965 +#define HG66663 +#define HG66664 +#define HG65243 +#define HG00282 +#define HG02872 +#define HG65241 ,FALSE, FALSE +#define HG73530 +#define HG72523 +#define HG09275 +#define HG24327 +#define HG24326 +#define HG23258 XP_STRDUP +#define HG28265 XP_STRDUP +#define HG24239 +#define HG56307 +#define HG32686 XP_STRDUP +#define HG53961 +#define HG97760 +#define HG29866 +#define HG72142 +#define HG82309 +#define HG63256 +#define HG87635 +#define HG32428 +#define HG82454 +#define HG43788 +#define HG98298 +#define HG92734 +#define HG87637 +#define HG92435 +#define HG62437 +#define HG62422 +#define HG89377 +#define HG83623 +#define HG68452 +#define HG93873 +#define HG54897 +#define HG96484 +#define HG15448 ,FALSE, FALSE +#define HG83336 +#define HG63531 0 +#define HG73653(a) 0 +#define HG52242 +#define HG42320 +#define HG98379 +#define HG65293(a) 0 +#define HG42539 +#define HG72761 +#define HG42490 +#define HG73699 +#define HG72873 +#define HG83778 +#define HG32839 +#define HG73209 +#define HG65288 "client.h" +#define HG73891 +#define HG76298 +#define HG87325 +#define HG73896 +#define HG73684 +#define HG83903 +#define HG32138 +#define HG65294 +#define HG83267 +#define HG63287 +#define HG63453 +#define HG98471 +#define HG52897 +#define HG73870 +#define HG74380 +#define HG52980 +#define HG87326 "mkhelp.h" +#define HG45245 "mkhelp.h" +#define HG63250 "mkhelp.h" +#define HG42784 +#define HG73787 +#define HG72987 +#define HG52422 +#define HG62630 +#define HG24324 +#define HG63454 +#define HG42422 +#define HG64398 +#define HG77355 +#define HG42421 +#define HG87237 +#define HG52423 +#define HG76373 TRUE +#define HG72388 FALSE; +#define HG52223 FALSE; +#define HG53535 +#define HG52528 FALSE; +#define HG73277 FALSE +#define HG73738 +#define HG62522 +#define HG62363 +#define HG24242 +#define HG42469 +#define HG87376 +#define HG76363 +#define HG83667 +#define HG00484 +#define HG88000 +#define HG50027 +#define HG72762 +#define HG16262 +#define HG72661 +#define HG13227 +#define HG65256 +#define HG33234 +#define HG22658 +#define HG28266 +#define HG00729 +#define HG60283 +#define HG60207 +#define HG42440 +#define HG20026 +#define HG02977 +#define HG02726 +#define HG98276 +#define HG72999 +#define HG73943 +#define HG92762 +#define HG92755 +#define HG98229 +#define HG98265 +#define HG93653 +#define HG82762 +#define HG82621 +#define HG22960 +#define HG92827 +#define HG02087 +#define HG82126 +#define HG62212 FALSE, FALSE +#define HG91611 FALSE, FALSE +#define HG81762 FALSE, FALSE +#define HG76255 FALSE, FALSE +#define HG22987 +#define HG22296 FALSE, FALSE +#define HG22867 +#define HG32145 +#define HG09990 FALSE, FALSE +#define HG89520 +#define HG02192 FALSE, FALSE +#define HG82821 +#define HG82224 +#define HG22821 +#define HG03067 "msg.h" +#define HG23277 +#define HG92923 +#define HG82220 +#define HG22067 +#define HG98330 +#define HG98373 +#define HG22860 +#define HG02700 "NIKI" +#define HG99877 "prefapi.h" +#define HG02902 "msgsend.h" +#define HG72621 +#define HG10828 +#define HG82727 +#define HG26763 +#define HG26250 +#define HG26251 +#define HG26252 SECFailure; +#define HG26253 FALSE +#define HG26237 +#define HG26748 +#define HG98476 +#define HG83764 +#define HG83744 +#define HG83476 +#define HG84777 +#define HG27398 +#define HG83263 +#define HG22730 +#define HG74640 +#define HG87365 +#define HG73632 +#define HG29383 +#define HG25262 +#define HG17993 +#define HG72294 +#define HG21522 +#define HG03937 +#define HG21632 +#define HG22220 +#define HG38932 +#define HG83330 +#define HG20476 +#define HG87358 +#define HG93765 +#define HG92743 +#define HG83665 +#define HG98376 +#define HG92362 +#define HG26300 +#define HG27229 "mkfile.h" +#define HG27230 +#define HG27326 "mkutils.h" +#define HG32828 +#define HG26363 "msgnet.h" +#define HG26227 +#define HG27327 FALSE +#define HG38373 FALSE +#define HG72524 +#define HG73654 FALSE +#define HG87263 FALSE +#define HG83733 FALSE +#define HG32830 FALSE +#define HG29237 +#define HG87373 "net.h" +#define HG73226 +#define HG38731 +#define HG87272 MK_LDAP_TITLE +#define HG73272 MK_LDAP_TITLE +#define HG73211 +#define HG83363 +#define HG26557 +#define HG27328 +#define HG23833 +#define HG28330 +#define HG10299 "gui.h" +#define HG10300 +#define HG82332 +#define HG32949 +#define HG38737 +#define HG29239 +#define HG28287 +#define HG22999 +#define HG93230 +#define HG29399 +#define HG20900 +#define HG23929 "mktcp.h" +#define HG82300 +#define HG21899 +#define HG19088 +#define HG10877 +#define HG23298 +#define HG29898 +#define HG22201 +#define HG38738 +#define HG02873 +#define HG92892 +#define HG92871 +#define HG82772 +#define HG03903 +#define HG82773 FALSE +#define HG22087 +#define HG21092 +#define HG09309 +#define HG29802 0 +#define HG93882 +#define HG93898 +#define HG93288 +#define HG21090 +#define HG20092 +#define HG29398 +#define HG83273 +#define HG09438 "mkpop3.h" +#define HG09439 +#define HG23535 "mktcp.h" +#define HG27655 +#define HG83763 +#define HG35353 +#define HG38763 "mime.h" +#define HG83777 +#define HG35632 +#define HG83773 +#define HG83787 +#define HG73678 +#define HG84378 +#define HG84772 +#define HG99875 XP_STRDUP +#define HG99876 XP_STRDUP +#define HG99879 XP_STRDUP +#define HG99880 +#define HG99881 +#define HG99882 +#define HG53784 +#define HG78478 +#define HG89984 +#define HG54689 +#define HG55451 +#define HG36459 +#define HG75442 +#define HG59731 +#define HG56898 + +/* WINDOWS FRONT END */ + + +#define HG37279 +#define HG83788 +#define HG82387 +#define HG89327 +#define HG27635 +#define HG83722 +#define HG32564 +#define HG73537 +#define HG21675 +#define HG72866 FALSE; +#define HG27861 +#define HG73221 FALSE +#define HG73723 +#define HG28751 FALSE; +#define HG28972 +#define HG29172 +#define HG98271 +#define HG27851 +#define HG98261 +#define HG28768 +#define HG28728 +#define HG26723 +#define HG29792 +#define HG38729 +#define HG81325 +#define HG87322 +#define HG28218 +#define HG76528 +#define HG27625 +#define HG72521 +#define HG87282 +#define HG28762 +#define HG92611 +#define HG11173 +#define HG21215 +#define HG21326 +#define HG22121 +#define HG28363 +#define HG26545 +#define HG12421 +#define HG17231 +#define HG26576 +#define HG26522 +#define HG87236 return; +#define HG17236 return; +#define HG87211 +#define HG26722 +#define HG27811 +#define HG27129 +#define HG21198 FALSE, FALSE +#define HG26726 +#define HG21892 +#define HG28118 +#define HG26262 +#define HG79266 +#define HG72611 +#define HG72625 +#define HG27367 +#define HG72671 +#define HG72729 ss = XP_GetString(XFE_SECURITY_DISABLED); +#define HG78268 +#define HG78261 +#define HG12675 +#define HG87163 +#define HG78262 +#define HG87268 +#define HG78265 +#define HG87627 +#define HG72721 +#define HG13267 +#define HG87262 +#define HG71265 +#define HG72587 +#define HG87271 +#define HG21989 +#define HG12976 +#define HG87265 +#define HG78272 +#define HG87921 +#define HG72881 +#define HG87111 +#define HG27632 +#define HG87782 +#define HG37211 +#define HG11326 +#define HG72819 +#define HG71199 +#define HG18159 +#define HG28688 +#define HG82160 +#define HG92799 +#define HG28190 +#define HG87291 +#define HG17211 +#define HG01019 +#define HG01283 +#define HG98269 +#define HG91001 +#define HG92179 +#define HG92769 +#define HG98268 +#define HG82688 +#define HG32179 +#define HG82687 +#define HG78277 +#define HG91268 +#define HG10219 +#define HG01092 +#define HG72711 +#define HG78281 +#define HG18181 +#define HG82981 +#define HG87288 +#define HG82111 +#define HG92828 +#define HG12821 +#define HG12111 +#define HG82128 +#define HG81210 +#define HG03833 +#define HG12928 +#define HG00298 +#define HG02920 +#define HG02092 +#define HG28999 +#define HG09219 +#define HG89219 +#define HG82198 +#define HG20303 FALSE +#define HG02023 FALSE +#define HG39875 +#define HG07326 +#define HG82883 +#define HG20388 +#define HG72988 FALSE +#define HG17272 +#define HG00288 +#define HG82992 +#define HG28732 +#define HG20931 +#define HG29322 +#define HG29281 +#define HG20363 +#define HG98200 +#define HG71611 +#define HG11111 +#define HG21933 +#define HG28921 +#define HG82872 NULL, NULL +#define HG72723 +#define HG20192 +#define HG20198 +#define HG35220 +#define HG82811 +#define HG97291 +#define HG12922 +#define HG28182 +#define HG12832 +#define HG20938 +#define HG71710 +#define HG11299 +#define HG10291 +#define HG01922 +#define HG10287 +#define HG10297 +#define HG81272 +#define HG02621 +#define HG19282 +#define HG92727 +#define HG82719 +#define HG21817 +#define HG81761 +#define HG12172 +#define HG10282 +#define HG29081 +#define HG21182 +#define HG02030 +#define HG93649 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mozilla/modules/security/freenav/secerr.h b/mozilla/modules/security/freenav/secerr.h index 23b75a38be0..adfd51fafd4 100644 --- a/mozilla/modules/security/freenav/secerr.h +++ b/mozilla/modules/security/freenav/secerr.h @@ -18,7 +18,11 @@ #define __SEC_ERR_H_ +#ifdef XP_MAC +#define SEC_ERROR_BASE (-2000) +#else #define SEC_ERROR_BASE (-0x2000) +#endif #define SEC_ERROR_LIMIT (SEC_ERROR_BASE + 1000) #define IS_SEC_ERROR(code) \ diff --git a/mozilla/modules/security/freenav/sslerr.h b/mozilla/modules/security/freenav/sslerr.h index 1e095d2c787..bd823ab650d 100644 --- a/mozilla/modules/security/freenav/sslerr.h +++ b/mozilla/modules/security/freenav/sslerr.h @@ -18,7 +18,11 @@ #define __SSL_ERR_H_ +#ifdef XP_MAC +#define SSL_ERROR_BASE (-3000) +#else #define SSL_ERROR_BASE (-0x3000) +#endif #define SSL_ERROR_LIMIT (SSL_ERROR_BASE + 1000) #ifndef NO_SECURITY_ERROR_ENUM diff --git a/mozilla/network/Makefile b/mozilla/network/Makefile index 41e5b92a736..4c911133f88 100644 --- a/mozilla/network/Makefile +++ b/mozilla/network/Makefile @@ -35,3 +35,5 @@ endif include $(DEPTH)/config/rules.mk +INCLUDE += $(PUBLIC)\ldap $(PUBLIC)\security + diff --git a/mozilla/network/cnvts/Makefile b/mozilla/network/cnvts/Makefile index ff98c8af516..71340cf576a 100644 --- a/mozilla/network/cnvts/Makefile +++ b/mozilla/network/cnvts/Makefile @@ -61,6 +61,6 @@ EXPORTS += \ endif REQUIRES = network img lay layer util parse pref js \ - security marimurl style zlib softupdt mimetype + security marimurl style zlib softupdt mimetype ldap include $(DEPTH)/config/rules.mk diff --git a/mozilla/network/cnvts/makefile.win b/mozilla/network/cnvts/makefile.win index dd46cce4d7c..68b7b561cdd 100644 --- a/mozilla/network/cnvts/makefile.win +++ b/mozilla/network/cnvts/makefile.win @@ -80,7 +80,7 @@ INCLUDES = $(LOCAL_INCLUDES) EXTRA_LIBS= -REQUIRES= network +REQUIRES= network ldap EXPORTS= \ cvactive.h \ cvchunk.h \ @@ -109,6 +109,7 @@ LINCS= \ -I$(PUBLIC)\softupdt \ -I$(PUBLIC)\network \ -I$(PUBLIC)\mimetype \ + -I$(PUBLIC)\ldap \ $(NULL) #!endif diff --git a/mozilla/network/main/Makefile b/mozilla/network/main/Makefile index 238d998b07b..48a830451e0 100644 --- a/mozilla/network/main/Makefile +++ b/mozilla/network/main/Makefile @@ -57,7 +57,7 @@ EXPORTS= mkstream.h mkparse.h mkfsort.h mksort.h mkgeturl.h \ REQUIRES = jtools nspr2 dbm util js parse lay style pref htmldlgs java \ libfont netcache httpurl cnetinit security img layer netcnvts network \ - mimetype + mimetype ldap net include $(DEPTH)/config/rules.mk diff --git a/mozilla/network/main/makefile.win b/mozilla/network/main/makefile.win index 8f71b307b9b..dc0d68b141d 100644 --- a/mozilla/network/main/makefile.win +++ b/mozilla/network/main/makefile.win @@ -97,7 +97,7 @@ LIBRARY_NAME=network EXTRA_LIBS= -REQUIRES= foo parse jtools java zlib nspr dbm util network js security mimetype +REQUIRES= foo parse jtools java zlib nspr dbm util network js security mimetype ldap net EXPORTS= mkstream.h \ mkparse.h \ mkfsort.h \ @@ -137,6 +137,8 @@ LINCS=-I$(PUBLIC)\jtools \ -I$(PUBLIC)\cnetinit \ -I$(PUBLIC)\mimetype \ -I$(PUBLIC)\network \ + -I$(PUBLIC)\ldap \ + -I$(PUBLIC)\net \ -I$(PUBLIC)\security #!endif diff --git a/mozilla/network/makefile.win b/mozilla/network/makefile.win index b161eb21a09..39345e1b229 100644 --- a/mozilla/network/makefile.win +++ b/mozilla/network/makefile.win @@ -40,3 +40,6 @@ DIRS= \ $(NULL) include <$(DEPTH)\config\rules.mak> + +INCLUDE = $(INCLUDE) $(PUBLIC)\ldap $(PUBLIC)\security + diff --git a/mozilla/nsprpub/pr/include/md/_unixos.h b/mozilla/nsprpub/pr/include/md/_unixos.h index d8895aa73b0..76b62915810 100644 --- a/mozilla/nsprpub/pr/include/md/_unixos.h +++ b/mozilla/nsprpub/pr/include/md/_unixos.h @@ -63,6 +63,7 @@ #define PR_PATH_SEPARATOR ':' #define PR_PATH_SEPARATOR_STR ":" #define GCPTR + typedef int (*FARPROC)(); /* diff --git a/mozilla/sun-java/makefile.win b/mozilla/sun-java/makefile.win index 984145a0747..5745d0ee700 100644 --- a/mozilla/sun-java/makefile.win +++ b/mozilla/sun-java/makefile.win @@ -47,11 +47,6 @@ CLASSSRC=classsrc !if !defined(MOZ_JAVA) DIRS=stubs !else -!if "$(MOZ_BITS)" == "16" -DIRS=include md-include md runtime netscape awt jtools jpegwrap zipwrap -!else -DIRS=javah $(CLASSSRC) include md-include md runtime netscape awt mmedia jtools jpegwrap zipwrap bn jdbc jit\win32\symantec\netscape -!endif !endif # MOZ_JAVA !if "$(STAND_ALONE_JAVA)" == "1" diff --git a/mozilla/sun-java/stubs/include/jritypes.h b/mozilla/sun-java/stubs/include/jritypes.h index 04751c978af..61c386b736e 100644 --- a/mozilla/sun-java/stubs/include/jritypes.h +++ b/mozilla/sun-java/stubs/include/jritypes.h @@ -31,6 +31,7 @@ typedef void *JRIGlobalRef; typedef JRIGlobalRef jglobal; typedef struct jarrayArrayStruct* jarrayArray; +typedef jint JRIFieldID; typedef jint JRIMethodID; typedef enum JRIConstant {