Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsSmtpProtocol.cpp File Reference
#include "msgCore.h"
#include "nsSmtpProtocol.h"
#include "nscore.h"
#include "nsIStreamListener.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsISocketTransport.h"
#include "nsIMsgHeaderParser.h"
#include "nsFileStream.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsMsgBaseCID.h"
#include "nsMsgCompCID.h"
#include "nsIPrompt.h"
#include "nsIAuthPrompt.h"
#include "nsString.h"
#include "nsTextFormatter.h"
#include "nsIMsgIdentity.h"
#include "nsISmtpServer.h"
#include "nsMsgComposeStringBundle.h"
#include "prtime.h"
#include "prlog.h"
#include "prerror.h"
#include "prprf.h"
#include "prmem.h"
#include "plbase64.h"
#include "prnetdb.h"
#include "prsystem.h"
#include "nsEscape.h"
#include "nsMsgUtils.h"
#include "nsIPipe.h"
#include "nsMsgSimulateError.h"
#include "nsNetUtil.h"
#include "nsIPrefService.h"
#include "nsISignatureVerifier.h"
#include "nsISSLSocketControl.h"
#include "nsPrintfCString.h"
#include <stdarg.h>

Go to the source code of this file.

Defines

#define OUTPUT_BUFFER_SIZE   (4096*2)

Functions

nsresult nsExplainErrorDetails (nsISmtpUrl *aSmtpUrl, int code,...)
static char * esmtp_value_encode (char *addr)

Variables

static PRLogModuleInfoSMTPLogModule = nsnull

Define Documentation

#define OUTPUT_BUFFER_SIZE   (4096*2)

Definition at line 95 of file nsSmtpProtocol.cpp.


Function Documentation

static char* esmtp_value_encode ( char *  addr) [static]

Definition at line 191 of file nsSmtpProtocol.cpp.

{
  char *buffer = (char *) PR_Malloc(512); /* esmpt ORCPT allow up to 500 chars encoded addresses */
  char *bp = buffer, *bpEnd = buffer+500;
  int len, i;
  
  if (!buffer) return NULL;
  
  *bp=0;
  if (! addr || *addr == 0) /* this will never happen */
    return buffer;
  
  for (i=0, len=PL_strlen(addr); i < len && bp < bpEnd; i++)
  {
    if (*addr >= 0x21 && 
      *addr <= 0x7E &&
      *addr != '+' &&
      *addr != '=')
    {
      *bp++ = *addr++;
    }
    else
    {
      PR_snprintf(bp, bpEnd-bp, "+%.2X", ((int)*addr++));
      bp += PL_strlen(bp);
    }
  }
  *bp=0;
  return buffer;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsExplainErrorDetails ( nsISmtpUrl aSmtpUrl,
int  code,
  ... 
)

Definition at line 102 of file nsSmtpProtocol.cpp.

{
  NS_ENSURE_ARG(aSmtpUrl);

  nsresult rv = NS_OK;
  va_list args;

  nsCOMPtr<nsIPrompt> dialog;
  aSmtpUrl->GetPrompt(getter_AddRefs(dialog));
  NS_ENSURE_TRUE(dialog, NS_ERROR_FAILURE);

  PRUnichar *  msg;
  nsXPIDLString eMsg;
  nsCOMPtr<nsIMsgStringService> smtpBundle = do_GetService(NS_MSG_SMTPSTRINGSERVICE_CONTRACTID);
  
  va_start (args, code);
  
  switch (code)
  {
      case NS_ERROR_SMTP_SERVER_ERROR:
      case NS_ERROR_TCP_READ_ERROR:
      case NS_ERROR_SMTP_TEMP_SIZE_EXCEEDED:
      case NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_1:
      case NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_2:
      case NS_ERROR_SENDING_FROM_COMMAND:
      case NS_ERROR_SENDING_RCPT_COMMAND:
      case NS_ERROR_SENDING_DATA_COMMAND:
      case NS_ERROR_SENDING_MESSAGE:
      case NS_ERROR_SMTP_GREETING:
           smtpBundle->GetStringByID(code, getter_Copies(eMsg));
           msg = nsTextFormatter::vsmprintf(eMsg, args);
           break;
      default:
           smtpBundle->GetStringByID(NS_ERROR_COMMUNICATIONS_ERROR, getter_Copies(eMsg));
           msg = nsTextFormatter::smprintf(eMsg, code);
           break;
  }
  
  if (msg) 
  {
    rv = dialog->Alert(nsnull, msg);
    nsTextFormatter::smprintf_free(msg);
  }
  
  va_end (args);
  
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 84 of file nsSmtpProtocol.cpp.