Messages are downloaded and deleted if user doesn't have write permissions for inbox (by Keyser Sosez, 62480). r=doron sr=mscott

This commit is contained in:
blakeross%telocity.com 2001-02-07 01:05:51 +00:00
Родитель 7669df7522
Коммит bda62fb605
5 изменённых файлов: 57 добавлений и 275 удалений

Просмотреть файл

@ -1,133 +0,0 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
# The following are used by the local mail code to display progress/status/error messages
#
# Out of memory
## @name LOCAL_OUT_OF_MEMORY
## @loc None
-1000=Application is out of memory.
# Status - parsing folder
## @name LOCAL_STATUS_SELECTING_MAILBOX
## @loc None
4000=Building summary file for %s...
# Status - parsing folder
## @name LOCAL_STATUS_DOCUMENT_DONE
## @loc None
4001=Document: Done
# Status - receiving message n of m
## @name LOCAL_STATUS_RECEIVING_MESSAGE_OF
## @loc None
4002=Receiving: message %lu of %lu
# Status - pop3 server error
## @name POP3_SERVER_ERROR
## @loc None
4003=An error occurred with the POP3 mail server.You should contact the administrator for this server or try again later.
# Status - pop3 user name failed
## @name POP3_USERNAME_FAILURE
## @loc None
4004=An error occurred while sending your user name to the mail server. You should contact the administrator for this server or try again later.
# Status - password failed
## @name POP3_PASSWORD_FAILURE
## @loc None
4005=An error occurred while sending your password to the mail server.You should contact the administrator for this server or try again later.
# Status - write error occurred
## @name POP3_MESSAGE_WRITE_ERROR
## @loc None
4006=An error occurred while saving mail messages.
# Status - connecting to host
## @name POP3_CONNECT_HOST_CONTACTED_SENDING_LOGIN_INFORMATION
## @loc None
4007=Connect: Host contacted, sending login information...
# Status - no messages to download
## @name POP3_NO_MESSAGES
## @loc None
4008=There are no new messages on the server.
# Status - messages received after the download
## @name POP3_DOWNLOAD_COUNT
## @loc None
4009=Received %ld of %ld messages
# Status - the server doesn't support UIDL...
## @name POP3_SERVER_DOES_NOT_SUPPORT_UIDL_ETC
## @loc None
4010=The POP3 server (%s) does not support UIDL, which "MOZ_NAME_PRODUCT" Mail needs to implement the ``Leave on Server'' and ``Maximum Message Size'' options. To download your mail, turn off these options in the Mail Server panel of Preferences.
# Status - the server doesn't support the top command
## @name POP3_SERVER_DOES_NOT_SUPPORT_THE_TOP_COMMAND
## @loc None
4011=The POP3 mail server (%s) does not support the TOP command. Without server support for this, we cannot implement the ``Maximum Message Size'' preference. This option has been disabled, and messages will be downloaded regardless of their size.
# Status - retr failure from the server
## @name POP3_RETR_FAILURE
## @loc None
4012=An error occurred while getting messages from the POP3 mail server. You should contact the administrator for this server or try again later.
# Status - password undefined
## @name POP3_PASSWORD_UNDEFINED
## @loc None
4013=Error getting mail password.
# Status - username undefined
## @name POP3_USERNAME_UNDEFINED
## @loc None
4014=Mozilla is unable to use the mail server because you have not provided a username. Please provide one in the account setup menu and try again.
# Status - list failure
## @name POP3_LIST_FAILURE
## @loc None
4015=An error occurred while listing messages on the POP3 mail server. You should contact the administrator for this server or try again later.
# Status - delete error
## @name POP3_DELE_FAILURE
## @loc None
4016=An error occurred while removing messages from the POP3 mail server. You should contact the administrator for this server or try again later.
## @name POP3_ENTER_PASSWORD_PROMPT
## @loc None
4017=Enter your password for %1$s@%2$s.
## @name POP3_PREVIOUSLY_ENTERED_PASSWORD_IS_INVALID_ETC
## @loc None
4018=Could not log in to the mail server. The server responded: %s. Please enter a new password for user %.100s@%.100s:
## @name POP3_NO_ANSWER
## @loc None
4019=No Answer
## @name POP3_ENTER_PASSWORD_PROMPT_TITLE
## @loc None
4020=Enter your password
## @name moveFolderToTrash
## @loc None
4021=Are you sure you want to move the selected folders into the Trash?

Просмотреть файл

@ -1,133 +0,0 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#
# The following are used by the local mail code to display progress/status/error messages
#
# Out of memory
## @name LOCAL_OUT_OF_MEMORY
## @loc None
-1000=Application is out of memory.
# Status - parsing folder
## @name LOCAL_STATUS_SELECTING_MAILBOX
## @loc None
4000=Building summary file for %s...
# Status - parsing folder
## @name LOCAL_STATUS_DOCUMENT_DONE
## @loc None
4001=Document: Done
# Status - receiving message n of m
## @name LOCAL_STATUS_RECEIVING_MESSAGE_OF
## @loc None
4002=Receiving: message %lu of %lu
# Status - pop3 server error
## @name POP3_SERVER_ERROR
## @loc None
4003=An error occurred with the POP3 mail server.You should contact the administrator for this server or try again later.
# Status - pop3 user name failed
## @name POP3_USERNAME_FAILURE
## @loc None
4004=An error occurred while sending your user name to the mail server. You should contact the administrator for this server or try again later.
# Status - password failed
## @name POP3_PASSWORD_FAILURE
## @loc None
4005=An error occurred while sending your password to the mail server.You should contact the administrator for this server or try again later.
# Status - write error occurred
## @name POP3_MESSAGE_WRITE_ERROR
## @loc None
4006=An error occurred while saving mail messages.
# Status - connecting to host
## @name POP3_CONNECT_HOST_CONTACTED_SENDING_LOGIN_INFORMATION
## @loc None
4007=Connect: Host contacted, sending login information...
# Status - no messages to download
## @name POP3_NO_MESSAGES
## @loc None
4008=There are no new messages on the server.
# Status - messages received after the download
## @name POP3_DOWNLOAD_COUNT
## @loc None
4009=Received %ld of %ld messages
# Status - the server doesn't support UIDL...
## @name POP3_SERVER_DOES_NOT_SUPPORT_UIDL_ETC
## @loc None
4010=The POP3 server (%s) does not support UIDL, which "MOZ_NAME_PRODUCT" Mail needs to implement the ``Leave on Server'' and ``Maximum Message Size'' options. To download your mail, turn off these options in the Mail Server panel of Preferences.
# Status - the server doesn't support the top command
## @name POP3_SERVER_DOES_NOT_SUPPORT_THE_TOP_COMMAND
## @loc None
4011=The POP3 mail server (%s) does not support the TOP command. Without server support for this, we cannot implement the ``Maximum Message Size'' preference. This option has been disabled, and messages will be downloaded regardless of their size.
# Status - retr failure from the server
## @name POP3_RETR_FAILURE
## @loc None
4012=An error occurred while getting messages from the POP3 mail server. You should contact the administrator for this server or try again later.
# Status - password undefined
## @name POP3_PASSWORD_UNDEFINED
## @loc None
4013=Error getting mail password.
# Status - username undefined
## @name POP3_USERNAME_UNDEFINED
## @loc None
4014=Mozilla is unable to use the mail server because you have not provided a username. Please provide one in the account setup menu and try again.
# Status - list failure
## @name POP3_LIST_FAILURE
## @loc None
4015=An error occurred while listing messages on the POP3 mail server. You should contact the administrator for this server or try again later.
# Status - delete error
## @name POP3_DELE_FAILURE
## @loc None
4016=An error occurred while removing messages from the POP3 mail server. You should contact the administrator for this server or try again later.
## @name POP3_ENTER_PASSWORD_PROMPT
## @loc None
4017=Enter your password for %1$s@%2$s.
## @name POP3_PREVIOUSLY_ENTERED_PASSWORD_IS_INVALID_ETC
## @loc None
4018=Could not log in to the mail server. The server responded: %s. Please enter a new password for user %.100s@%.100s:
## @name POP3_NO_ANSWER
## @loc None
4019=No Answer
## @name POP3_ENTER_PASSWORD_PROMPT_TITLE
## @loc None
4020=Enter your password
## @name moveFolderToTrash
## @loc None
4021=Are you sure you want to move the selected folders into the Trash?

Просмотреть файл

@ -67,7 +67,7 @@
# Status - write error occurred
## @name POP3_MESSAGE_WRITE_ERROR
## @loc None
4006=An error occurred while saving mail messages.
4006=Mozilla could not write the email to the mailbox. Make sure the file system allows you write privileges and enough disk space to copy the mailbox.
# Status - connecting to host
## @name POP3_CONNECT_HOST_CONTACTED_SENDING_LOGIN_INFORMATION

Просмотреть файл

@ -1146,7 +1146,13 @@ nsPop3Protocol::GetStat()
if (!m_pop3ConData->only_check_for_new_mail) {
m_nsIPop3Sink->BeginMailDelivery(m_pop3ConData->only_uidl != nsnull, &m_pop3ConData->msg_del_started);
// The following was added to prevent the loss of Data when we try and
// write to somewhere we dont have write access error to (See bug 62480)
// (Note: This is only a temp hack until the underlying XPCOM is fixed
// to return errors)
if(NS_FAILED(m_nsIPop3Sink->BeginMailDelivery(m_pop3ConData->only_uidl != nsnull,
&m_pop3ConData->msg_del_started)))
return(Error(POP3_MESSAGE_WRITE_ERROR));
if(!m_pop3ConData->msg_del_started)
{
@ -2172,6 +2178,15 @@ nsPop3Protocol::RetrResponse(nsIInputStream* inputStream,
{
status =
m_nsIPop3Sink->IncorporateComplete(m_pop3ConData->msg_closure);
// The following was added to prevent the loss of Data when we try
// and write to somewhere we dont have write access error to (See
// bug 62480)
// (Note: This is only a temp hack until the underlying XPCOM is
// fixed to return errors)
if(NS_FAILED(status))
return(Error(POP3_MESSAGE_WRITE_ERROR));
m_pop3ConData->msg_closure = 0;
buffer_size = 0;
}
@ -2221,6 +2236,16 @@ nsPop3Protocol::RetrResponse(nsIInputStream* inputStream,
{
status =
m_nsIPop3Sink->IncorporateComplete(m_pop3ConData->msg_closure);
// The following was added to prevent the loss of Data when we try
// and write to somewhere we dont have write access error to (See
// bug 62480)
// (Note: This is only a temp hack until the underlying XPCOM is
// fixed to return errors)
if(NS_FAILED(status))
return(Error(POP3_MESSAGE_WRITE_ERROR));
m_pop3ConData->msg_closure = 0;
}
@ -2359,6 +2384,16 @@ nsPop3Protocol::HandleLine(char *line, PRUint32 line_length)
{
status =
m_nsIPop3Sink->IncorporateComplete(m_pop3ConData->msg_closure);
// The following was added to prevent the loss of Data when we try
// and write to somewhere we dont have write access error to (See
// bug 62480)
// (Note: This is only a temp hack until the underlying XPCOM is
// fixed to return errors)
if(NS_FAILED(status))
return(Error(POP3_MESSAGE_WRITE_ERROR));
m_pop3ConData->msg_closure = 0;
}
}

Просмотреть файл

@ -156,11 +156,19 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, PRBool* aBool)
fileSpec += "Inbox";
}
m_outFileStream = new nsIOFileStream(fileSpec /*, PR_CREATE_FILE */);
if (m_outFileStream)
m_outFileStream->seek(fileSpec.GetFileSize());
// create a new mail parser
// The following (!m_outFileStream etc) was added to make sure that we don't write somewhere
// where for some reason or another we can't write too and lose the messages
// See bug 62480
if (!m_outFileStream)
return NS_ERROR_OUT_OF_MEMORY;
m_outFileStream->seek(fileSpec.GetFileSize());
if (!m_outFileStream->is_open())
return NS_ERROR_FAILURE;
// create a new mail parser
m_newMailParser = new nsParseNewMailState;
if (m_newMailParser == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
@ -378,8 +386,13 @@ nsresult nsPop3Sink::WriteLineToMailbox(char *buffer)
{
if (m_newMailParser)
m_newMailParser->HandleLine(buffer, PL_strlen(buffer));
if (m_outFileStream)
*m_outFileStream << buffer;
// The following (!m_outFileStream etc) was added to make sure that we don't write somewhere
// where for some reason or another we can't write too and lose the messages
// See bug 62480
if (!m_outFileStream)
return NS_ERROR_OUT_OF_MEMORY;
*m_outFileStream << buffer;
}
return NS_OK;
}