зеркало из https://github.com/mozilla/gecko-dev.git
remove hard coded constant MESSAGE_PATH_URL, and use instance of it a string which it build at run time. Now we can use relative as well as absolute path.
This commit is contained in:
Родитель
aeee893bf8
Коммит
7c6a0242e1
|
@ -66,10 +66,12 @@ NS_IMPL_ADDREF(nsMailboxProtocol)
|
|||
NS_IMPL_RELEASE(nsMailboxProtocol)
|
||||
NS_IMPL_QUERY_INTERFACE(nsMailboxProtocol, nsIStreamListener::GetIID()); /* we need to pass in the interface ID of this interface */
|
||||
|
||||
|
||||
nsMailboxProtocol::nsMailboxProtocol(nsIURL * aURL)
|
||||
{
|
||||
/* the following macro is used to initialize the ref counting data */
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
Initialize(aURL);
|
||||
}
|
||||
|
||||
|
@ -80,7 +82,7 @@ nsMailboxProtocol::~nsMailboxProtocol()
|
|||
|
||||
// free our local state
|
||||
PR_FREEIF(m_dataBuf);
|
||||
|
||||
|
||||
// free handles on all networking objects...
|
||||
NS_IF_RELEASE(m_outputStream);
|
||||
NS_IF_RELEASE(m_outputConsumer);
|
||||
|
@ -197,10 +199,16 @@ NS_IMETHODIMP nsMailboxProtocol::OnStopBinding(nsIURL* aURL, nsresult aStatus, c
|
|||
if (m_tempMessageFile)
|
||||
PR_Close(m_tempMessageFile);
|
||||
|
||||
char * fileUrl = PR_smprintf("file://%s", MESSAGE_PATH_URL);
|
||||
if (m_displayConsumer)
|
||||
m_displayConsumer->LoadURL(nsAutoString(fileUrl), nsnull, PR_TRUE, nsURLReload, 0);
|
||||
PR_FREEIF(fileUrl);
|
||||
{
|
||||
nsFilePath filePath(MESSAGE_PATH);
|
||||
nsFileURL fileURL(filePath);
|
||||
const char * message_path_url = PL_strdup(fileURL.GetAsString());
|
||||
|
||||
m_displayConsumer->LoadURL(nsAutoString(message_path_url), nsnull, PR_TRUE, nsURLReload, 0);
|
||||
|
||||
PR_FREEIF(message_path_url);
|
||||
}
|
||||
}
|
||||
|
||||
// and we want to mark ourselves for deletion or some how inform our protocol manager that we are
|
||||
|
@ -516,9 +524,16 @@ PRInt32 nsMailboxProtocol::ReadMessageResponse(nsIInputStream * inputStream, PRU
|
|||
|
||||
// mscott: hack alert...now that the file is done...turn around and fire a file url
|
||||
// to display the message....
|
||||
char * fileUrl = PR_smprintf("file:///%s", MESSAGE_PATH_URL);
|
||||
if (m_displayConsumer)
|
||||
m_displayConsumer->LoadURL(nsAutoString(fileUrl), nsnull, PR_TRUE, nsURLReload, 0);
|
||||
{
|
||||
nsFilePath filePath(MESSAGE_PATH);
|
||||
nsFileURL fileURL(filePath);
|
||||
const char * message_path_url = PL_strdup(fileURL.GetAsString());
|
||||
|
||||
m_displayConsumer->LoadURL(nsAutoString(message_path_url), nsnull, PR_TRUE, nsURLReload, 0);
|
||||
|
||||
PR_FREEIF(message_path_url);
|
||||
}
|
||||
|
||||
ClearFlag(MAILBOX_PAUSE_FOR_READ);
|
||||
} // otherwise process the line
|
||||
|
|
|
@ -31,17 +31,14 @@
|
|||
|
||||
#ifdef XP_UNIX
|
||||
#define MESSAGE_PATH "/usr/tmp/tempMessage.eml"
|
||||
#define MESSAGE_PATH_URL MESSAGE_PATH
|
||||
#endif
|
||||
|
||||
#ifdef XP_PC
|
||||
#define MESSAGE_PATH "c:\\temp\\tempMessage.eml"
|
||||
#define MESSAGE_PATH_URL "/C|/temp/tempMessage.eml"
|
||||
#endif
|
||||
|
||||
#ifdef XP_MAC
|
||||
#define MESSAGE_PATH "tempMessage.eml"
|
||||
#define MESSAGE_PATH_URL "tempMessage.eml"
|
||||
#endif
|
||||
|
||||
// State Flags (Note, I use the word state in terms of storing
|
||||
|
@ -152,6 +149,7 @@ private:
|
|||
PRFileDesc* m_tempMessageFile;
|
||||
nsIWebShell * m_displayConsumer; // if we are displaying an article this is the rfc-822 display sink...
|
||||
|
||||
|
||||
PRInt32 ProcessMailboxState(nsIURL * url, nsIInputStream * inputStream, PRUint32 length);
|
||||
PRInt32 CloseConnection(); // releases and closes down this protocol instance...
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче