Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
nsMailboxUrl Class Reference

#include <nsMailboxUrl.h>

Inheritance diagram for nsMailboxUrl:
Inheritance graph
[legend]
Collaboration diagram for nsMailboxUrl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_IMETHOD SetSpec (const nsACString &aSpec)
NS_IMETHOD SetQuery (const nsACString &aQuery)
NS_IMETHOD SetMailboxParser (nsIStreamListener *aConsumer)
NS_IMETHOD GetMailboxParser (nsIStreamListener **aConsumer)
NS_IMETHOD SetMailboxCopyHandler (nsIStreamListener *aConsumer)
NS_IMETHOD GetMailboxCopyHandler (nsIStreamListener **aConsumer)
NS_IMETHOD GetFileSpec (nsFileSpec **aFilePath)
NS_IMETHOD GetMessageKey (nsMsgKey *aMessageKey)
NS_IMETHOD GetMessageSize (PRUint32 *aMessageSize)
NS_IMETHOD SetMessageSize (PRUint32 aMessageSize)
 NS_IMPL_CLASS_GETSET (MailboxAction, nsMailboxAction, m_mailboxAction)
NS_IMETHOD IsUrlType (PRUint32 type, PRBool *isType)
NS_IMETHOD SetMoveCopyMsgKeys (nsMsgKey *keysToFlag, PRInt32 numKeys)
NS_IMETHOD GetMoveCopyMsgHdrForIndex (PRUint32 msgIndex, nsIMsgDBHdr **msgHdr)
NS_IMETHOD GetNumMoveCopyMsgs (PRUint32 *numMsgs)
 NS_IMPL_CLASS_GETSET (CurMoveCopyMsgIndex, PRUint32, m_curMsgIndex)
NS_IMETHOD GetFolder (nsIMsgFolder **msgFolder)
 nsMailboxUrl ()
virtual ~nsMailboxUrl ()
void setMoveCopyMsgKeys (out nsMsgKey keysToFlag, in long numKeys)
void getMoveCopyMsgHdrForIndex (in unsigned long msgIndex, out nsIMsgDBHdr msgHdr)

Public Attributes

attribute nsIStreamListener mailboxParser
attribute nsIStreamListener mailboxCopyHandler
readonly attribute nsFileSpecPtr fileSpec
readonly attribute nsMsgKey messageKey
readonly attribute unsigned long numMoveCopyMsgs
attribute unsigned long curMoveCopyMsgIndex
attribute unsigned long messageSize
attribute nsMailboxAction mailboxAction
const long ActionParseMailbox = 0
const long ActionFetchMessage = 1
const long ActionCopyMessage = 2
const long ActionMoveMessage = 3
const long ActionSaveMessageToDisk = 4
const long ActionAppendMessageToDisk = 5
const long ActionFetchPart = 6
attribute string uri
attribute nsIFileSpec messageFile
attribute boolean AddDummyEnvelope
attribute boolean canonicalLineEnding
attribute string originalSpec
readonly attribute nsIMsgDBHdr messageHeader
readonly attribute string folderCharset
readonly attribute boolean folderCharsetOverride
attribute string charsetOverRide

Protected Member Functions

virtual nsresult ParseUrl ()
virtual const char * GetUserName ()
nsresult GetMsgHdrForKey (nsMsgKey msgKey, nsIMsgDBHdr **aMsgHdr)
nsresult ParseSearchPart ()

Protected Attributes

nsCOMPtr< nsIStreamListenerm_mailboxParser
nsCOMPtr< nsIStreamListenerm_mailboxCopyHandler
nsMailboxAction m_mailboxAction
nsFileSpecm_filePath
char * m_messageID
PRUint32 m_messageSize
nsMsgKey m_messageKey
nsXPIDLCString m_file
nsCOMPtr< nsIFileSpecm_messageFileSpec
PRBool m_addDummyEnvelope
PRBool m_canonicalLineEnding
nsMsgKeyArray m_keys
PRInt32 m_curMsgIndex
nsXPIDLCString m_originalSpec
nsCString mURI
nsCString mCharsetOverride

Detailed Description

Definition at line 50 of file nsMailboxUrl.h.


Constructor & Destructor Documentation

Definition at line 93 of file nsMailboxUrl.cpp.


Member Function Documentation

Definition at line 147 of file nsMailboxUrl.cpp.

{
  if (aFilePath)
    *aFilePath = m_filePath;
  return NS_OK;
}

Definition at line 425 of file nsMailboxUrl.cpp.

{
  // if we have a RDF URI, then try to get the folder for that URI and then ask the folder
  // for it's charset....

  nsXPIDLCString uri;
  GetUri(getter_Copies(uri));
  NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
  nsCOMPtr<nsIMsgDBHdr> msg; 
  GetMsgDBHdrFromURI(uri, getter_AddRefs(msg));
  NS_ENSURE_TRUE(msg, NS_ERROR_FAILURE);
  nsresult rv = msg->GetFolder(msgFolder);
  NS_ENSURE_SUCCESS(rv,rv);
  NS_ENSURE_TRUE(msgFolder, NS_ERROR_FAILURE);

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 134 of file nsMailboxUrl.cpp.

{
  NS_ENSURE_ARG_POINTER(aMailboxCopyHandler);
  
  if (aMailboxCopyHandler)
  {
    *aMailboxCopyHandler = m_mailboxCopyHandler;
    NS_IF_ADDREF(*aMailboxCopyHandler);
  }
  
  return  NS_OK;
}

Definition at line 119 of file nsMailboxUrl.cpp.

{
  NS_ENSURE_ARG_POINTER(aConsumer);
  
  NS_IF_ADDREF(*aConsumer = m_mailboxParser);
  return  NS_OK;
}

Definition at line 154 of file nsMailboxUrl.cpp.

{
  *aMessageKey = m_messageKey;
  return NS_OK;
}

Definition at line 160 of file nsMailboxUrl.cpp.

{
  if (aMessageSize)
  {
    *aMessageSize = m_messageSize;
    return NS_OK;
  }
  else
    return NS_ERROR_NULL_POINTER;
}

Definition at line 507 of file nsMailboxUrl.cpp.

{
  NS_ENSURE_ARG(msgHdr);
  if (msgIndex < m_keys.GetSize())
  {
    nsMsgKey nextKey = m_keys.GetAt(msgIndex);
    return GetMsgHdrForKey(nextKey, msgHdr);
  }
  return NS_MSG_MESSAGE_NOT_FOUND;
}

Here is the call graph for this function:

void nsIMailboxUrl::getMoveCopyMsgHdrForIndex ( in unsigned long  msgIndex,
out nsIMsgDBHdr  msgHdr 
) [inherited]
nsresult nsMailboxUrl::GetMsgHdrForKey ( nsMsgKey  msgKey,
nsIMsgDBHdr **  aMsgHdr 
) [protected]

Definition at line 217 of file nsMailboxUrl.cpp.

{
  nsresult rv = NS_OK;
  if (aMsgHdr && m_filePath)
  {
    nsCOMPtr<nsIMsgDatabase> mailDBFactory;
    nsCOMPtr<nsIMsgDatabase> mailDB;
    
    nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
    nsCOMPtr <nsIFileSpec> dbFileSpec;
    NS_NewFileSpecWithSpec(*m_filePath, getter_AddRefs(dbFileSpec));
    
    if (msgDBService)
      rv = msgDBService->OpenMailDBFromFileSpec(dbFileSpec, PR_FALSE, PR_FALSE, (nsIMsgDatabase **) getter_AddRefs(mailDB));
    if (NS_SUCCEEDED(rv) && mailDB) // did we get a db back?
      rv = mailDB->GetMsgHdrForKey(msgKey, aMsgHdr);
    else
    {
      if (!m_msgWindow)
      {
        nsCOMPtr<nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
        NS_ENSURE_SUCCESS(rv, rv);
        mailSession->GetTopmostMsgWindow(getter_AddRefs(m_msgWindow));
      }
      // maybe this is .eml file we're trying to read. See if we can get a header from the header sink.
      if (m_msgWindow)
      {
        nsCOMPtr <nsIMsgHeaderSink> headerSink;
        m_msgWindow->GetMsgHeaderSink(getter_AddRefs(headerSink));
        if (headerSink)
          return headerSink->GetDummyMsgHeader(aMsgHdr);
      }
    }
  }
  else
    rv = NS_ERROR_NULL_POINTER;
  
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 518 of file nsMailboxUrl.cpp.

{
  NS_ENSURE_ARG(numMsgs);
  *numMsgs = m_keys.GetSize();
  return NS_OK;
}
virtual const char* nsMailboxUrl::GetUserName ( ) [inline, protected, virtual]

Definition at line 86 of file nsMailboxUrl.h.

{ return nsnull;}

Definition at line 296 of file nsMailboxUrl.cpp.

nsMailboxUrl::NS_IMPL_CLASS_GETSET ( CurMoveCopyMsgIndex  ,
PRUint32  ,
m_curMsgIndex   
)

Definition at line 326 of file nsMailboxUrl.cpp.

{
  nsCAutoString searchPart;
  nsresult rv = GetQuery(searchPart);
  // add code to this function to decompose everything past the '?'.....
  if (NS_SUCCEEDED(rv) && !searchPart.IsEmpty())
  {
    // the action for this mailbox must be a display message...
    char * msgPart = extractAttributeValue(searchPart.get(), "part=");
    if (msgPart)  // if we have a part in the url then we must be fetching just the part.
      m_mailboxAction = nsIMailboxUrl::ActionFetchPart;
    else
      m_mailboxAction = nsIMailboxUrl::ActionFetchMessage;
    
    char * messageKey = extractAttributeValue(searchPart.get(), "number=");
    m_messageID = extractAttributeValue(searchPart.get(),"messageid=");
    if (messageKey)
      m_messageKey = atol(messageKey); // convert to a long...
    
    PR_Free(msgPart);
    PR_Free(messageKey);
  }
  else
    m_mailboxAction = nsIMailboxUrl::ActionParseMailbox;
  
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMailboxUrl::ParseUrl ( ) [protected, virtual]

Definition at line 355 of file nsMailboxUrl.cpp.

{
  delete m_filePath;
  GetFilePath(m_file);
  ParseSearchPart();
  // ### fix me.
  // this hack is to avoid asserting on every local message loaded because the security manager
  // is creating an empty "mailbox://" uri for every message.
  if (strlen(m_file) < 2)
    m_filePath = nsnull;
  else
    m_filePath = new nsFileSpec(nsFilePath(nsUnescape((char *) (const char *)m_file)));
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 127 of file nsMailboxUrl.cpp.

{
  if (aMailboxCopyHandler)
    m_mailboxCopyHandler = aMailboxCopyHandler;
  return NS_OK;
}

Definition at line 112 of file nsMailboxUrl.cpp.

{
  if (aMailboxParser)
    m_mailboxParser = aMailboxParser;
  return NS_OK;
}

Definition at line 171 of file nsMailboxUrl.cpp.

{
  m_messageSize = aMessageSize;
  return NS_OK;
}

Definition at line 498 of file nsMailboxUrl.cpp.

{
  m_keys.RemoveAll();
  m_keys.Add(keysToFlag, numKeys);
  if (m_keys.GetSize() > 0 && m_messageKey == nsMsgKey_None)
    m_messageKey = m_keys.GetAt(0);
  return NS_OK;
}
void nsIMailboxUrl::setMoveCopyMsgKeys ( out nsMsgKey  keysToFlag,
in long  numKeys 
) [inherited]
NS_IMETHODIMP nsMailboxUrl::SetQuery ( const nsACString &  aQuery)

Definition at line 378 of file nsMailboxUrl.cpp.

{
  nsresult rv = nsMsgMailNewsUrl::SetQuery(aQuery);
  if (NS_SUCCEEDED(rv))
    rv = ParseUrl();
  return rv;
}

Here is the call graph for this function:

NS_IMETHODIMP nsMailboxUrl::SetSpec ( const nsACString &  aSpec)

Definition at line 370 of file nsMailboxUrl.cpp.

{
  nsresult rv = nsMsgMailNewsUrl::SetSpec(aSpec);
  if (NS_SUCCEEDED(rv))
    rv = ParseUrl();
  return rv;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 95 of file nsIMailboxUrl.idl.

Definition at line 92 of file nsIMailboxUrl.idl.

Definition at line 91 of file nsIMailboxUrl.idl.

Definition at line 96 of file nsIMailboxUrl.idl.

Definition at line 93 of file nsIMailboxUrl.idl.

Definition at line 90 of file nsIMailboxUrl.idl.

Definition at line 94 of file nsIMailboxUrl.idl.

Definition at line 135 of file nsIMsgMailNewsUrl.idl.

Definition at line 136 of file nsIMsgMailNewsUrl.idl.

Definition at line 157 of file nsIMsgMailNewsUrl.idl.

Definition at line 80 of file nsIMailboxUrl.idl.

Definition at line 71 of file nsIMailboxUrl.idl.

Definition at line 153 of file nsIMsgMailNewsUrl.idl.

Definition at line 154 of file nsIMsgMailNewsUrl.idl.

Definition at line 102 of file nsMailboxUrl.h.

Definition at line 103 of file nsMailboxUrl.h.

Definition at line 108 of file nsMailboxUrl.h.

Definition at line 98 of file nsMailboxUrl.h.

Definition at line 94 of file nsMailboxUrl.h.

nsMsgKeyArray nsMailboxUrl::m_keys [protected]

Definition at line 107 of file nsMailboxUrl.h.

Definition at line 93 of file nsMailboxUrl.h.

Definition at line 91 of file nsMailboxUrl.h.

Definition at line 90 of file nsMailboxUrl.h.

Definition at line 101 of file nsMailboxUrl.h.

char* nsMailboxUrl::m_messageID [protected]

Definition at line 95 of file nsMailboxUrl.h.

Definition at line 97 of file nsMailboxUrl.h.

Definition at line 96 of file nsMailboxUrl.h.

Definition at line 111 of file nsMailboxUrl.h.

Definition at line 87 of file nsIMailboxUrl.idl.

Definition at line 68 of file nsIMailboxUrl.idl.

Definition at line 62 of file nsIMailboxUrl.idl.

Definition at line 113 of file nsMailboxUrl.h.

Definition at line 134 of file nsIMsgMailNewsUrl.idl.

Definition at line 139 of file nsIMsgMailNewsUrl.idl.

Definition at line 74 of file nsIMailboxUrl.idl.

Definition at line 85 of file nsIMailboxUrl.idl.

Definition at line 112 of file nsMailboxUrl.h.

readonly attribute unsigned long nsIMailboxUrl::numMoveCopyMsgs [inherited]

Definition at line 79 of file nsIMailboxUrl.idl.

Definition at line 137 of file nsIMsgMailNewsUrl.idl.

Definition at line 132 of file nsIMsgMailNewsUrl.idl.


The documentation for this class was generated from the following files: