Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsMsgCompose.cpp File Reference
#include "nsMsgCompose.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsISelection.h"
#include "nsISelectionController.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsMsgI18N.h"
#include "nsICharsetConverterManager.h"
#include "nsMsgCompCID.h"
#include "nsMsgQuote.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIDocumentEncoder.h"
#include "nsXPIDLString.h"
#include "nsIMsgHeaderParser.h"
#include "nsMsgCompUtils.h"
#include "nsIMsgStringService.h"
#include "nsMsgComposeStringBundle.h"
#include "nsSpecialSystemDirectory.h"
#include "nsMsgSend.h"
#include "nsMailHeaders.h"
#include "nsMsgPrompts.h"
#include "nsMimeTypes.h"
#include "nsTextFormatter.h"
#include "nsIPlaintextEditor.h"
#include "nsIHTMLEditor.h"
#include "nsIEditorMailSupport.h"
#include "nsEscape.h"
#include "plstr.h"
#include "nsIDocShell.h"
#include "nsIRDFService.h"
#include "nsRDFCID.h"
#include "nsAbBaseCID.h"
#include "nsIAddrDatabase.h"
#include "nsIAddrBookSession.h"
#include "nsIAddressBook.h"
#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIWindowMediator.h"
#include "nsISupportsArray.h"
#include "nsCOMArray.h"
#include "nsIIOService.h"
#include "nsIURL.h"
#include "nsIMsgMailSession.h"
#include "nsMsgBaseCID.h"
#include "nsIPrompt.h"
#include "nsMsgMimeCID.h"
#include "nsCOMPtr.h"
#include "nsDateTimeFormatCID.h"
#include "nsIDateTimeFormat.h"
#include "nsILocaleService.h"
#include "nsILocale.h"
#include "nsMsgComposeService.h"
#include "nsIMsgComposeProgressParams.h"
#include "nsMsgUtils.h"
#include "nsIMsgImapMailFolder.h"
#include "nsImapCore.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "nsNetUtil.h"
#include "nsMsgSimulateError.h"
#include "nsILocalFile.h"
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIMsgMdnGenerator.h"
#include "plbase64.h"
#include "nsIUTF8ConverterService.h"
#include "nsUConvCID.h"
#include "nsIUnicodeNormalizer.h"
#include "nsIMsgAccountManager.h"
#include "nsIMsgProgress.h"
#include "nsMsgFolderFlags.h"

Go to the source code of this file.




static void GetReplyHeaderInfo (PRInt32 *reply_header_type, nsString &reply_header_locale, nsXPIDLString &reply_header_authorwrote, nsXPIDLString &reply_header_ondate, nsString &reply_header_separator, nsString &reply_header_colon, nsXPIDLString &reply_header_originalmessage)
static nsresult RemoveDuplicateAddresses (const char *addresses, const char *anothersAddresses, PRBool removeAliasesToMe, char **newAddress)
static void TranslateLineEnding (nsString &data)
static void GetTopmostMsgWindowCharacterSet (nsXPIDLCString &charset, PRBool *charsetOverride)
nsresult GetChildOffset (nsIDOMNode *aChild, nsIDOMNode *aParent, PRInt32 &aOffset)
nsresult GetNodeLocation (nsIDOMNode *inChild, nsCOMPtr< nsIDOMNode > *outParent, PRInt32 *outOffset)
static nsresult OpenAddressBook (const char *dbUri, nsIAddrDatabase **aDatabase)

Define Documentation

Definition at line 4215 of file nsMsgCompose.cpp.

Function Documentation

nsresult GetChildOffset ( nsIDOMNode aChild,
nsIDOMNode aParent,
PRInt32 aOffset 

Definition at line 262 of file nsMsgCompose.cpp.

  NS_ASSERTION((aChild && aParent), "bad args");
  nsresult result = NS_ERROR_NULL_POINTER;
  if (aChild && aParent)
    nsCOMPtr<nsIDOMNodeList> childNodes;
    result = aParent->GetChildNodes(getter_AddRefs(childNodes));
    if ((NS_SUCCEEDED(result)) && (childNodes))
      PRInt32 i=0;
      for ( ; NS_SUCCEEDED(result); i++)
        nsCOMPtr<nsIDOMNode> childNode;
        result = childNodes->Item(i, getter_AddRefs(childNode));
        if ((NS_SUCCEEDED(result)) && (childNode))
          if (childNode.get()==aChild)
            aOffset = i;
        else if (!childNode)
          result = NS_ERROR_NULL_POINTER;
    else if (!childNodes)
      result = NS_ERROR_NULL_POINTER;
  return result;

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult GetNodeLocation ( nsIDOMNode inChild,
nsCOMPtr< nsIDOMNode > *  outParent,
PRInt32 outOffset 

Definition at line 296 of file nsMsgCompose.cpp.

  NS_ASSERTION((outParent && outOffset), "bad args");
  nsresult result = NS_ERROR_NULL_POINTER;
  if (inChild && outParent && outOffset)
    result = inChild->GetParentNode(getter_AddRefs(*outParent));
    if ( (NS_SUCCEEDED(result)) && (*outParent) )
      result = GetChildOffset(inChild, *outParent, *outOffset);

  return result;

Here is the call graph for this function:

Here is the caller graph for this function:

static void GetReplyHeaderInfo ( PRInt32 reply_header_type,
nsString reply_header_locale,
nsXPIDLString reply_header_authorwrote,
nsXPIDLString reply_header_ondate,
nsString reply_header_separator,
nsString reply_header_colon,
nsXPIDLString reply_header_originalmessage 
) [static]

Definition at line 130 of file nsMsgCompose.cpp.

  nsresult  rv;
  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));

  *reply_header_type = 1;
  if(NS_SUCCEEDED(rv)) {
    prefBranch->GetIntPref("mailnews.reply_header_type", reply_header_type);

    NS_GetUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_locale", EmptyString(), reply_header_locale);
    NS_GetLocalizedUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_authorwrote", NS_LITERAL_STRING("%s wrote"), reply_header_authorwrote);
    NS_GetLocalizedUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_ondate", NS_LITERAL_STRING("On %s"), reply_header_ondate);
    NS_GetUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_separator", NS_LITERAL_STRING(", "), reply_header_separator);
    NS_GetUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_colon", NS_LITERAL_STRING(":"), reply_header_colon);
    NS_GetLocalizedUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_originalmessage", NS_LITERAL_STRING("--- Original Message ---"), reply_header_originalmessage);

Here is the call graph for this function:

Here is the caller graph for this function:

static void GetTopmostMsgWindowCharacterSet ( nsXPIDLCString charset,
PRBool charsetOverride 
) [static]

Definition at line 197 of file nsMsgCompose.cpp.

  // HACK: if we are replying to a message and that message used a charset over ride
  // (as specified in the top most window (assuming the reply originated from that window)
  // then use that over ride charset instead of the charset specified in the message
  nsCOMPtr <nsIMsgMailSession> mailSession (do_GetService(NS_MSGMAILSESSION_CONTRACTID));          
  if (mailSession)
    nsCOMPtr<nsIMsgWindow>    msgWindow;
    if (msgWindow)

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kDateTimeFormatCID  ,
) [static]
static nsresult OpenAddressBook ( const char *  dbUri,
nsIAddrDatabase **  aDatabase 
) [static]

Definition at line 4045 of file nsMsgCompose.cpp.


  nsresult rv;
  nsCOMPtr<nsIAddressBook> addressBook = do_GetService(NS_ADDRESSBOOK_CONTRACTID, &rv);

  rv = addressBook->GetAbDatabaseFromURI(dbUri, aDatabase);
  return rv;

Here is the call graph for this function:

static nsresult RemoveDuplicateAddresses ( const char *  addresses,
const char *  anothersAddresses,
PRBool  removeAliasesToMe,
char **  newAddress 
) [static]

Definition at line 154 of file nsMsgCompose.cpp.

  nsresult rv;

  nsCOMPtr<nsIMsgHeaderParser> parser (do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID));
  if (parser)
    rv= parser->RemoveDuplicateAddresses("UTF-8", addresses, anothersAddresses, removeAliasesToMe, newAddress);

  return rv;

Here is the call graph for this function:

static void TranslateLineEnding ( nsString data) [static]

Definition at line 167 of file nsMsgCompose.cpp.

  PRUnichar* rPtr;   //Read pointer
  PRUnichar* wPtr;   //Write pointer
  PRUnichar* sPtr;   //Start data pointer
  PRUnichar* ePtr;   //End data pointer

  rPtr = wPtr = sPtr = data.BeginWriting();
  ePtr = rPtr + data.Length();

  while (rPtr < ePtr)
    if (*rPtr == 0x0D)
      if (rPtr + 1 < ePtr && *(rPtr + 1) == 0x0A)
        *wPtr = 0x0A;
        rPtr ++;
        *wPtr = 0x0A;
      *wPtr = *rPtr;

    rPtr ++;
    wPtr ++;

  data.SetLength(wPtr - sPtr);

Here is the caller graph for this function: