remove unused verify address code, r/sr=bienvenu 489835
authorLudovic Hirlimann <ludovic@mozillamessaging.com>
Thu, 23 Apr 2009 14:22:22 -0700
changeset 2467 6fe4d5047b43e4f08cbbeca31526bd0fc34c4fc4
parent 2466 3fe3e732c210ebd3516ebbacc96e9acf963141bf
child 2468 b7fd81f51c6e895f742fedf44f8d7600ffe55057
push idunknown
push userunknown
push dateunknown
bugs489835
remove unused verify address code, r/sr=bienvenu 489835
mailnews/compose/src/nsSmtpProtocol.cpp
mailnews/compose/src/nsSmtpProtocol.h
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -241,17 +241,16 @@ nsSmtpProtocol::nsSmtpProtocol(nsIURI * 
 {
     Initialize(aURL);
 }
 
 nsSmtpProtocol::~nsSmtpProtocol()
 {
   // free our local state
   PR_Free(m_addressCopy);
-  PR_Free(m_verifyAddress);
   PR_Free(m_dataBuf);
   delete m_lineStreamBuffer;
 }
 
 void nsSmtpProtocol::Initialize(nsIURI * aURL)
 {
     NS_PRECONDITION(aURL, "invalid URL passed into Smtp Protocol");
     nsresult rv = NS_OK;
@@ -286,17 +285,16 @@ void nsSmtpProtocol::Initialize(nsIURI *
     m_responseCode = 0;
     m_previousResponseCode = 0;
     m_continuationResponse = -1;
     m_tlsEnabled = PR_FALSE;
     m_addressCopy = nsnull;
     m_addresses = nsnull;
     m_addressesLeft = 0;
 
-    m_verifyAddress = nsnull;
 #ifdef UNREADY_CODE
     m_totalAmountWritten = 0;
 #endif /* UNREADY_CODE */
 
     m_sendDone = PR_FALSE;
 
     m_sizelimit = 0;
     m_totalMessageSize = 0;
@@ -593,102 +591,86 @@ PRInt32 nsSmtpProtocol::SendHeloResponse
   nsCString emailAddress;
   nsCOMPtr <nsIMsgIdentity> senderIdentity;
   rv = m_runningURL->GetSenderIdentity(getter_AddRefs(senderIdentity));
   if (NS_FAILED(rv) || !senderIdentity)
   {
     m_urlErrorState = NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS;
     return(NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS);
   }
-  else
-  {
-    senderIdentity->GetEmail(emailAddress);
-  }
+  senderIdentity->GetEmail(emailAddress);
 
   if (emailAddress.IsEmpty())
   {
     m_urlErrorState = NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS;
     return(NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS);
   }
 
-  if(m_verifyAddress)
-  {
-    buffer += "VRFY";
-    buffer += m_verifyAddress;
-    buffer += CRLF;
-  }
-  else
+  nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
+  nsCString fullAddress;
+  if (parser)
   {
-    /* else send the MAIL FROM: command */
-    nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
-    nsCString fullAddress;
-    if (parser)
-    {
-      // pass nsnull for the name, since we just want the email.
-      //
-      // seems a little weird that we are passing in the emailAddress
-      // when that's the out parameter
-      parser->MakeFullAddressString(nsnull, emailAddress.get(),
-                                    getter_Copies(fullAddress));
-    }
+    // pass nsnull for the name, since we just want the email.
+    //
+    // seems a little weird that we are passing in the emailAddress
+    // when that's the out parameter
+    parser->MakeFullAddressString(nsnull, emailAddress.get(),
+                                  getter_Copies(fullAddress));
+  }
 
-    buffer = "MAIL FROM:<";
-    buffer += fullAddress;
-    buffer += ">";
+  buffer = "MAIL FROM:<";
+  buffer += fullAddress;
+  buffer += ">";
 
-    if (TestFlag(SMTP_EHLO_DSN_ENABLED))
-    {
-      PRBool requestDSN = PR_FALSE;
-      rv = m_runningURL->GetRequestDSN(&requestDSN);
+  if (TestFlag(SMTP_EHLO_DSN_ENABLED))
+  {
+    PRBool requestDSN = PR_FALSE;
+    rv = m_runningURL->GetRequestDSN(&requestDSN);
 
-      if (requestDSN)
-      {
-        nsCOMPtr <nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
-        NS_ENSURE_SUCCESS(rv,rv);
+    if (requestDSN)
+    {
+      nsCOMPtr <nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
+      NS_ENSURE_SUCCESS(rv,rv);
 
-        nsCOMPtr<nsIPrefBranch> prefBranch;
-        rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
-        NS_ENSURE_SUCCESS(rv,rv);
+      nsCOMPtr<nsIPrefBranch> prefBranch;
+      rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
+      NS_ENSURE_SUCCESS(rv,rv);
 
-        PRBool requestRetFull = PR_FALSE;
-        rv = prefBranch->GetBoolPref("mail.dsn.ret_full_on", &requestRetFull);
+      PRBool requestRetFull = PR_FALSE;
+      rv = prefBranch->GetBoolPref("mail.dsn.ret_full_on", &requestRetFull);
 
-        buffer += requestRetFull ? " RET=FULL" : " RET=HDRS";
+      buffer += requestRetFull ? " RET=FULL" : " RET=HDRS";
 
-        char* msgID = msg_generate_message_id(senderIdentity);
-        buffer += " ENVID=";
-        buffer += msgID;
-
-        PR_Free(msgID);
-      }
-    }
+      char* msgID = msg_generate_message_id(senderIdentity);
+      buffer += " ENVID=";
+      buffer += msgID;
 
-    if(TestFlag(SMTP_EHLO_SIZE_ENABLED))
-    {
-      buffer.Append(" SIZE=");
-      buffer.AppendInt(m_totalMessageSize);
+      PR_Free(msgID);
     }
-    buffer += CRLF;
   }
 
+  if(TestFlag(SMTP_EHLO_SIZE_ENABLED))
+  {
+    buffer.Append(" SIZE=");
+    buffer.AppendInt(m_totalMessageSize);
+  }
+  buffer += CRLF;
+
   nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
   status = SendData(url, buffer.get());
 
   m_nextState = SMTP_RESPONSE;
 
-  if(m_verifyAddress)
-    m_nextStateAfterResponse = SMTP_SEND_VRFY_RESPONSE;
-  else
-    m_nextStateAfterResponse = SMTP_SEND_MAIL_RESPONSE;
+
+  m_nextStateAfterResponse = SMTP_SEND_MAIL_RESPONSE;
   SetFlag(SMTP_PAUSE_FOR_READ);
 
   return(status);
 }
 
-
 PRInt32 nsSmtpProtocol::SendEhloResponse(nsIInputStream * inputStream, PRUint32 length)
 {
     PRInt32 status = 0;
     nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
 
     if (m_responseCode != 250)
     {
         /* EHLO must not be implemented by the server, so fall back to the HELO case
@@ -1309,31 +1291,16 @@ PRInt32 nsSmtpProtocol::AuthLoginStep2()
     m_nextStateAfterResponse = SMTP_AUTH_LOGIN_RESPONSE;
     SetFlag(SMTP_PAUSE_FOR_READ);
     return (status);
   }
 
   return -1;
 }
 
-PRInt32 nsSmtpProtocol::SendVerifyResponse()
-{
-#if 0
-  PRInt32 status = 0;
-  char buffer[512];
-
-  if(m_responseCode == 250 || m_responseCode == 251)
-    return(NS_USER_VERIFIED_BY_SMTP);
-  else
-    return(NS_USER_NOT_VERIFIED_BY_SMTP);
-#else
-  PR_ASSERT(0);
-  return(-1);
-#endif
-}
 
 PRInt32 nsSmtpProtocol::SendMailResponse()
 {
   PRInt32 status = 0;
   nsCAutoString buffer;
   nsresult rv;
 
   if (m_responseCode/10 != 25)
@@ -1774,22 +1741,16 @@ nsresult nsSmtpProtocol::LoadUrl(nsIURI 
       case SMTP_SEND_AUTH_LOGIN_STEP1:
         status = AuthLoginStep1();
         break;
 
       case SMTP_SEND_AUTH_LOGIN_STEP2:
         status = AuthLoginStep2();
         break;
 
-      case SMTP_SEND_VRFY_RESPONSE:
-        if (inputStream == nsnull)
-          SetFlag(SMTP_PAUSE_FOR_READ);
-        else
-          status = SendVerifyResponse();
-        break;
 
       case SMTP_SEND_MAIL_RESPONSE:
         if (inputStream == nsnull)
           SetFlag(SMTP_PAUSE_FOR_READ);
         else
           status = SendMailResponse();
         break;
 
--- a/mailnews/compose/src/nsSmtpProtocol.h
+++ b/mailnews/compose/src/nsSmtpProtocol.h
@@ -50,37 +50,36 @@
  /* states of the machine
  */
 typedef enum _SmtpState {
 SMTP_RESPONSE = 0,                                  // 0
 SMTP_START_CONNECT,                                 // 1
 SMTP_FINISH_CONNECT,                                // 2
 SMTP_SEND_HELO_RESPONSE,                            // 3
 SMTP_SEND_EHLO_RESPONSE,                            // 4
-SMTP_SEND_VRFY_RESPONSE,                            // 5
-SMTP_SEND_MAIL_RESPONSE,                            // 6
-SMTP_SEND_RCPT_RESPONSE,                            // 7
-SMTP_SEND_DATA_RESPONSE,                            // 8
-SMTP_SEND_POST_DATA,                                // 9
-SMTP_SEND_MESSAGE_RESPONSE,                         // 10
-SMTP_DONE,                                          // 11
-SMTP_ERROR_DONE,                                    // 12
-SMTP_FREE,                                          // 13
-SMTP_AUTH_LOGIN_STEP0_RESPONSE,                     // 14
-SMTP_EXTN_LOGIN_RESPONSE,                           // 15
-SMTP_SEND_AUTH_LOGIN_STEP0,                         // 16
-SMTP_SEND_AUTH_LOGIN_STEP1,                         // 17
-SMTP_SEND_AUTH_LOGIN_STEP2,                         // 18
-SMTP_AUTH_LOGIN_RESPONSE,                           // 19
-SMTP_TLS_RESPONSE,                                  // 20
-SMTP_AUTH_EXTERNAL_RESPONSE,                        // 21
-SMTP_AUTH_PROCESS_STATE,                            // 22
-SMTP_AUTH_CRAM_MD5_CHALLENGE_RESPONSE,              // 23
-SMTP_SEND_AUTH_GSSAPI_FIRST,                        // 24
-SMTP_SEND_AUTH_GSSAPI_STEP                          // 25
+SMTP_SEND_MAIL_RESPONSE,                            // 5
+SMTP_SEND_RCPT_RESPONSE,                            // 6
+SMTP_SEND_DATA_RESPONSE,                            // 7
+SMTP_SEND_POST_DATA,                                // 8
+SMTP_SEND_MESSAGE_RESPONSE,                         // 9
+SMTP_DONE,                                          // 10
+SMTP_ERROR_DONE,                                    // 11
+SMTP_FREE,                                          // 12
+SMTP_AUTH_LOGIN_STEP0_RESPONSE,                     // 13
+SMTP_EXTN_LOGIN_RESPONSE,                           // 14
+SMTP_SEND_AUTH_LOGIN_STEP0,                         // 15
+SMTP_SEND_AUTH_LOGIN_STEP1,                         // 16
+SMTP_SEND_AUTH_LOGIN_STEP2,                         // 17
+SMTP_AUTH_LOGIN_RESPONSE,                           // 18
+SMTP_TLS_RESPONSE,                                  // 19
+SMTP_AUTH_EXTERNAL_RESPONSE,                        // 20
+SMTP_AUTH_PROCESS_STATE,                            // 21
+SMTP_AUTH_CRAM_MD5_CHALLENGE_RESPONSE,              // 22
+SMTP_SEND_AUTH_GSSAPI_FIRST,                        // 23
+SMTP_SEND_AUTH_GSSAPI_STEP                          // 24
 } SmtpState;
 
 // State Flags (Note, I use the word state in terms of storing 
 // state information about the connection (authentication, have we sent
 // commands, etc. I do not intend it to refer to protocol state)
 #define SMTP_PAUSE_FOR_READ             0x00000001  /* should we pause for the next read */
 #define SMTP_ESMTP_SERVER               0x00000002
 #define SMTP_EHLO_DSN_ENABLED           0x00000004
@@ -159,17 +158,16 @@ private:
     PRInt32 m_previousResponseCode; 
     PRInt32 m_continuationResponse;
     nsCString m_responseText;   /* text returned from Smtp server */
     nsMsgLineStreamBuffer *m_lineStreamBuffer; // used to efficiently extract lines from the incoming data stream
 
     char           *m_addressCopy;
     char           *m_addresses;
     PRUint32       m_addressesLeft;
-    char           *m_verifyAddress;
     nsCString m_mailAddr;
     nsCString m_helloArgument;
     PRInt32        m_sizelimit;
 
     // *** the following should move to the smtp server when we support
     // multiple smtp servers
     PRInt32 m_prefAuthMethod;
     PRBool m_prefUseSecAuth;
@@ -222,17 +220,16 @@ private:
     PRInt32 AuthGSSAPIStep();
     PRInt32 AuthLoginStep0();
     PRInt32 AuthLoginStep0Response();
     PRInt32 AuthLoginStep1();
     PRInt32 AuthLoginStep2();
     PRInt32 AuthLoginResponse(nsIInputStream * stream, PRUint32 length);
 
     PRInt32 SendTLSResponse();
-    PRInt32 SendVerifyResponse(); // mscott: this one is apparently unimplemented...
     PRInt32 SendMailResponse();
     PRInt32 SendRecipientResponse();
     PRInt32 SendDataResponse();
     PRInt32 SendPostData();
     PRInt32 SendMessageResponse();
     PRInt32 CramMD5LoginResponse();
     PRInt32 ProcessAuth();