Bug 731262 - Warning cleanup part 2. r=bienvenu
authorIrving Reid <irving@mozilla.com>
Fri, 10 Feb 2012 16:25:59 -0500
changeset 11028 946cf51e832725b778ac63e566d45e88b30f33a2
parent 11027 0683a22dac2b2936542fa3fef62d3adbfcdbdf24
child 11029 b7630ce0ad582e2cf3f5437fff581e706b2b0256
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu
bugs731262
Bug 731262 - Warning cleanup part 2. r=bienvenu
mailnews/base/src/nsMsgDBView.cpp
mailnews/base/util/nsMsgProtocol.cpp
mailnews/base/util/nsMsgProtocol.h
mailnews/compose/src/nsSmtpProtocol.cpp
mailnews/compose/src/nsSmtpProtocol.h
mailnews/local/src/nsPop3Protocol.cpp
mailnews/local/src/nsPop3Protocol.h
mailnews/news/src/nsNNTPProtocol.cpp
mailnews/news/src/nsNNTPProtocol.h
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -5453,17 +5453,19 @@ nsMsgViewIndex nsMsgDBView::FindParentIn
       break;
 
     msgHdr->GetThreadParent(&parentKey);
   }
 
   return startOfThreadViewIndex;
 }
 
-nsresult nsMsgDBView::ListIdsInThreadOrder(nsIMsgThread *threadHdr, nsMsgKey parentKey, PRInt32 level, nsMsgViewIndex *viewIndex, PRUint32 *pNumListed)
+nsresult nsMsgDBView::ListIdsInThreadOrder(nsIMsgThread *threadHdr, nsMsgKey parentKey,
+                                           PRUint32 level, nsMsgViewIndex *viewIndex,
+                                           PRUint32 *pNumListed)
 {
   nsresult rv = NS_OK;
   nsCOMPtr <nsISimpleEnumerator> msgEnumerator;
   threadHdr->EnumerateMessages(parentKey, getter_AddRefs(msgEnumerator));
   PRUint32 numChildren;
   (void) threadHdr->GetNumChildren(&numChildren);
   NS_ASSERTION(numChildren, "Empty thread in view/db");
   if (!numChildren)
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -364,26 +364,25 @@ nsresult nsMsgProtocol::CloseSocket()
 * Writes the data contained in dataBuffer into the current output stream. It also informs
 * the transport layer that this data is now available for transmission.
 * Returns a positive number for success, 0 for failure (not all the bytes were written to the
 * stream, etc). We need to make another pass through this file to install an error system (mscott)
 *
 * No logging is done in the base implementation, so aSuppressLogging is ignored.
 */
 
-PRInt32 nsMsgProtocol::SendData(nsIURI * aURL, const char * dataBuffer, bool aSuppressLogging)
+nsresult nsMsgProtocol::SendData(const char * dataBuffer, bool aSuppressLogging)
 {
   PRUint32 writeCount = 0;
-  PRInt32 status = 0;
 
-  //  NS_PRECONDITION(m_outputStream, "oops....we don't have an output stream...how did that happen?");
   if (dataBuffer && m_outputStream)
-    status = m_outputStream->Write(dataBuffer, PL_strlen(dataBuffer), &writeCount);
-
-  return status;
+    return m_outputStream->Write(dataBuffer, PL_strlen(dataBuffer), &writeCount);
+    // TODO make sure all the bytes in PL_strlen(dataBuffer) were written
+  else
+    return NS_ERROR_INVALID_ARG;
 }
 
 // Whenever data arrives from the connection, core netlib notifices the protocol by calling
 // OnDataAvailable. We then read and process the incoming data from the input stream.
 NS_IMETHODIMP nsMsgProtocol::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
 {
   // right now, this really just means turn around and churn through the state machine
   nsCOMPtr<nsIURI> uri = do_QueryInterface(ctxt);
@@ -870,17 +869,18 @@ nsresult nsMsgProtocol::PostMessage(nsIU
       line.Insert('.', 0);
     line.Append(NS_LITERAL_CSTRING(CRLF));
     outputBuffer.Append(line);
     // test hack by mscott. If our buffer is almost full, then
     // send it off & reset ourselves
     // to make more room.
     if (outputBuffer.Length() > POST_DATA_BUFFER_SIZE || !more)
     {
-      SendData(url, outputBuffer.get());
+      rv = SendData(outputBuffer.get());
+      NS_ENSURE_SUCCESS(rv, rv);
       // does this keep the buffer around? That would be best.
       // Maybe SetLength(0) instead?
       outputBuffer.Truncate();
     }
   } while (more);
 
   return NS_OK;
 }
@@ -1329,17 +1329,19 @@ nsresult nsMsgAsyncWriteProtocol::Update
   else
     mSuspendedReadBytes += aNewBytes;
 
   return NS_OK;
 }
 
 nsresult nsMsgAsyncWriteProtocol::PostDataFinished()
 {
-  SendData(nsnull, "." CRLF);
+  nsresult rv = SendData("." CRLF);
+  if (NS_FAILED(rv))
+    return rv;
   mGenerateProgressNotifications = false;
   mPostDataStream = nsnull;
   return NS_OK;
 }
 
 nsresult nsMsgAsyncWriteProtocol::ProcessIncomingPostData(nsIInputStream *inStr, PRUint32 count)
 {
   if (!m_socketIsOpen) return NS_OK; // kick out if the socket was canceled
@@ -1549,21 +1551,20 @@ void nsMsgAsyncWriteProtocol::UpdateProg
 
     // XXX not sure if m_request is correct here
     webProgressListener->OnProgressChange(nsnull, m_request, mNumBytesPosted, mFilePostSize, mNumBytesPosted, mFilePostSize);
   }
 
   return;
 }
 
-PRInt32 nsMsgAsyncWriteProtocol::SendData(nsIURI * aURL, const char * dataBuffer, bool aSuppressLogging)
+nsresult nsMsgAsyncWriteProtocol::SendData(const char * dataBuffer, bool aSuppressLogging)
 {
   this->mAsyncBuffer.Append(dataBuffer);
-  mAsyncOutStream->AsyncWait(mProvider, 0, 0, mProviderThread);
-  return NS_OK;
+  return mAsyncOutStream->AsyncWait(mProvider, 0, 0, mProviderThread);
 }
 
 #define MSGS_URL    "chrome://messenger/locale/messenger.properties"
 
 PRUnichar *FormatStringWithHostNameByID(PRInt32 stringID, nsIMsgMailNewsUrl *msgUri)
 {
   if (!msgUri)
     return nsnull;
--- a/mailnews/base/util/nsMsgProtocol.h
+++ b/mailnews/base/util/nsMsgProtocol.h
@@ -144,17 +144,17 @@ protected:
   virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream, 
                   PRUint32 sourceOffset, PRUint32 length) = 0;
 
   // SendData -- Writes the data contained in dataBuffer into the current output stream. 
   // It also informs the transport layer that this data is now available for transmission.
   // Returns a positive number for success, 0 for failure (not all the bytes were written to the
   // stream, etc). 
     // aSuppressLogging is a hint that sensitive data is being sent and should not be logged
-  virtual PRInt32 SendData(nsIURI * aURL, const char * dataBuffer, bool aSuppressLogging = false);
+  virtual nsresult SendData(const char * dataBuffer, bool aSuppressLogging = false);
 
   virtual nsresult PostMessage(nsIURI* url, nsIFile* aPostFile);
 
   virtual nsresult InitFromURI(nsIURI *aUrl);
 
   nsresult DoNtlmStep1(const char *username, const char *password, nsCString &response);
   nsresult DoNtlmStep2(nsCString &commandResponse, nsCString &response);
 
@@ -218,17 +218,17 @@ public:
   nsMsgAsyncWriteProtocol(nsIURI * aURL);
   virtual ~nsMsgAsyncWriteProtocol(); 
   
   // temporary over ride...
   virtual nsresult PostMessage(nsIURI* url, nsIFile *postFile);
   
   // over ride the following methods from the base class
   virtual nsresult SetupTransportState();
-  virtual PRInt32 SendData(nsIURI * aURL, const char * dataBuffer, bool aSuppressLogging = false);
+  virtual nsresult SendData(const char * dataBuffer, bool aSuppressLogging = false);
   nsCString mAsyncBuffer;
 
   // if we suspended the asynch write while waiting for more data to write then this will be TRUE
   bool mSuspendedWrite;
   nsCOMPtr<nsIRequest>     m_WriteRequest;
   nsCOMPtr<nsIAsyncOutputStream>    mAsyncOutStream;
   nsCOMPtr<nsIOutputStreamCallback> mProvider;
   nsCOMPtr<nsIThread>               mProviderThread;
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -559,19 +559,17 @@ PRInt32 nsSmtpProtocol::ExtensionLoginRe
     m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
     return NS_ERROR_SMTP_AUTH_FAILURE;
   }
 
   nsCAutoString buffer("EHLO ");
   AppendHelloArgument(buffer);
   buffer += CRLF;
 
-  nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
-
-  status = SendData(url, buffer.get());
+  status = SendData(buffer.get());
 
   m_nextState = SMTP_RESPONSE;
   m_nextStateAfterResponse = SMTP_SEND_EHLO_RESPONSE;
   SetFlag(SMTP_PAUSE_FOR_READ);
 
   return(status);
 }
 
@@ -669,32 +667,30 @@ PRInt32 nsSmtpProtocol::SendHeloResponse
 
   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());
+  status = SendData(buffer.get());
 
   m_nextState = SMTP_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
          * if command is unrecognized or unimplemented.
          */
         if (m_responseCode == 500 || m_responseCode == 502)
         {
@@ -708,17 +704,17 @@ PRInt32 nsSmtpProtocol::SendEhloResponse
                 m_urlErrorState = NS_ERROR_STARTTLS_FAILED_EHLO_STARTTLS;
                 return(NS_ERROR_STARTTLS_FAILED_EHLO_STARTTLS);
             }
 
             nsCAutoString buffer("HELO ");
             AppendHelloArgument(buffer);
             buffer += CRLF;
 
-            status = SendData(url, buffer.get());
+            status = SendData(buffer.get());
 
             m_nextState = SMTP_RESPONSE;
             m_nextStateAfterResponse = SMTP_SEND_HELO_RESPONSE;
             SetFlag(SMTP_PAUSE_FOR_READ);
             return (status);
         }
         /* e.g. getting 421 "Server says unauthorized, bye" or
          * 501 "Syntax error in EHLOs parameters or arguments"
@@ -958,34 +954,33 @@ void nsSmtpProtocol::ResetAuthMethods()
   m_currentAuthMethod = 0;
   m_failedAuthMethods = 0;
 }
 
 PRInt32 nsSmtpProtocol::ProcessAuth()
 {
     PRInt32 status = 0;
     nsCAutoString buffer;
-    nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
 
     if (!m_tlsEnabled)
     {
         if (TestFlag(SMTP_EHLO_STARTTLS_ENABLED))
         {
             // Do not try to combine SMTPS with STARTTLS.
             // If nsMsgSocketType::SSL is set,
             // we are alrady using a secure connection.
             // Do not attempt to do STARTTLS,
             // even if server offers it.
             if (m_prefSocketType == nsMsgSocketType::trySTARTTLS ||
                 m_prefSocketType == nsMsgSocketType::alwaysSTARTTLS)
             {
                 buffer = "STARTTLS";
                 buffer += CRLF;
 
-                status = SendData(url, buffer.get());
+                status = SendData(buffer.get());
 
                 m_tlsInitiated = true;
 
                 m_nextState = SMTP_RESPONSE;
                 m_nextStateAfterResponse = SMTP_TLS_RESPONSE;
                 SetFlag(SMTP_PAUSE_FOR_READ);
                 return status;
             }
@@ -1008,17 +1003,17 @@ PRInt32 nsSmtpProtocol::ProcessAuth()
     m_nextState = SMTP_SEND_HELO_RESPONSE;
     // fake to 250 because SendHeloResponse() tests for this
     m_responseCode = 250;
   }
   else if (m_currentAuthMethod == SMTP_AUTH_EXTERNAL_ENABLED)
   {
     buffer = "AUTH EXTERNAL =";
     buffer += CRLF;
-    SendData(url, buffer.get());
+    SendData(buffer.get());
     m_nextState = SMTP_RESPONSE;
     m_nextStateAfterResponse = SMTP_AUTH_EXTERNAL_RESPONSE;
     SetFlag(SMTP_PAUSE_FOR_READ);
     return NS_OK;
   }
   else if (m_currentAuthMethod == SMTP_AUTH_GSSAPI_ENABLED)
   {
     m_nextState = SMTP_SEND_AUTH_GSSAPI_FIRST;
@@ -1215,18 +1210,17 @@ PRInt32 nsSmtpProtocol::AuthGSSAPIFirst(
     return 0;
   }
   else
     command.Append(resp);
   command.Append(CRLF);
   m_nextState = SMTP_RESPONSE;
   m_nextStateAfterResponse = SMTP_SEND_AUTH_GSSAPI_STEP;
   SetFlag(SMTP_PAUSE_FOR_READ);
-  nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
-  return SendData(url, command.get());
+  return SendData(command.get());
 }
 
 // GSSAPI may consist of multiple round trips
 
 PRInt32 nsSmtpProtocol::AuthGSSAPIStep()
 {
   PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("SMTP: GSSAPI auth step 2"));
   NS_ASSERTION(m_currentAuthMethod == SMTP_AUTH_GSSAPI_ENABLED, "called in invalid state");
@@ -1243,18 +1237,17 @@ PRInt32 nsSmtpProtocol::AuthGSSAPIStep()
   if (NS_FAILED(rv))
     cmd = "*";
   cmd += CRLF;
 
   m_nextStateAfterResponse = (rv == NS_SUCCESS_AUTH_FINISHED)?SMTP_AUTH_LOGIN_RESPONSE:SMTP_SEND_AUTH_GSSAPI_STEP;
   m_nextState = SMTP_RESPONSE;
   SetFlag(SMTP_PAUSE_FOR_READ);
 
-  nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
-  return SendData(url, cmd.get());
+  return SendData(cmd.get());
 }
 
 
 // LOGIN and MSN consist of three steps (MSN not through the mechanism
 // but by non-RFC2821 compliant implementation in MS servers) not two as
 // PLAIN or CRAM-MD5, so we've to start here and continue with AuthStep1
 // if the server responds with with a 3xx code to "AUTH LOGIN" or "AUTH MSN"
 PRInt32 nsSmtpProtocol::AuthLoginStep0()
@@ -1264,17 +1257,17 @@ PRInt32 nsSmtpProtocol::AuthLoginStep0()
         "called in invalid state");
     PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("SMTP: MSN or LOGIN auth, step 0"));
     nsCAutoString command(m_currentAuthMethod == SMTP_AUTH_MSN_ENABLED
         ? "AUTH MSN" CRLF : "AUTH LOGIN" CRLF);
     m_nextState = SMTP_RESPONSE;
     m_nextStateAfterResponse = SMTP_AUTH_LOGIN_STEP0_RESPONSE;
     SetFlag(SMTP_PAUSE_FOR_READ);
 
-    return SendData(m_url, command.get());
+    return SendData(command.get());
 }
 
 PRInt32 nsSmtpProtocol::AuthLoginStep0Response()
 {
     NS_ASSERTION(m_currentAuthMethod == SMTP_AUTH_MSN_ENABLED ||
         m_currentAuthMethod == SMTP_AUTH_LOGIN_ENABLED,
         "called in invalid state");
     // need the test to be here instead in AuthLoginResponse() to
@@ -1352,18 +1345,17 @@ PRInt32 nsSmtpProtocol::AuthLoginStep1()
     PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("LOGIN auth"));
     base64Str = PL_Base64Encode(username.get(),
         username.Length(), nsnull);
     PR_snprintf(buffer, sizeof(buffer), "%.256s" CRLF, base64Str);
   }
   else
     return (NS_ERROR_COMMUNICATIONS_ERROR);
 
-  nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
-  status = SendData(url, buffer, true);
+  status = SendData(buffer, true);
   m_nextState = SMTP_RESPONSE;
   m_nextStateAfterResponse = SMTP_AUTH_LOGIN_RESPONSE;
   SetFlag(SMTP_PAUSE_FOR_READ);
   NS_Free(base64Str);
 
   return (status);
 }
 
@@ -1442,18 +1434,17 @@ PRInt32 nsSmtpProtocol::AuthLoginStep2()
       PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("PLAIN/LOGIN auth, step 2"));
       char *base64Str = PL_Base64Encode(password.get(), password.Length(), nsnull);
       PR_snprintf(buffer, sizeof(buffer), "%.256s" CRLF, base64Str);
       NS_Free(base64Str);
     }
     else
       return NS_ERROR_COMMUNICATIONS_ERROR;
 
-    nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
-    status = SendData(url, buffer, true);
+    status = SendData(buffer, true);
     m_nextState = SMTP_RESPONSE;
     m_nextStateAfterResponse = SMTP_AUTH_LOGIN_RESPONSE;
     SetFlag(SMTP_PAUSE_FOR_READ);
     return (status);
   }
 
   return -1;
 }
@@ -1544,18 +1535,17 @@ PRInt32 nsSmtpProtocol::SendMailResponse
     }
     else
     {
       buffer = "RCPT TO:<";
       buffer += m_addresses;
       buffer += ">";
       buffer += CRLF;
     }
-    nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
-    status = SendData(url, buffer.get());
+    status = SendData(buffer.get());
 
     m_nextState = SMTP_RESPONSE;
     m_nextStateAfterResponse = SMTP_SEND_RCPT_RESPONSE;
     SetFlag(SMTP_PAUSE_FOR_READ);
 
     return(status);
 }
 
@@ -1593,37 +1583,36 @@ PRInt32 nsSmtpProtocol::SendRecipientRes
     m_responseCode = 250;
     m_nextState = SMTP_SEND_MAIL_RESPONSE;
     return(0);
   }
 
   /* else send the DATA command */
   buffer = "DATA";
   buffer += CRLF;
-  nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
-  status = SendData(url, buffer.get());
+  status = SendData(buffer.get());
 
   m_nextState = SMTP_RESPONSE;
   m_nextStateAfterResponse = SMTP_SEND_DATA_RESPONSE;
   SetFlag(SMTP_PAUSE_FOR_READ);
 
   return(status);
 }
 
 
-PRInt32 nsSmtpProtocol::SendData(nsIURI *url, const char *dataBuffer, bool aSuppressLogging)
+nsresult nsSmtpProtocol::SendData(const char *dataBuffer, bool aSuppressLogging)
 {
   if (!dataBuffer) return -1;
 
   if (!aSuppressLogging) {
       PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP Send: %s", dataBuffer));
   } else {
       PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("Logging suppressed for this command (it probably contained authentication information)"));
   }
-  return nsMsgAsyncWriteProtocol::SendData(url, dataBuffer);
+  return nsMsgAsyncWriteProtocol::SendData(dataBuffer);
 }
 
 
 PRInt32 nsSmtpProtocol::SendDataResponse()
 {
   PRInt32 status = 0;
   char *command = nsnull;
 
@@ -1716,18 +1705,17 @@ PRInt32 nsSmtpProtocol::SendMessageRespo
 
   /* else */
   return SendQuit();
 }
 
 PRInt32 nsSmtpProtocol::SendQuit()
 {
   m_sendDone = true;
-  nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
-  SendData(url, "QUIT"CRLF); // send a quit command to close the connection with the server.
+  SendData("QUIT"CRLF); // send a quit command to close the connection with the server.
   m_nextState = SMTP_RESPONSE;
   m_nextStateAfterResponse = SMTP_DONE;
   return(0);
 }
 
 nsresult nsSmtpProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer )
 {
   if (!aURL)
@@ -1962,19 +1950,18 @@ nsresult nsSmtpProtocol::LoadUrl(nsIURI 
         break;
     }
 
     /* check for errors during load and call error
     * state if found
     */
     if(status < 0 && m_nextState != SMTP_FREE)
     {
-      nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
       // send a quit command to close the connection with the server.
-      if (SendData(url, "QUIT"CRLF) == NS_OK)
+      if (SendData("QUIT"CRLF) == NS_OK)
       {
         m_nextState = SMTP_RESPONSE;
         m_nextStateAfterResponse = SMTP_ERROR_DONE;
       }
       else
       {
       m_nextState = SMTP_ERROR_DONE;
       /* don't exit! loop around again and do the free case */
--- a/mailnews/compose/src/nsSmtpProtocol.h
+++ b/mailnews/compose/src/nsSmtpProtocol.h
@@ -109,17 +109,17 @@ class nsSmtpProtocol : public nsMsgAsync
 public:
     NS_DECL_ISUPPORTS_INHERITED
 
     // Creating a protocol instance requires the URL which needs to be run.
     nsSmtpProtocol(nsIURI * aURL);
     virtual ~nsSmtpProtocol();
 
     virtual nsresult LoadUrl(nsIURI * aURL, nsISupports * aConsumer = nsnull);
-    virtual PRInt32 SendData(nsIURI * aURL, const char * dataBuffer, bool aSuppressLogging = false);
+    virtual nsresult SendData(const char * dataBuffer, bool aSuppressLogging = false);
 
     ////////////////////////////////////////////////////////////////////////////////////////
     // we suppport the nsIStreamListener interface 
     ////////////////////////////////////////////////////////////////////////////////////////
 
     // stop binding is a "notification" informing us that the stream associated with aURL is going away. 
     NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status);
 
--- a/mailnews/local/src/nsPop3Protocol.cpp
+++ b/mailnews/local/src/nsPop3Protocol.cpp
@@ -1347,57 +1347,57 @@ nsPop3Protocol::Error(PRInt32 err_code)
             }
         }
     }
     m_pop3ConData->next_state = POP3_ERROR_DONE;
     m_pop3ConData->pause_for_read = false;
     return -1;
 }
 
-PRInt32 nsPop3Protocol::SendData(nsIURI * aURL, const char * dataBuffer, bool aSuppressLogging)
+nsresult nsPop3Protocol::SendData(const char * dataBuffer, bool aSuppressLogging)
 {
   // remove any leftover bytes in the line buffer
   // this can happen if the last message line doesn't end with a (CR)LF
   // or a server sent two reply lines
   m_lineStreamBuffer->ClearBuffer();
 
-  PRInt32 result = nsMsgProtocol::SendData(aURL, dataBuffer);
+  nsresult result = nsMsgProtocol::SendData(dataBuffer);
 
   if (!aSuppressLogging)
       PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("SEND: %s", dataBuffer));
   else
       PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("Logging suppressed for this command (it probably contained authentication information)"));
 
-  if (result >= 0) // yeah this sucks...i need an error code....
+  if (NS_SUCCEEDED(result)) // yeah this sucks...i need an error code....
   {
     m_pop3ConData->pause_for_read = true;
     m_pop3ConData->next_state = POP3_WAIT_FOR_RESPONSE;
   }
   else
   {
     m_pop3ConData->next_state = POP3_ERROR_DONE;
     PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("SendData faild: %lx", result));
   }
 
-  return 0;
+  return result;
 }
 
 /*
  * POP3 AUTH extension
  */
 
 PRInt32 nsPop3Protocol::SendAuth()
 {
   if(!m_pop3ConData->command_succeeded)
     return(Error(POP3_SERVER_ERROR));
 
   nsCAutoString command("AUTH" CRLF);
 
   m_pop3ConData->next_state_after_response = POP3_AUTH_RESPONSE;
-  return SendData(m_url, command.get());
+  return SendData(command.get());
 }
 
 PRInt32 nsPop3Protocol::AuthResponse(nsIInputStream* inputStream,
                              PRUint32 length)
 {
     char * line;
     PRUint32 ln = 0;
     nsresult rv;
@@ -1481,17 +1481,17 @@ PRInt32 nsPop3Protocol::SendCapa()
 {
     PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("SendCapa()"));
     if(!m_pop3ConData->command_succeeded)
         return(Error(POP3_SERVER_ERROR));
 
     nsCAutoString command("CAPA" CRLF);
 
     m_pop3ConData->next_state_after_response = POP3_CAPA_RESPONSE;
-    return SendData(m_url, command.get());
+    return SendData(command.get());
 }
 
 PRInt32 nsPop3Protocol::CapaResponse(nsIInputStream* inputStream,
                              PRUint32 length)
 {
     char * line;
     PRUint32 ln = 0;
 
@@ -1773,17 +1773,17 @@ PRInt32 nsPop3Protocol::ProcessAuth()
       if(TestCapFlag(POP3_HAS_STLS))
       {
         if (m_socketType == nsMsgSocketType::trySTARTTLS ||
             m_socketType == nsMsgSocketType::alwaysSTARTTLS)
         {
             nsCAutoString command("STLS" CRLF);
 
             m_pop3ConData->next_state_after_response = POP3_TLS_RESPONSE;
-            return SendData(m_url, command.get());
+            return SendData(command.get());
         }
       }
       else if (m_socketType == nsMsgSocketType::alwaysSTARTTLS)
       {
           m_pop3ConData->next_state = POP3_ERROR_DONE;
           return(Error(NS_ERROR_COULD_NOT_CONNECT_VIA_TLS));
       }
     }
@@ -1981,17 +1981,17 @@ PRInt32 nsPop3Protocol::NextAuthStep()
 // so we've to start here and continue in SendUsername if the server
 // responds + to "AUTH LOGIN"
 PRInt32 nsPop3Protocol::AuthLogin()
 {
     nsCAutoString command("AUTH LOGIN" CRLF);
     m_pop3ConData->next_state_after_response = POP3_AUTH_LOGIN_RESPONSE;
     m_pop3ConData->pause_for_read = true;
 
-    return SendData(m_url, command.get());
+    return SendData(command.get());
 }
 
 PRInt32 nsPop3Protocol::AuthLoginResponse()
 {
     // need the test to be here instead in NextAuthStep() to
     // differentiate between command AUTH LOGIN failed and
     // sending username using LOGIN mechanism failed.
     if (!m_pop3ConData->command_succeeded)
@@ -2013,17 +2013,17 @@ PRInt32 nsPop3Protocol::AuthLoginRespons
 // responds + to "AUTH NTLM"
 PRInt32 nsPop3Protocol::AuthNtlm()
 {
     nsCAutoString command (m_currentAuthMethod == POP3_HAS_AUTH_MSN
           ? "AUTH MSN" CRLF : "AUTH NTLM" CRLF);
     m_pop3ConData->next_state_after_response = POP3_AUTH_NTLM_RESPONSE;
     m_pop3ConData->pause_for_read = true;
 
-    return SendData(m_url, command.get());
+    return SendData(command.get());
 }
 
 PRInt32 nsPop3Protocol::AuthNtlmResponse()
 {
     // need the test to be here instead in NextAuthStep() to
     // differentiate between command AUTH NTLM failed and
     // sending username using NTLM mechanism failed.
     if (!m_pop3ConData->command_succeeded)
@@ -2051,17 +2051,17 @@ PRInt32 nsPop3Protocol::AuthGSSAPI()
         nsresult rv;
         server->GetRealHostName(hostName);
         service.Append(hostName);
         rv = DoGSSAPIStep1(service.get(), m_username.get(), cmd);
         if (NS_SUCCEEDED(rv)) {
             m_GSSAPICache.Assign(cmd);
             m_pop3ConData->next_state_after_response = POP3_AUTH_GSSAPI_FIRST;
             m_pop3ConData->pause_for_read = true;
-            return SendData(m_url, "AUTH GSSAPI" CRLF);
+            return SendData("AUTH GSSAPI" CRLF);
         }
     }
 
     MarkAuthMethodAsFailed(POP3_HAS_AUTH_GSSAPI);
     m_pop3ConData->next_state = POP3_PROCESS_AUTH;
     m_pop3ConData->pause_for_read = false;
     return NS_OK;
 }
@@ -2080,31 +2080,31 @@ PRInt32 nsPop3Protocol::AuthGSSAPIRespon
 
     nsresult rv;
 
     m_pop3ConData->next_state_after_response = POP3_AUTH_GSSAPI_STEP;
     m_pop3ConData->pause_for_read = true;
 
     if (first) {
         m_GSSAPICache += CRLF;
-        rv = SendData(m_url, m_GSSAPICache.get());
+        rv = SendData(m_GSSAPICache.get());
         m_GSSAPICache.Truncate();
     }
     else {
         nsCAutoString cmd;
         PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("GSSAPI step 2"));
         rv = DoGSSAPIStep2(m_commandResponse, cmd);
         if (NS_FAILED(rv))
             cmd = "*";
         if (rv == NS_SUCCESS_AUTH_FINISHED) {
             m_pop3ConData->next_state_after_response = POP3_NEXT_AUTH_STEP;
             m_password_already_sent = true;
         }
         cmd += CRLF;
-        rv = SendData(m_url, cmd.get());
+        rv = SendData(cmd.get());
     }
 
     return rv;
 }
 
 PRInt32 nsPop3Protocol::SendUsername()
 {
     PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("SendUsername()"));
@@ -2153,17 +2153,17 @@ PRInt32 nsPop3Protocol::SendUsername()
     }
 
     cmd += CRLF;
 
     m_pop3ConData->next_state_after_response = POP3_NEXT_AUTH_STEP;
 
     m_pop3ConData->pause_for_read = true;
 
-    return SendData(m_url, cmd.get());
+    return SendData(cmd.get());
 }
 
 PRInt32 nsPop3Protocol::SendPassword()
 {
   PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("SendPassword()"));
   if (m_username.IsEmpty())
     return(Error(POP3_USERNAME_UNDEFINED));
 
@@ -2309,33 +2309,33 @@ PRInt32 nsPop3Protocol::SendPassword()
   //m_pop3Server->SetPop3CapabilityFlags(m_pop3ConData->capability_flags);
 
   m_pop3ConData->next_state_after_response = POP3_NEXT_AUTH_STEP;
 
   m_pop3ConData->pause_for_read = true;
 
   m_password_already_sent = true;
   m_lastPasswordSent = m_passwordResult;
-  return SendData(m_url, cmd.get(), true);
+  return SendData(cmd.get(), true);
 }
 
 PRInt32 nsPop3Protocol::SendStatOrGurl(bool sendStat)
 {
   nsCAutoString cmd;
   if (sendStat)
   {
     cmd  = "STAT" CRLF;
     m_pop3ConData->next_state_after_response = POP3_GET_STAT;
   }
   else
   {
     cmd = "GURL" CRLF;
     m_pop3ConData->next_state_after_response = POP3_GURL_RESPONSE;
   }
-  return SendData(m_url, cmd.get());
+  return SendData(cmd.get());
 }
 
 
 PRInt32
 nsPop3Protocol::SendStat()
 {
   return SendStatOrGurl(true);
 }
@@ -2480,17 +2480,17 @@ PRInt32 nsPop3Protocol::SendList()
 
 
     m_pop3ConData->msg_info = (Pop3MsgInfo *)
       PR_CALLOC(sizeof(Pop3MsgInfo) * m_pop3ConData->number_of_messages);
     if (!m_pop3ConData->msg_info)
         return(MK_OUT_OF_MEMORY);
     m_pop3ConData->next_state_after_response = POP3_GET_LIST;
     m_listpos = 0;
-    return SendData(m_url, "LIST"CRLF);
+    return SendData("LIST"CRLF);
 }
 
 
 
 PRInt32
 nsPop3Protocol::GetList(nsIInputStream* inputStream,
                         PRUint32 length)
 {
@@ -2654,17 +2654,17 @@ PRInt32 nsPop3Protocol::HandleNoUidListA
 */
 PRInt32 nsPop3Protocol::SendXtndXlstMsgid()
 {
   if (TestCapFlag(POP3_HAS_XTND_XLST | POP3_XTND_XLST_UNDEFINED))
   {
     m_pop3ConData->next_state_after_response = POP3_GET_XTND_XLST_MSGID;
     m_pop3ConData->pause_for_read = true;
     m_listpos = 0;
-    return SendData(m_url, "XTND XLST Message-Id" CRLF);
+    return SendData("XTND XLST Message-Id" CRLF);
   }
   else
     return HandleNoUidListAvailable();
 }
 
 
 /* km
  *
@@ -2780,17 +2780,17 @@ nsPop3Protocol::GetXtndXlstMsgid(nsIInpu
 
 PRInt32 nsPop3Protocol::SendUidlList()
 {
     if (TestCapFlag(POP3_HAS_UIDL | POP3_UIDL_UNDEFINED))
     {
       m_pop3ConData->next_state_after_response = POP3_GET_UIDL_LIST;
       m_pop3ConData->pause_for_read = true;
       m_listpos = 0;
-      return SendData(m_url,"UIDL" CRLF);
+      return SendData("UIDL" CRLF);
     }
     else
       return SendXtndXlstMsgid();
 }
 
 
 PRInt32 nsPop3Protocol::GetUidlList(nsIInputStream* inputStream,
                             PRUint32 length)
@@ -3200,32 +3200,32 @@ PRInt32 nsPop3Protocol::SendTop()
    {
      m_pop3ConData->next_state_after_response = POP3_TOP_RESPONSE;
      m_pop3ConData->cur_msg_size = -1;
 
      /* zero the bytes received in message in preparation for
      * the next
      */
      m_bytesInMsgReceived = 0;
-     status = SendData(m_url,cmd);
+     status = SendData(cmd);
    }
    PR_Free(cmd);
    return status;
 }
 
 /* send the xsender command
  */
 PRInt32 nsPop3Protocol::SendXsender()
 {
   char * cmd = PR_smprintf("XSENDER %ld" CRLF, m_pop3ConData->msg_info[m_pop3ConData->last_accessed_msg].msgnum);
   PRInt32 status = -1;
   if (cmd)
   {
     m_pop3ConData->next_state_after_response = POP3_XSENDER_RESPONSE;
-    status = SendData(m_url, cmd);
+    status = SendData(cmd);
     PR_Free(cmd);
   }
   return status;
 }
 
 PRInt32 nsPop3Protocol::XsenderResponse()
 {
     m_pop3ConData->seenFromHeader = false;
@@ -3281,17 +3281,17 @@ nsPop3Protocol::SendRetr()
                           m_pop3ConData->really_new_messages,
                           finalString);
 
       NS_ASSERTION(NS_SUCCEEDED(rv), "couldn't format string");
       if (m_statusFeedback)
         m_statusFeedback->ShowStatusString(finalString);
     }
 
-    status = SendData(m_url, cmd);
+    status = SendData(cmd);
   } // if cmd
   PR_Free(cmd);
   return status;
 }
 
 /* digest the message
  */
 PRInt32
@@ -3640,17 +3640,17 @@ PRInt32 nsPop3Protocol::SendDele()
     /* increment the last accessed message since we have now read it
      */
     char * cmd = PR_smprintf("DELE %ld" CRLF, m_pop3ConData->msg_info[m_pop3ConData->last_accessed_msg].msgnum);
     m_pop3ConData->last_accessed_msg++;
     PRInt32 status = -1;
     if (cmd)
     {
       m_pop3ConData->next_state_after_response = POP3_DELE_RESPONSE;
-      status = SendData(m_url, cmd);
+      status = SendData(cmd);
     }
     PR_Free(cmd);
     return status;
 }
 
 PRInt32 nsPop3Protocol::DeleResponse()
 {
   Pop3UidlHost *host = NULL;
@@ -4054,17 +4054,17 @@ nsresult nsPop3Protocol::ProcessProtocol
                                               m_pop3ConData->really_new_messages,
                                               statusString);
             if (NS_SUCCEEDED(rv))
               UpdateStatusWithString(statusString.get());
           }
         }
       }
 
-      status = SendData(mailnewsurl, "QUIT" CRLF);
+      status = SendData("QUIT" CRLF);
       m_pop3ConData->next_state = POP3_WAIT_FOR_RESPONSE;
       m_pop3ConData->next_state_after_response = POP3_QUIT_RESPONSE;
       break;
 
     case POP3_QUIT_RESPONSE:
       if(m_pop3ConData->command_succeeded)
       {
       /*  the QUIT succeeded.  We can now flush the state in popstate.dat which
--- a/mailnews/local/src/nsPop3Protocol.h
+++ b/mailnews/local/src/nsPop3Protocol.h
@@ -338,17 +338,17 @@ private:
   PRInt32  m_totalFolderSize;
   PRInt32  m_totalDownloadSize; /* Number of bytes we're going to
                                     download.  Might be much less
                                     than the total_folder_size. */
   PRInt32 m_totalBytesReceived; // total # bytes received for the connection
 
   virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
                                         PRUint32 sourceOffset, PRUint32 length);
-  virtual PRInt32 SendData(nsIURI * aURL, const char * dataBuffer, bool aSuppressLogging = false);
+  virtual nsresult SendData(const char * dataBuffer, bool aSuppressLogging = false);
 
   virtual const char* GetType() {return "pop3";}
 
   nsCOMPtr<nsIURI> m_url;
   nsCOMPtr<nsIPop3Sink> m_nsIPop3Sink;
   nsCOMPtr<nsIPop3IncomingServer> m_pop3Server;
 
   nsMsgLineStreamBuffer   * m_lineStreamBuffer; // used to efficiently extract lines from the incoming data stream
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -1310,26 +1310,26 @@ nsNNTPProtocol::ParseURL(nsIURI *aURL, n
 }
 /*
  * Writes the data contained in dataBuffer into the current output stream. It also informs
  * the transport layer that this data is now available for transmission.
  * Returns a positive number for success, 0 for failure (not all the bytes were written to the
  * stream, etc). We need to make another pass through this file to install an error system (mscott)
  */
 
-PRInt32 nsNNTPProtocol::SendData(nsIURI * aURL, const char * dataBuffer, bool aSuppressLogging)
+nsresult nsNNTPProtocol::SendData(const char * dataBuffer, bool aSuppressLogging)
 {
     if (!aSuppressLogging) {
         NNTP_LOG_WRITE(dataBuffer);
     }
     else {
         PR_LOG(NNTP, out, ("(%p) Logging suppressed for this command (it probably contained authentication information)", this));
     }
 
-  return nsMsgProtocol::SendData(aURL, dataBuffer); // base class actually transmits the data
+  return nsMsgProtocol::SendData(dataBuffer); // base class actually transmits the data
 }
 
 /* gets the response code from the nntp server and the
  * response line
  *
  * returns the TCP return code from the read
  */
 PRInt32 nsNNTPProtocol::NewsResponse(nsIInputStream * inputStream, PRUint32 length)
@@ -1410,20 +1410,18 @@ PRInt32 nsNNTPProtocol::LoginResponse()
   m_nntpServer->SetPostingAllowed(postingAllowed);
   m_nextState = NNTP_SEND_MODE_READER;
   return(0);  /* good */
 }
 
 PRInt32 nsNNTPProtocol::SendModeReader()
 {
   nsresult rv = NS_OK;
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL,&rv);
-    NS_ENSURE_SUCCESS(rv,rv);
-
-  rv = SendData(mailnewsurl, NNTP_CMD_MODE_READER);
+
+  rv = SendData(NNTP_CMD_MODE_READER);
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = NNTP_SEND_MODE_READER_RESPONSE;
     SetFlag(NNTP_PAUSE_FOR_READ);
 
     NS_ENSURE_SUCCESS(rv,rv);
     return rv;
 }
 
@@ -1455,19 +1453,17 @@ PRInt32 nsNNTPProtocol::SendModeReaderRe
   }
 
   return(0);
 }
 
 PRInt32 nsNNTPProtocol::SendListExtensions()
 {
   PRInt32 status = 0;
-  nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
-  if (url)
-    status = SendData(url, NNTP_CMD_LIST_EXTENSIONS);
+  status = SendData(NNTP_CMD_LIST_EXTENSIONS);
 
   m_nextState = NNTP_RESPONSE;
   m_nextStateAfterResponse = SEND_LIST_EXTENSIONS_RESPONSE;
   ClearFlag(NNTP_PAUSE_FOR_READ);
   return status;
 }
 
 PRInt32 nsNNTPProtocol::SendListExtensionsResponse(nsIInputStream * inputStream, PRUint32 length)
@@ -1516,19 +1512,17 @@ PRInt32 nsNNTPProtocol::SendListSearches
 {
     nsresult rv;
     bool searchable=false;
   PRInt32 status = 0;
 
     rv = m_nntpServer->QueryExtension("SEARCH",&searchable);
     if (NS_SUCCEEDED(rv) && searchable)
   {
-    nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-    if (mailnewsurl)
-      status = SendData(mailnewsurl, NNTP_CMD_LIST_SEARCHES);
+    status = SendData(NNTP_CMD_LIST_SEARCHES);
 
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = SEND_LIST_SEARCHES_RESPONSE;
     SetFlag(NNTP_PAUSE_FOR_READ);
   }
   else
   {
     /* since SEARCH isn't supported, move on to GET */
@@ -1581,19 +1575,17 @@ PRInt32 nsNNTPProtocol::SendListSearches
 
   PR_FREEIF(line);
   return status;
 }
 
 PRInt32 nsNNTPProtocol::SendListSearchHeaders()
 {
   PRInt32 status = 0;
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, NNTP_CMD_LIST_SEARCH_FIELDS);
+  status = SendData(NNTP_CMD_LIST_SEARCH_FIELDS);
 
   m_nextState = NNTP_RESPONSE;
   m_nextStateAfterResponse = NNTP_LIST_SEARCH_HEADERS_RESPONSE;
   SetFlag(NNTP_PAUSE_FOR_READ);
 
   return status;
 }
 
@@ -1628,19 +1620,17 @@ PRInt32 nsNNTPProtocol::GetProperties()
 {
     nsresult rv;
     bool setget=false;
   PRInt32 status = 0;
 
     rv = m_nntpServer->QueryExtension("SETGET",&setget);
     if (NS_SUCCEEDED(rv) && setget)
   {
-    nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-    if (mailnewsurl)
-      status = SendData(mailnewsurl, NNTP_CMD_GET_PROPERTIES);
+    status = SendData(NNTP_CMD_GET_PROPERTIES);
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = NNTP_GET_PROPERTIES_RESPONSE;
     SetFlag(NNTP_PAUSE_FOR_READ);
   }
   else
   {
     /* since GET isn't supported, move on LIST SUBSCRIPTIONS */
     m_nextState = SEND_LIST_SUBSCRIPTIONS;
@@ -1697,19 +1687,17 @@ PRInt32 nsNNTPProtocol::SendListSubscrip
     nsresult rv;
     bool searchable=false;
     rv = m_nntpServer->QueryExtension("LISTSUBSCR",&listsubscr);
     if (NS_SUCCEEDED(rv) && listsubscr)
 #else
   if (0)
 #endif
   {
-    nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-    if (mailnewsurl)
-      status = SendData(mailnewsurl, NNTP_CMD_LIST_SUBSCRIPTIONS);
+    status = SendData(NNTP_CMD_LIST_SUBSCRIPTIONS);
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = SEND_LIST_SUBSCRIPTIONS_RESPONSE;
     SetFlag(NNTP_PAUSE_FOR_READ);
   }
   else
   {
     /* since LIST SUBSCRIPTIONS isn't supported, move on to real work */
     m_nextState = SEND_FIRST_NNTP_COMMAND;
@@ -1905,21 +1893,19 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCom
       NS_MsgSACat(&command,"<");
 
     NS_MsgSACat(&command, m_messageID.get());
 
     if (PL_strchr(command+8, '>')==0)
       NS_MsgSACat(&command,">");
   }
 
-    NS_MsgSACat(&command, CRLF);
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, command);
-    PR_Free(command);
+  NS_MsgSACat(&command, CRLF);
+  status = SendData(command);
+  PR_Free(command);
 
   m_nextState = NNTP_RESPONSE;
   if (m_typeWanted != SEARCH_WANTED)
     m_nextStateAfterResponse = SEND_FIRST_NNTP_COMMAND_RESPONSE;
   SetFlag(NNTP_PAUSE_FOR_READ);
     return(status);
 } /* sent first command */
 
@@ -2072,19 +2058,17 @@ PRInt32 nsNNTPProtocol::SendGroupForArti
 
   char outputBuffer[OUTPUT_BUFFER_SIZE];
 
   PR_snprintf(outputBuffer,
       OUTPUT_BUFFER_SIZE,
       "GROUP %.512s" CRLF,
       groupname.get());
 
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, outputBuffer);
+  status = SendData(outputBuffer);
 
   m_nextState = NNTP_RESPONSE;
   m_nextStateAfterResponse = NNTP_SEND_GROUP_FOR_ARTICLE_RESPONSE;
   SetFlag(NNTP_PAUSE_FOR_READ);
   return(status);
 }
 
 nsresult
@@ -2118,19 +2102,17 @@ PRInt32 nsNNTPProtocol::SendGroupForArti
 
 
 PRInt32 nsNNTPProtocol::SendArticleNumber()
 {
   char outputBuffer[OUTPUT_BUFFER_SIZE];
   PRInt32 status = 0;
   PR_snprintf(outputBuffer, OUTPUT_BUFFER_SIZE, "ARTICLE %lu" CRLF, m_key);
 
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, outputBuffer);
+  status = SendData(outputBuffer);
 
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = SEND_FIRST_NNTP_COMMAND_RESPONSE;
     SetFlag(NNTP_PAUSE_FOR_READ);
 
     return(status);
 }
 
@@ -2422,19 +2404,17 @@ PRInt32 nsNNTPProtocol::BeginAuthorizati
     return 0;
   }
 
   NS_MsgSACopy(&command, "AUTHINFO user ");
   PR_LOG(NNTP, PR_LOG_ALWAYS,("(%p) use %s as the username", this, username.get()));
   NS_MsgSACat(&command, username.get());
   NS_MsgSACat(&command, CRLF);
 
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, command);
+  status = SendData(command);
 
   PR_Free(command);
 
   m_nextState = NNTP_RESPONSE;
   m_nextStateAfterResponse = NNTP_AUTHORIZE_RESPONSE;
 
   SetFlag(NNTP_PAUSE_FOR_READ);
 
@@ -2487,19 +2467,17 @@ PRInt32 nsNNTPProtocol::AuthorizationRes
     rv = m_newsFolder->GetGroupPassword(password);
     if (NS_FAILED(rv) || password.IsEmpty())
       return MK_NNTP_AUTH_FAILED;
 
     NS_MsgSACopy(&command, "AUTHINFO pass ");
     NS_MsgSACat(&command, password.get());
     NS_MsgSACat(&command, CRLF);
 
-    nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-    if (mailnewsurl)
-      status = SendData(mailnewsurl, command, true);
+    status = SendData(command, true);
 
     PR_FREEIF(command);
 
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = NNTP_PASSWORD_RESPONSE;
     SetFlag(NNTP_PAUSE_FOR_READ);
 
     return status;
@@ -3177,19 +3155,17 @@ PRInt32 nsNNTPProtocol::XoverSend()
         "XOVER %d-%d" CRLF,
         m_firstArticle,
         m_lastArticle);
 
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = NNTP_XOVER_RESPONSE;
     SetFlag(NNTP_PAUSE_FOR_READ);
 
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, outputBuffer);
+  status = SendData(outputBuffer);
   return status;
 }
 
 /* see if the xover response is going to return us data
  * if the proper code isn't returned then assume xover
  * isn't supported and use
  * normal read_group
  */
@@ -3311,18 +3287,17 @@ PRInt32 nsNNTPProtocol::XhdrSend()
   char outputBuffer[OUTPUT_BUFFER_SIZE];
   PR_snprintf(outputBuffer, OUTPUT_BUFFER_SIZE, "XHDR %s %d-%d" CRLF,
               header.get(), m_firstArticle, m_lastArticle);
 
   m_nextState = NNTP_RESPONSE;
   m_nextStateAfterResponse = NNTP_XHDR_RESPONSE;
   SetFlag(NNTP_PAUSE_FOR_READ);
 
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  return mailnewsurl ? SendData(mailnewsurl, outputBuffer) : 0;
+  return SendData(outputBuffer);
 }
 
 PRInt32 nsNNTPProtocol::XhdrResponse(nsIInputStream *inputStream)
 {
   if (m_responseCode != MK_NNTP_RESPONSE_XHDR_OK)
   {
     m_nextState = NNTP_READ_GROUP;
     // The reasoning behind setting this flag and not an XHDR flag is that we
@@ -3388,21 +3363,17 @@ PRInt32 nsNNTPProtocol::ReadHeaders()
     PR_snprintf(outputBuffer,
       OUTPUT_BUFFER_SIZE,
       "HEAD %ld" CRLF,
       m_articleNumber++);
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = NNTP_READ_GROUP_RESPONSE;
 
     SetFlag(NNTP_PAUSE_FOR_READ);
-    nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-    if (mailnewsurl)
-      return SendData(mailnewsurl, outputBuffer);
-    else
-      return 0;
+    return SendData(outputBuffer);
   }
 }
 
 /* See if the "HEAD" command was successful
 */
 
 PRInt32 nsNNTPProtocol::ReadNewsgroupResponse()
 {
@@ -3550,18 +3521,17 @@ PRInt32 nsNNTPProtocol::PostMessageInFil
 
     SetFlag(NNTP_PAUSE_FOR_READ);
 
     // for now, we are always done at this point..we aren't making multiple
     // calls to post data...
 
     // always issue a '.' and CRLF when we are done...
     PL_strcpy(m_dataBuf, "." CRLF);
-    if (url)
-      SendData(url, m_dataBuf);
+    SendData(m_dataBuf);
 #ifdef UNREADY_CODE
     NET_Progress(CE_WINDOW_ID,
                  XP_GetString(XP_MESSAGE_SENT_WAITING_MAIL_REPLY));
 #endif /* UNREADY_CODE */
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = NNTP_SEND_POST_DATA_RESPONSE;
     return(0);
 }
@@ -3618,19 +3588,17 @@ PRInt32 nsNNTPProtocol::CheckForArticle(
      posting attempt (which is already in ce->URL_s->error_msg). */
   return MK_NNTP_ERROR_MESSAGE;
   }
 }
 
 PRInt32 nsNNTPProtocol::StartCancel()
 {
   PRInt32 status = 0;
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, NNTP_CMD_POST);
+  status = SendData(NNTP_CMD_POST);
 
   m_nextState = NNTP_RESPONSE;
   m_nextStateAfterResponse = NEWS_DO_CANCEL;
   SetFlag(NNTP_PAUSE_FOR_READ);
   return (status);
 }
 
 bool nsNNTPProtocol::CheckIfAuthor(nsISupports *aElement, void *data)
@@ -3866,19 +3834,17 @@ reported here */
                        "References: %s" CRLF
                        "%s" /* otherHeaders, already with CRLF */
                        CRLF /* body separator */
                        "%s" /* body, already with CRLF */
                        "." CRLF, /* trailing message terminator "." */
                        cancelInfo.from.get(), newsgroups, subject, id,
                        otherHeaders.get(), body);
 
-    nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-    if (mailnewsurl)
-      status = SendData(mailnewsurl, data);
+    status = SendData(data);
     PR_Free (data);
     if (status < 0) {
       nsCAutoString errorText;
       errorText.AppendInt(status);
       AlertError(MK_TCP_WRITE_ERROR, errorText.get());
       failure = true;
       goto FAIL;
     }
@@ -3935,19 +3901,17 @@ PRInt32 nsNNTPProtocol::XPATSend()
     endOfTerm = PL_strchr(command, '/');
     if (endOfTerm)
       *endOfTerm = '\0';
     NS_MsgSACat(&command, CRLF);
 
     unescapedCommand = MSG_UnEscapeSearchUrl(command);
 
     /* send one term off to the server */
-    nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-    if (mailnewsurl)
-      status = SendData(mailnewsurl, unescapedCommand);
+    status = SendData(unescapedCommand);
 
     m_nextState = NNTP_RESPONSE;
     m_nextStateAfterResponse = NNTP_XPAT_RESPONSE;
     SetFlag(NNTP_PAUSE_FOR_READ);
 
     PR_Free(command);
     PR_Free(unescapedCommand);
   }
@@ -4030,19 +3994,17 @@ PRInt32 nsNNTPProtocol::ListPrettyNames(
   PRInt32 status = 0;
 
   m_newsFolder->GetRawName(group_name);
   PR_snprintf(outputBuffer,
     OUTPUT_BUFFER_SIZE,
     "LIST PRETTYNAMES %.512s" CRLF,
     group_name.get());
 
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, outputBuffer);
+  status = SendData(outputBuffer);
   NNTP_LOG_NOTE(outputBuffer);
   m_nextState = NNTP_RESPONSE;
   m_nextStateAfterResponse = NNTP_LIST_PRETTY_NAMES_RESPONSE;
 
   return status;
 }
 
 PRInt32 nsNNTPProtocol::ListPrettyNamesResponse(nsIInputStream * inputStream, PRUint32 length)
@@ -4124,19 +4086,17 @@ PRInt32 nsNNTPProtocol::ListXActive()
   PRInt32 status = 0;
   char outputBuffer[OUTPUT_BUFFER_SIZE];
 
   PR_snprintf(outputBuffer,
     OUTPUT_BUFFER_SIZE,
     "LIST XACTIVE %.512s" CRLF,
     group_name.get());
 
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, outputBuffer);
+  status = SendData(outputBuffer);
 
   m_nextState = NNTP_RESPONSE;
   m_nextStateAfterResponse = NNTP_LIST_XACTIVE_RESPONSE;
 
   return status;
 }
 
 PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint32 length)
@@ -4281,19 +4241,17 @@ PRInt32 nsNNTPProtocol::SendListGroup()
     newsgroupName.get());
 
   m_articleList = do_CreateInstance(NS_NNTPARTICLELIST_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
   rv = m_articleList->Initialize(m_newsFolder);
   NS_ENSURE_SUCCESS(rv,rv);
 
-  nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
-  if (mailnewsurl)
-    status = SendData(mailnewsurl, outputBuffer);
+  status = SendData(outputBuffer);
 
   m_nextState = NNTP_RESPONSE;
   m_nextStateAfterResponse = NNTP_LIST_GROUP_RESPONSE;
   SetFlag(NNTP_PAUSE_FOR_READ);
 
   return status;
 }
 
@@ -4797,17 +4755,17 @@ nsresult nsNNTPProtocol::ProcessProtocol
   } /* end big while */
 
   return NS_OK; /* keep going */
 }
 
 NS_IMETHODIMP nsNNTPProtocol::CloseConnection()
 {
   PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) ClosingConnection",this));
-  SendData(nsnull, NNTP_CMD_QUIT); // this will cause OnStopRequest get called, which will call CloseSocket()
+  SendData(NNTP_CMD_QUIT); // this will cause OnStopRequest get called, which will call CloseSocket()
   // break some cycles
   CleanupNewsgroupList();
 
   if (m_nntpServer) {
     m_nntpServer->RemoveConnection(this);
     m_nntpServer = nsnull;
   }
   CloseSocket();
--- a/mailnews/news/src/nsNNTPProtocol.h
+++ b/mailnews/news/src/nsNNTPProtocol.h
@@ -204,17 +204,17 @@ private:
    * advised to suspend the request before using this state.
    */
   virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
     PRUint32 sourceOffset, PRUint32 length);
   virtual nsresult CloseSocket();
 
   // we have our own implementation of SendData which writes to the nntp log
   // and then calls the base class to transmit the data
-  PRInt32 SendData(nsIURI * aURL, const char * dataBuffer, bool aSuppressLogging = false);
+  nsresult SendData(const char * dataBuffer, bool aSuppressLogging = false);
 
   nsresult CleanupAfterRunningUrl();
   void Cleanup(); //free char* member variables
 
   void ParseHeaderForCancel(char *buf);
 
   virtual const char* GetType() {return "nntp";}