nsServiceManager::ReleaseService(kCMailboxServiceCID, mailboxService);
nsresult nsMailboxTestDriver::OnDisplayMessage(){	nsresult rv = NS_OK; 	char * displayString = nsnull;	nsMsgKeyArray msgKeys;	PL_strcpy(m_userData, (const char *) m_folderSpec);	displayString = PR_smprintf("Location of mailbox folders [%s]: ", m_userData);	rv = PromptForUserDataAndBuildUrl(displayString);	PR_FREEIF(displayString); 	char * folderPath = PL_strdup(m_userData);	// now ask for the mailbox name...	PL_strcpy(m_userData, DEFAULT_MAILBOX);	displayString = PR_smprintf("Mailbox to get message from [%s]: ", m_userData);	rv = PromptForUserDataAndBuildUrl(displayString);	PR_FREEIF(displayString);	// concatenate folder name onto folder path....	char * fullFolderPath = PR_smprintf("%s%c%s", folderPath ? folderPath : "",PR_DIRECTORY_SEPARATOR, m_userData);	PR_FREEIF(folderPath);	// now turn this into a nsFilePath...	nsFileSpec filePath(fullFolderPath);	PR_FREEIF(fullFolderPath);	nsMailDatabase * mailDb = OpenDB(filePath);	if (mailDb)	{		// extract the message key array		mailDb->ListAllKeys(msgKeys);		PRUint32 numKeys = msgKeys.GetSize();		// ask the user which message they want to display...We'll do this by asking the message number		// and then looking up in the array for the message key associated with that message.		PL_strcpy(m_userData, "0");		displayString = PR_smprintf("Enter message numbeer between %d and %d to display [%s]: ", 0, numKeys-1, m_userData);		rv = PromptForUserDataAndBuildUrl(displayString);		PR_FREEIF(displayString);		PRUint32 index = atol(m_userData);		nsMsgKey msgKey = msgKeys[index];		// okay, we have the msgKey so let's get rid of our db state...		mailDb->Close(PR_TRUE);		// now ask the mailbox service to parse this mailbox...		nsIMailboxService * mailboxService = nsnull;		rv = nsServiceManager::GetService(kCMailboxServiceCID, nsIMailboxService::GetIID(), (nsISupports **) &mailboxService);		if (NS_SUCCEEDED(rv) && mailboxService)		{			nsIURL * url = nsnull;			mailboxService->DisplayMessage(filePath, msgKey, nsnull, nsnull, this, nsnull);			if (url)				url->QueryInterface(nsIMailboxUrl::GetIID(), (void **) &m_url);			NS_IF_RELEASE(url);			nsServiceManager::ReleaseService(kCMailboxServiceCID, mailboxService);		}	}	else	{		printf("We were unable to open a database associated with this mailbox folder.\n");		printf("Try parsing the mailbox folder first (command 1). \n");	}	return rv;}