fix 181639 strip out unused code, replace PR_FREEIF with PR_Free, r/sr=sspitzer

This commit is contained in:
bienvenu%netscape.com 2002-11-24 17:14:25 +00:00
parent d64f033f85
commit d91618556e
7 changed files with 48 additions and 595 deletions

View File

@ -240,7 +240,7 @@ nsMsgLocalMailFolder::CreateSubFolders(nsFileSpec &path)
char *leafName = currentFolderPath.GetLeafName();
nsMsgGetNativePathString(leafName, currentFolderNameStr);
PR_FREEIF(leafName);
PR_Free(leafName);
if (nsShouldIgnoreFile(currentFolderNameStr))
continue;
@ -3023,7 +3023,7 @@ nsMsgLocalMailFolder::MarkMsgsOnPop3Server(nsISupportsArray *messages, PRBool de
}
}
}
PR_FREEIF(header);
PR_Free(header);
if (popData)
{
if (changed)

View File

@ -96,22 +96,21 @@ nsresult
nsLocalMoveCopyMsgTxn::Init(nsIMsgFolder* srcFolder, nsIMsgFolder* dstFolder,
PRBool isMove)
{
nsresult rv;
rv = SetSrcFolder(srcFolder);
rv = SetDstFolder(dstFolder);
m_isMove = isMove;
nsresult rv;
rv = SetSrcFolder(srcFolder);
rv = SetDstFolder(dstFolder);
m_isMove = isMove;
char *uri = nsnull;
nsXPIDLCString uri;
if (!srcFolder) return rv;
rv = srcFolder->GetURI(&uri);
rv = srcFolder->GetURI(getter_Copies(uri));
nsCString protocolType(uri);
PR_FREEIF(uri);
protocolType.SetLength(protocolType.FindChar(':'));
if (protocolType.EqualsIgnoreCase("imap"))
{
m_srcIsImap4 = PR_TRUE;
}
return NS_OK;
return NS_OK;
}
nsresult
nsLocalMoveCopyMsgTxn::GetSrcIsImap(PRBool *isImap)

View File

@ -272,9 +272,6 @@ void nsMsgMailboxParser::Init()
m_obuffer_size = 0;
m_graph_progress_total = 0;
m_graph_progress_received = 0;
m_updateAsWeGo = PR_TRUE;
m_ignoreNonMailFolder = PR_FALSE;
m_isRealMailFolder = PR_TRUE;
}
void nsMsgMailboxParser::UpdateStatusText (PRUint32 stringID)
@ -405,7 +402,7 @@ PRInt32 nsMsgMailboxParser::PublishMsgHeader(nsIMsgWindow *msgWindow)
}
else if (m_mailDB)
{
m_mailDB->AddNewHdrToDB(m_newMsgHdr, m_updateAsWeGo);
m_mailDB->AddNewHdrToDB(m_newMsgHdr, PR_TRUE);
m_newMsgHdr = nsnull;
}
else
@ -446,9 +443,6 @@ PRInt32 nsMsgMailboxParser::HandleLine(char *line, PRUint32 lineLength)
// PR_snprintf (buf, sizeof(buf),
// XP_GetString(MK_MSG_NON_MAIL_FILE_READ_QUESTION),
// folder_name);
m_isRealMailFolder = PR_FALSE;
if (m_ignoreNonMailFolder)
return 0;
// else if (!FE_Confirm (m_context, buf))
// return NS_MSG_NOT_A_MAIL_FOLDER; /* #### NOT_A_MAIL_FILE */
}
@ -1454,7 +1448,7 @@ int nsParseMailMessageState::FinalizeHeaders()
}
nsParseNewMailState::nsParseNewMailState()
: m_tmpdbName(nsnull), m_usingTempDB(PR_FALSE), m_disableFilters(PR_FALSE)
: m_disableFilters(PR_FALSE)
{
m_inboxFileStream = nsnull;
m_ibuffer = nsnull;
@ -1497,8 +1491,6 @@ nsParseNewMailState::Init(nsIFolder *rootFolder, nsIMsgFolder *downloadFolder, n
if (m_filterList)
rv = server->ConfigureTemporaryReturnReceiptsFilter(m_filterList);
m_usingTempDB = PR_FALSE;
m_tmpdbName = nsnull;
m_disableFilters = PR_FALSE;
return NS_OK;
@ -1506,15 +1498,10 @@ nsParseNewMailState::Init(nsIFolder *rootFolder, nsIMsgFolder *downloadFolder, n
nsParseNewMailState::~nsParseNewMailState()
{
if (m_mailDB)
m_mailDB->Close(PR_TRUE);
// if (m_usingTempDB)
// {
// XP_FileRemove(m_tmpdbName, xpMailFolderSummary);
// }
PR_FREEIF(m_tmpdbName);
if (m_mailDB)
m_mailDB->Close(PR_TRUE);
#ifdef DOING_JSFILTERS
JSFilter_cleanup();
JSFilter_cleanup();
#endif
}
@ -1534,11 +1521,6 @@ void nsParseNewMailState::DoneParsingFolder(nsresult status)
if (!moved && m_mailDB) // finished parsing, so flush db folder info
UpdateDBFolderInfo();
#ifdef HAVE_FOLDERINFO
if (m_folder != nsnull)
m_folder->SummaryChanged();
#endif
/* We're done reading the folder - we don't need these things
any more. */
PR_FREEIF (m_ibuffer);
@ -1549,43 +1531,34 @@ void nsParseNewMailState::DoneParsingFolder(nsresult status)
PRInt32 nsParseNewMailState::PublishMsgHeader(nsIMsgWindow *msgWindow)
{
PRBool moved = PR_FALSE;
FinishHeader();
if (m_newMsgHdr)
{
FolderTypeSpecificTweakMsgHeader(m_newMsgHdr);
if (!m_disableFilters)
{
// flush the inbox because filters will read from disk
m_inboxFileStream->flush();
ApplyFilters(&moved, msgWindow);
}
if (!moved)
{
if (m_mailDB)
{
PRUint32 newFlags;
m_newMsgHdr->OrFlags(MSG_FLAG_NEW, &newFlags);
m_mailDB->AddNewHdrToDB (m_newMsgHdr, m_updateAsWeGo);
}
#ifdef HAVE_FOLDERINFO
if (m_folder)
m_folder->SetFlag(MSG_FOLDER_FLAG_GOT_NEW);
#endif
} // if it was moved by imap filter, m_parseMsgState->m_newMsgHdr == nsnull
m_newMsgHdr = nsnull;
}
return 0;
}
void nsParseNewMailState::SetUsingTempDB(PRBool usingTempDB, char *tmpDBName)
{
m_usingTempDB = usingTempDB;
m_tmpdbName = tmpDBName;
PRBool moved = PR_FALSE;
FinishHeader();
if (m_newMsgHdr)
{
FolderTypeSpecificTweakMsgHeader(m_newMsgHdr);
if (!m_disableFilters)
{
// flush the inbox because filters will read from disk
m_inboxFileStream->flush();
ApplyFilters(&moved, msgWindow);
}
if (!moved)
{
if (m_mailDB)
{
PRUint32 newFlags, oldFlags;
m_newMsgHdr->GetFlags(&oldFlags);
if (!(oldFlags & MSG_FLAG_READ)) // don't mark read messages as new.
m_newMsgHdr->OrFlags(MSG_FLAG_NEW, &newFlags);
m_mailDB->AddNewHdrToDB (m_newMsgHdr, PR_TRUE);
}
} // if it was moved by imap filter, m_parseMsgState->m_newMsgHdr == nsnull
m_newMsgHdr = nsnull;
}
return 0;
}
nsresult nsParseNewMailState::GetTrashFolder(nsIMsgFolder **pTrashFolder)
@ -1959,362 +1932,3 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
return err;
}
#ifdef IMAP_NEW_MAIL_HANDLED
ParseIMAPMailboxState::ParseIMAPMailboxState(MSG_IMAPHost *host, nsIMsgFolderMail *folder,
MSG_UrlQueue *urlQueue, TImapFlagAndUidState *flagStateAdopted)
: nsParseNewMailState(master, folder), fUrlQueue(urlQueue)
{
MSG_FolderInfoContainer *imapContainer = m_mailMaster->GetImapMailFolderTreeForHost(host->GetHostName());
nsIMsgFolder *filteredFolder = imapContainer->FindMailPathname(folder->GetPathname());
fParsingInbox = 0 != (filteredFolder->GetFlags() & MSG_FOLDER_FLAG_INBOX);
fFlagState = flagStateAdopted;
fB2HaveWarnedUserOfOfflineFiltertarget = PR_FALSE;
// we ignore X-mozilla status for imap messages
GetMsgState()->m_IgnoreXMozillaStatus = PR_TRUE;
fNextSequenceNum = -1;
m_host = host;
m_imapContainer = imapContainer;
}
ParseIMAPMailboxState::~ParseIMAPMailboxState()
{
}
void ParseIMAPMailboxState::SetPublishUID(PRInt32 uid)
{
fNextMessagePublishUID = uid;
}
void ParseIMAPMailboxState::SetPublishByteLength(PRUint32 byteLength)
{
fNextMessageByteLength = byteLength;
}
void ParseIMAPMailboxState::DoneParsingFolder(nsresult status)
{
nsMsgMailboxParser::DoneParsingFolder(status);
if (m_mailDB)
{
// make sure the highwater mark is correct
if (m_mailDB->m_dbFolderInfo->GetNumVisibleMessages())
{
ListContext *listContext;
nsIMsgDBHdr *currentHdr;
if ((m_mailDB->ListLast(&listContext, &currentHdr) == NS_OK) &&
currentHdr)
{
m_mailDB->m_dbFolderInfo->m_LastMessageUID = currentHdr->GetMessageKey();
currentHdr->Release();
m_mailDB->ListDone(listContext);
}
else
m_mailDB->m_dbFolderInfo->m_LastMessageUID = 0;
}
else
m_mailDB->m_dbFolderInfo->m_LastMessageUID = 0;
m_mailDB->Close();
m_mailDB = nsnull;
}
}
int ParseIMAPMailboxState::MarkFilteredMessageRead(nsIMsgDBHdr *msgHdr)
{
msgHdr->OrFlags(MSG_FLAG_READ);
nsMsgKeyArray keysToFlag;
keysToFlag.Add(msgHdr->GetMessageKey());
MSG_IMAPFolderInfoMail *imapFolder = m_folder->GetIMAPFolderInfoMail();
if (imapFolder)
imapFolder->StoreImapFlags(m_pane, kImapMsgSeenFlag, PR_TRUE, keysToFlag, GetFilterUrlQueue());
return 0;
}
nsresult ParseIMAPMailboxState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
nsIMsgDatabase *sourceDB,
char *destFolder,
nsIMsgFilter *filter)
{
nsresult err = NS_OK;
if (fUrlQueue && fUrlQueue->GetPane())
{
// look for matching imap folders, then pop folders
MSG_FolderInfoContainer *imapContainer = m_imapContainer;
nsIMsgFolder *sourceFolder = imapContainer->FindMailPathname(m_mailboxName);
nsIMsgFolder *destinationFolder = imapContainer->FindMailPathname(destFolder);
if (!destinationFolder)
destinationFolder = m_mailMaster->FindMailFolder(destFolder, PR_FALSE);
if (destinationFolder)
{
nsCOMPtr<nsIMsgFolder> inbox;
imapContainer->GetFoldersWithFlag(MSG_FOLDER_FLAG_INBOX, getter_AddRefs(inbox), 1);
if (inbox)
{
MSG_FolderInfoMail *destMailFolder = destinationFolder->GetMailFolderInfo();
// put the header into the source db, since it needs to be there when we copy it
// and we need a valid header to pass to StartAsyncCopyMessagesInto
nsMsgKey keyToFilter = mailHdr->GetMessageKey();
if (sourceDB && destMailFolder)
{
PRBool imapDeleteIsMoveToTrash = m_host->GetDeleteIsMoveToTrash();
nsMsgKeyArray *idsToMoveFromInbox = destMailFolder->GetImapIdsToMoveFromInbox();
idsToMoveFromInbox->Add(keyToFilter);
// this is our last best chance to log this
PRBool loggingEnabled = PR_FALSE;
if (m_filterList)
m_filterList->GetLoggingEnabled(&loggingEnabled);
if (loggingEnabled)
filter->LogRuleHit(mailHdr);
if (imapDeleteIsMoveToTrash)
{
if (m_parseMsgState->m_newMsgHdr)
{
m_parseMsgState->m_newMsgHdr->Release();
m_parseMsgState->m_newMsgHdr = nsnull;
}
}
destinationFolder->SetFlag(MSG_FOLDER_FLAG_GOT_NEW);
if (imapDeleteIsMoveToTrash)
err = 0;
}
}
}
}
// we have to return an error because we do not actually move the message
// it is done async and that can fail
return err;
}
MSG_FolderInfoMail *ParseIMAPMailboxState::GetTrashFolder()
{
MSG_IMAPFolderInfoContainer *imapContainerInfo = m_imapContainer->GetIMAPFolderInfoContainer();
if (!imapContainerInfo)
return nsnull;
nsIMsgFolder *foundTrash = MSG_GetTrashFolderForHost(imapContainerInfo->GetIMAPHost());
return foundTrash ? foundTrash->GetMailFolderInfo() : (MSG_FolderInfoMail *)nsnull;
}
// only apply filters for new unread messages in the imap inbox
void ParseIMAPMailboxState::ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow)
{
if (fParsingInbox && !(GetCurrentMsg()->GetFlags() & MSG_FLAG_READ) )
nsParseNewMailState::ApplyFilters(pMoved, msgWindow);
else
*pMoved = PR_FALSE;
if (!*pMoved && m_parseMsgState->m_newMsgHdr)
fFetchBodyKeys.Add(m_parseMsgState->m_newMsgHdr->GetMessageKey());
}
PRInt32 ParseIMAPMailboxState::PublishMsgHeader(nsIMsgWindow *msgWindow)
{
PRBool moved = PR_FALSE;
m_parseMsgState->FinishHeader();
if (m_parseMsgState->m_newMsgHdr)
{
FolderTypeSpecificTweakMsgHeader(m_parseMsgState->m_newMsgHdr);
if (!m_disableFilters) {
ApplyFilters(&moved, msgWindow);
}
if (!moved)
{
PRBool thisMessageUnRead = !(m_parseMsgState->m_newMsgHdr->GetFlags() & MSG_FLAG_READ);
if (m_mailDB)
{
if (thisMessageUnRead)
m_parseMsgState->m_newMsgHdr->OrFlags(kNew);
m_mailDB->AddHdrToDB (m_parseMsgState->m_newMsgHdr, nsnull,
(fNextSequenceNum == -1) ? m_updateAsWeGo : PR_FALSE);
// following is for cacheless imap - match sequence number
// to location to insert in view.
}
if (m_folder && thisMessageUnRead)
m_folder->SetFlag(MSG_FOLDER_FLAG_GOT_NEW);
} // if it was moved by imap filter, m_parseMsgState->m_newMsgHdr == nsnull
else if (m_parseMsgState->m_newMsgHdr)
{
// make sure global db is set correctly for delete of strings from hash tbl.
m_parseMsgState->m_newMsgHdr->unrefer();
}
m_parseMsgState->m_newMsgHdr = nsnull;
}
return 0;
}
void ParseIMAPMailboxState::SetNextSequenceNum(PRInt32 seqNum)
{
fNextSequenceNum = seqNum;
}
ParseOutgoingMessage::ParseOutgoingMessage()
{
m_bytes_written = 0;
m_out_file = 0;
m_wroteXMozillaStatus = PR_FALSE;
m_writeToOutFile = PR_TRUE;
m_lastBodyLineEmpty = PR_FALSE;
m_outputBuffer = 0;
m_ouputBufferSize = 0;
m_outputBufferIndex = 0;
m_writeMozillaStatus = PR_TRUE;
}
ParseOutgoingMessage::~ParseOutgoingMessage()
{
FREEIF (m_outputBuffer);
}
void ParseOutgoingMessage::Clear()
{
nsParseMailMessageState::Clear();
m_wroteXMozillaStatus = PR_FALSE;
m_bytes_written = 0;
}
// We've found the start of the next message, so finish this one off.
void ParseOutgoingMessage::FinishHeader()
{
PRInt32 origPosition = m_position, len = 0;
if (m_out_file && m_writeToOutFile)
{
if (origPosition > 0 && !m_lastBodyLineEmpty)
{
len = XP_FileWrite (MSG_LINEBREAK, MSG_LINEBREAK_LEN, m_out_file);
m_bytes_written += MSG_LINEBREAK_LEN;
m_position += MSG_LINEBREAK_LEN;
}
}
nsParseMailMessageState::FinishHeader();
}
int ParseOutgoingMessage::StartNewEnvelope(const char *line, PRUint32 lineLength)
{
int status = nsParseMailMessageState::StartNewEnvelope(line, lineLength);
if ((status >= 0) && m_out_file && m_writeToOutFile)
{
status = XP_FileWrite(line, lineLength, m_out_file);
if (status > 0)
m_bytes_written += lineLength;
}
return status;
}
PRInt32 ParseOutgoingMessage::ParseFolderLine(const char *line, PRUint32 lineLength)
{
PRInt32 res = nsParseMailMessageState::ParseFolderLine(line, lineLength);
int len = 0;
if (res < 0)
return res;
if (m_out_file && m_writeToOutFile)
{
if (!nsCRT::strncmp(line, X_MOZILLA_STATUS, X_MOZILLA_STATUS_LEN))
m_wroteXMozillaStatus = PR_TRUE;
m_lastBodyLineEmpty = (m_state == nsIMsgParseMailMsgState::ParseBodyState && (EMPTY_MESSAGE_LINE(line)));
// make sure we mangle naked From lines
if (line[0] == 'F' && !strncmp(line, "From ", 5))
{
res = XP_FileWrite (">", 1, m_out_file);
if (res < 1)
return res;
m_position += 1;
}
if (!m_wroteXMozillaStatus && m_writeMozillaStatus && m_state == nsIMsgParseMailMsgState::ParseBodyState)
{
char buf[50];
PRUint32 dbFlags = m_newMsgHdr ? m_newMsgHdr->GetFlags() : 0;
if (m_newMsgHdr)
m_newMsgHdr->SetStatusOffset(m_bytes_written);
PR_snprintf(buf, sizeof(buf), X_MOZILLA_STATUS_FORMAT MSG_LINEBREAK, (m_newMsgHdr) ? m_newMsgHdr->GetFlags() & ~MSG_FLAG_RUNTIME_ONLY : 0);
len = strlen(buf);
res = XP_FileWrite(buf, len, m_out_file);
if (res < len)
return res;
m_bytes_written += len;
m_position += len;
m_wroteXMozillaStatus = PR_TRUE;
MessageDB::ConvertDBFlagsToPublicFlags(&dbFlags);
dbFlags &= (MSG_FLAG_MDN_REPORT_NEEDED | MSG_FLAG_MDN_REPORT_SENT | MSG_FLAG_TEMPLATE);
PR_snprintf(buf, sizeof(buf), X_MOZILLA_STATUS2_FORMAT MSG_LINEBREAK, dbFlags);
len = strlen(buf);
res = XP_FileWrite(buf, len, m_out_file);
if (res < len)
return res;
m_bytes_written += len;
m_position += len;
}
res = XP_FileWrite(line, lineLength, m_out_file);
if (res == lineLength)
m_bytes_written += lineLength;
}
return res;
}
/* static */
PRInt32 ParseOutgoingMessage::LineBufferCallback(char *line, PRUint32 lineLength,
void *closure)
{
ParseOutgoingMessage *parseState = (ParseOutgoingMessage *) closure;
return parseState->ParseFolderLine(line, lineLength);
}
PRInt32 ParseOutgoingMessage::ParseBlock(const char *block, PRUint32 length)
{
m_ouputBufferSize = 10240;
while (m_outputBuffer == 0)
{
m_outputBuffer = (char *) PR_Malloc(m_ouputBufferSize);
if (m_outputBuffer == nsnull)
m_ouputBufferSize /= 2;
}
PR_ASSERT(m_outputBuffer != nsnull);
return msg_LineBuffer (block, length, &m_outputBuffer, &m_ouputBufferSize, &m_outputBufferIndex, PR_FALSE,
LineBufferCallback, this);
}
void ParseOutgoingMessage::AdvanceOutPosition(PRUint32 amountToAdvance)
{
m_position += amountToAdvance;
m_bytes_written += amountToAdvance;
}
void ParseOutgoingMessage::FlushOutputBuffer()
{
/* End of file. Flush out any partial line remaining in the buffer. */
if (m_outputBufferIndex > 0)
{
ParseFolderLine(m_outputBuffer, m_outputBufferIndex);
m_outputBufferIndex = 0;
}
}
#endif /* IMAP_NEW_MAIL_HANDLED */

View File

@ -178,10 +178,6 @@ public:
void SetDB (nsIMsgDatabase *mailDB) {m_mailDB = dont_QueryInterface(mailDB); }
void SetIncrementalUpdate(PRBool update) {m_updateAsWeGo = update;}
void SetIgnoreNonMailFolder(PRBool ignoreNonMailFolder) {m_ignoreNonMailFolder = ignoreNonMailFolder;}
PRBool GetIsRealMailFolder() {return m_isRealMailFolder;}
// message socket libnet callbacks, which come through folder pane
virtual int ProcessMailboxInputStream(nsIURI* aURL, nsIInputStream *aIStream, PRUint32 aLength);
@ -213,10 +209,7 @@ protected:
char *m_obuffer;
PRInt32 m_graph_progress_total;
PRInt32 m_graph_progress_received;
PRBool m_updateAsWeGo;
PRBool m_parsingDone;
PRBool m_ignoreNonMailFolder;
PRBool m_isRealMailFolder;
nsTime m_startTime;
private:
// the following flag is used to determine when a url is currently being run. It is cleared on calls
@ -238,7 +231,6 @@ public:
nsresult Init(nsIFolder *rootFolder, nsIMsgFolder *downloadFolder, nsFileSpec &folder, nsIOFileStream *inboxFileStream, nsIMsgWindow *aMsgWindow);
virtual void DoneParsingFolder(nsresult status);
virtual void SetUsingTempDB(PRBool usingTempDB, char *tmpDBName);
void DisableFilters() {m_disableFilters = PR_TRUE;}
@ -256,8 +248,6 @@ public:
nsOutputFileStream *GetLogFile();
virtual PRInt32 PublishMsgHeader(nsIMsgWindow *msgWindow);
protected:
char *m_tmpdbName; // Temporary filename of new database
PRBool m_usingTempDB;
virtual void ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow);
virtual nsresult GetTrashFolder(nsIMsgFolder **pTrashFolder);
virtual nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
@ -278,87 +268,4 @@ protected:
PRUint32 m_ibuffer_size;
};
#ifdef IMAP_NEW_MAIL_HANDLED
class ParseIMAPMailboxState : public ParseNewMailState
{
public:
ParseIMAPMailboxState(MSG_IMAPHost *host, MSG_FolderInfoMail *folder, MSG_UrlQueue *urlQueue, TImapFlagAndUidState *flagStateAdopted);
virtual ~ParseIMAPMailboxState();
// close the db
virtual void DoneParsingFolder(nsresult status);
virtual void SetPublishUID(PRInt32 uid);
virtual void SetPublishByteLength(PRUint32 byteLength);
virtual void SetNextSequenceNum(PRInt32 seqNum);
const IDArray &GetBodyKeys() { return fFetchBodyKeys; }
MSG_UrlQueue *GetFilterUrlQueue() {return fUrlQueue;}
protected:
virtual PRInt32 PublishMsgHeader(nsIMsgWindow *msgWindow);
virtual void FolderTypeSpecificTweakMsgHeader(nsIMsgDBHdr *tweakMe);
virtual void ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow);
virtual MSG_FolderInfoMail *GetTrashFolder();
virtual nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
nsIMsgDatabase *sourceDB,
char *destFolder,
nsIMsgFilter *filter);
virtual int MarkFilteredMessageRead(nsIMsgDBHdr *msgHdr);
private:
PRBool fParsingInbox;
PRBool fB2HaveWarnedUserOfOfflineFiltertarget;
PRInt32 fNextMessagePublishUID;
PRUint32 fNextMessageByteLength;
MSG_UrlQueue *fUrlQueue;
TImapFlagAndUidState *fFlagState;
nsMsgKeyArray fFetchBodyKeys;
PRInt32 fNextSequenceNum;
MSG_FolderInfoContainer *m_imapContainer;
MSG_IMAPHost *m_host;
};
// If m_out_file is set, this parser will also write out the message,
// adding a mozilla status line if one is not present.
class ParseOutgoingMessage : public ParseMailMessageState
{
public:
ParseOutgoingMessage();
virtual ~ParseOutgoingMessage();
void SetOutFile(XP_File out_file) {m_out_file = out_file;}
XP_File GetOutFile() {return m_out_file;}
void SetWriteMozillaStatus(PRBool writeMozStatus)
{m_writeMozillaStatus = writeMozStatus;}
virtual int StartNewEnvelope(const char *line, PRUint32 lineLength);
virtual void FinishHeader();
virtual PRInt32 ParseFolderLine(const char *line, PRUint32 lineLength);
virtual PRInt32 ParseBlock(const char *block, PRUint32 lineLength);
virtual void Clear();
void AdvanceOutPosition(PRUint32 amountToAdvance);
void SetWriteToOutFile(PRBool writeToOutFile) {m_writeToOutFile = writeToOutFile;}
void FlushOutputBuffer();
PRUint32 m_bytes_written;
protected:
static PRInt32 LineBufferCallback(char *line, PRUint32 lineLength, void *closure);
PRBool m_wroteXMozillaStatus;
PRBool m_writeMozillaStatus;
PRBool m_writeToOutFile;
PRBool m_lastBodyLineEmpty;
XP_File m_out_file;
PRUint32 m_ouputBufferSize;
char *m_outputBuffer;
PRUint32 m_outputBufferIndex;
};
#endif /* #ifdef NEW_MAIL_HANDLED */
#endif

View File

@ -2704,73 +2704,6 @@ nsresult nsPop3Protocol::ProcessProtocolState(nsIURI * url, nsIInputStream * aIn
break;
}
#if 0
PR_ASSERT(net_pop3_username);
if (TestFlag(POP3_PASSWORD_FAILED))
fmt2 =
XP_GetString( XP_THE_PREVIOUSLY_ENTERED_PASSWORD_IS_INVALID_ETC );
else if (!net_pop3_password)
fmt1 =
XP_GetString( XP_PASSWORD_FOR_POP3_USER );
if (fmt1 || fmt2) /* We need to read a password. */
{
char *password;
char *host = NET_ParseURL(ce->URL_s->address,
GET_HOST_PART);
size_t len = (PL_strlen(fmt1 ? fmt1 : fmt2) +
(host ? PL_strlen(host) : 0) + 300)
* sizeof(char);
char *prompt = (char *) PR_CALLOC (len);
#if defined(CookiesAndSignons)
char *usernameAndHost=0;
#endif
if (!prompt) {
PR_FREEIF(host);
net_pop3_block = PR_FALSE;
return MK_OUT_OF_MEMORY;
}
if (fmt1)
PR_snprintf (prompt, len, fmt1, net_pop3_username, host);
else
PR_snprintf (prompt, len, fmt2,
(m_commandResponse.Length()
? m_commandResponse.get()
: XP_GetString(XP_NO_ANSWER)),
net_pop3_username, host);
#if defined(CookiesAndSignons)
NS_MsgSACopy(&usernameAndHost, net_pop3_username);
NS_MsgSACat(&usernameAndHost, "@");
NS_MsgSACat(&usernameAndHost, host);
PR_FREEIF (host);
password = SI_PromptPassword
(ce->window_id,
prompt, usernameAndHost,
nsIPrompt::SAVE_PASSWORD_PERMANENTLY, !TestFlag(POP3_PASSWORD_FAILED));
ClearFlag(POP3_PASSWORD_FAILED);
PR_Free(usernameAndHost);
#else
PR_FREEIF (host);
ClearFlag(POP3_PASSWORD_FAILED);
password = FE_PromptPassword
(ce->window_id, prompt);
#endif
PR_Free(prompt);
if (password == NULL)
{
net_pop3_block = PR_FALSE;
return NS_OK;
}
net_set_pop3_password(password);
memset(password, 0, PL_strlen(password));
PR_Free(password);
net_pop3_password_pending = PR_TRUE;
}
#endif
if (m_username.IsEmpty() || !pwd )
{
m_pop3ConData->next_state = POP3_ERROR_DONE;

View File

@ -125,7 +125,7 @@ NS_IMETHODIMP nsPop3Service::CheckForNewMail(nsIMsgWindow* aMsgWindow,
// characters like / % or @
char * urlSpec = PR_smprintf("pop3://%s@%s:%d/?check", (const char *)escapedUsername, (const char *)popHost, popPort);
rv = BuildPop3Url(urlSpec, inbox, popServer, aUrlListener, getter_AddRefs(url), aMsgWindow);
PR_FREEIF(urlSpec);
PR_Free(urlSpec);
}
@ -187,7 +187,7 @@ nsresult nsPop3Service::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener * aU
rv = BuildPop3Url(urlSpec, aInbox, popServer, aUrlListener, getter_AddRefs(url), aMsgWindow);
}
PR_FREEIF(urlSpec);
PR_Free(urlSpec);
}
if (NS_SUCCEEDED(rv) && url)

View File

@ -76,11 +76,11 @@ nsPop3Sink::nsPop3Sink()
nsPop3Sink::~nsPop3Sink()
{
PR_FREEIF(m_accountUrl);
PR_FREEIF(m_outputBuffer);
PR_Free(m_accountUrl);
PR_Free(m_outputBuffer);
NS_IF_RELEASE(m_popServer);
ReleaseFolderLock();
NS_IF_RELEASE(m_folder);
NS_IF_RELEASE(m_folder);
NS_IF_RELEASE(m_newMailParser);
}
@ -113,7 +113,7 @@ nsPop3Sink::SetMailAccountURL(const char* urlString)
{
if (urlString)
{
PR_FREEIF(m_accountUrl);
PR_Free(m_accountUrl);
m_accountUrl = PL_strdup(urlString);
}