nsBookmarksService::AddBookmark(const char *aURI, const PRUnichar *aOptionalTitle, PRInt32 bmType, const PRUnichar *aCharset)
BookmarkParser::AddBookmark(nsCOMPtr<nsIRDFContainer> aContainer, const char*      aURL, const PRUnichar* aOptionalTitle, PRInt32          aAddDate, PRInt32          aLastVisitDate, PRInt32          aLastModifiedDate, const char*      aShortcutURL, nsIRDFResource*  aNodeType, nsIRDFResource** bookmarkNode, const PRUnichar* aCharset)
nsBookmarksService::AddBookmark(const char *aURI,                                const PRUnichar *aOptionalTitle,                                 PRInt32 bmType,                                const PRUnichar *aCharset){	// XXX Constructing a parser object to do this is bad.	// We need to factor AddBookmark() into its own little	// routine or something.  nsresult rv;	BookmarkParser parser;	parser.Init(nsnull, mInner, mPersonalToolbarName);	nsCOMPtr<nsIRDFContainer> container;	rv = nsComponentManager::CreateInstance(kRDFContainerCID,						nsnull,						NS_GET_IID(nsIRDFContainer),						getter_AddRefs(container));	if (NS_FAILED(rv)) return rv;	// figure out where to add the new bookmark	nsCOMPtr<nsIRDFResource>	bookmarkType = kNC_NewBookmarkFolder;	switch(bmType)	{		case	BOOKMARK_SEARCH_TYPE:		case	BOOKMARK_FIND_TYPE:		bookmarkType = kNC_NewSearchFolder;		break;	}	nsCOMPtr<nsIRDFResource>	newBookmarkFolder;	if (NS_FAILED(rv = getFolderViaHint(bookmarkType, PR_TRUE,			getter_AddRefs(newBookmarkFolder))))		return(rv);	rv = container->Init(mInner, newBookmarkFolder);	if (NS_FAILED(rv)) return(rv);	// convert the current date/time from microseconds (PRTime) to seconds	PRTime		now64 = PR_Now(), million;	LL_I2L(million, PR_USEC_PER_SEC);	LL_DIV(now64, now64, million);	PRInt32		now32;	LL_L2I(now32, now64);	rv = parser.AddBookmark(container, aURI, aOptionalTitle, now32,				0L, 0L, nsnull, kNC_Bookmark, nsnull, aCharset);	if (NS_FAILED(rv)) return(rv);	mDirty = PR_TRUE;	Flush();  return(NS_OK);}