From b575970341caadd851c641d22d025b921037f1dc Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Wed, 22 Sep 1999 02:28:36 +0000 Subject: [PATCH] Add some basic status messages for sending a message. --- mailnews/compose/src/nsSmtpProtocol.cpp | 40 +++++++++++++++---------- mailnews/compose/src/nsSmtpProtocol.h | 3 ++ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/mailnews/compose/src/nsSmtpProtocol.cpp b/mailnews/compose/src/nsSmtpProtocol.cpp index dbdeac4b4286..ec015ed540d1 100644 --- a/mailnews/compose/src/nsSmtpProtocol.cpp +++ b/mailnews/compose/src/nsSmtpProtocol.cpp @@ -25,7 +25,7 @@ #include "nsIMsgHeaderParser.h" #include "nsFileStream.h" #include "nsIMsgMailNewsUrl.h" - +#include "nsMsgComposeStringBundle.h" #include "nsMsgBaseCID.h" #include "prtime.h" @@ -340,6 +340,22 @@ PRInt32 nsSmtpProtocol::ReadLine(nsIInputStream * inputStream, PRUint32 length, return numBytesRead; } +void nsSmtpProtocol::UpdateStatus(PRInt32 aStatusID) +{ + if (m_statusFeedback) + { + PRUnichar * statusString = ComposeGetStringByID(aStatusID); + UpdateStatusWithString(statusString); + nsCRT::free(statusString); + } +} + +void nsSmtpProtocol::UpdateStatusWithString(PRUnichar * aStatusString) +{ + if (m_statusFeedback && aStatusString) + m_statusFeedback->ShowStatusString(aStatusString); +} + ///////////////////////////////////////////////////////////////////////////////////////////// // Begin protocol state machine functions... ////////////////////////////////////////////////////////////////////////////////////////////// @@ -970,9 +986,7 @@ PRInt32 nsSmtpProtocol::SendDataResponse() m_nextState = SMTP_SEND_POST_DATA; ClearFlag(SMTP_PAUSE_FOR_READ); /* send data directly */ -#ifdef UNREADY_CODE - NET_Progress(CE_WINDOW_ID, XP_GetString(MK_MSG_DELIV_MAIL)); -#endif /* UNREADY_CODE */ + UpdateStatus(SMTP_DELIV_MAIL); #ifdef UNREADY_CODE /* get the size of the message */ @@ -1114,13 +1128,10 @@ PRInt32 nsSmtpProtocol::SendMessageInFile() // always issue a '.' and CRLF when we are done... nsCOMPtr url = do_QueryInterface(m_runningURL); SendData(url, CRLF "." CRLF); -#ifdef UNREADY_CODE - NET_Progress(CE_WINDOW_ID, - XP_GetString(XP_MESSAGE_SENT_WAITING_MAIL_REPLY)); -#endif /* UNREADY_CODE */ - m_nextState = SMTP_RESPONSE; - m_nextStateAfterResponse = SMTP_SEND_MESSAGE_RESPONSE; - return(0); + UpdateStatus(SMTP_MESSAGE_SENT_WAITING_MAIL_REPLY); + m_nextState = SMTP_RESPONSE; + m_nextStateAfterResponse = SMTP_SEND_MESSAGE_RESPONSE; + return(0); } PRInt32 nsSmtpProtocol::SendPostData() @@ -1179,10 +1190,9 @@ PRInt32 nsSmtpProtocol::SendMessageResponse() return(MK_ERROR_SENDING_MESSAGE); } -#ifdef UNREADY_CODE - NET_Progress(CE_WINDOW_ID, XP_GetString(XP_PROGRESS_MAILSENT)); -#endif - /* else */ + UpdateStatus(SMTP_PROGRESS_MAILSENT); + + /* else */ nsCOMPtr url = do_QueryInterface(m_runningURL); SendData(url, "quit"CRLF); // send a quit command to close the connection with the server. m_nextState = SMTP_DONE; diff --git a/mailnews/compose/src/nsSmtpProtocol.h b/mailnews/compose/src/nsSmtpProtocol.h index bdb83127b78c..5021f7c3a653 100644 --- a/mailnews/compose/src/nsSmtpProtocol.h +++ b/mailnews/compose/src/nsSmtpProtocol.h @@ -126,6 +126,9 @@ private: PRInt32 ReadLine(nsIInputStream * inputStream, PRUint32 length, char ** line); + void UpdateStatus(PRInt32 aStatusID); + void UpdateStatusWithString(PRUnichar * aStatusString); + //////////////////////////////////////////////////////////////////////////////////////// // Protocol Methods --> This protocol is state driven so each protocol method is // designed to re-act to the current "state". I've attempted to