Back to index

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

#include <nsImapUrl.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
SetSpec (const nsACString &aSpec)
NS_IMETHOD SetQuery (const nsACString &aQuery)
NS_DECL_NSIIMAPURL NS_IMETHOD IsUrlType (PRUint32 type, PRBool *isType)
NS_IMETHOD SetMsgWindow (nsIMsgWindow *aMsgWindow)
NS_IMETHOD GetFolder (nsIMsgFolder **aFolder)
NS_IMETHOD SetFolder (nsIMsgFolder *aFolder)
NS_DECL_NSIMSGMESSAGEURL
NS_DECL_NSIMSGI18NURL 
nsImapUrl ()
virtual ~nsImapUrl ()
void Initialize ()
void initializeURIforMockChannel ()
void allocateCanonicalPath (in string aServerPath, in char aOnlineDelimiter, out string aAllocatedPath)
void allocateServerPath (in string aCanonicalPath, in char aOnlineDelimiter, out string aAllocatedPath)
string createServerSourceFolderPathString ()
string createCanonicalSourceFolderPathString ()
string createServerDestinationFolderPathString ()
string addOnlineDirectoryIfNecessary (in string onlineMailboxName)
void createSearchCriteriaString (out string aResult)
void createListOfMessageIdsString (out string aResult)
boolean messageIdsAreUids ()
void addChannelToLoadGroup ()
void removeChannel (in nsresult aStatus)

Static Public Member Functions

static nsresult ConvertToCanonicalFormat (const char *folderName, char onlineDelimiter, char **resultingCanonicalPath)
static nsresult EscapeSlashes (const char *sourcePath, char **resultPath)
static nsresult UnescapeSlashes (char *path)
static char * ReplaceCharsInCopiedString (const char *stringToCopy, char oldChar, char newChar)

Public Attributes

attribute nsIImapMailFolderSink imapMailFolderSink
attribute nsIImapMessageSink imapMessageSink
attribute nsIImapServerSink imapServerSink
attribute nsImapAction imapAction
readonly attribute nsImapState requiredImapState
readonly attribute string imapPartToFetch
readonly attribute string customAttributeToFetch
attribute string customAttributeResult
readonly attribute string command
attribute string customCommandResult
readonly attribute string customAddFlags
readonly attribute string customSubtractFlags
readonly attribute
imapMessageFlagsType 
msgFlags
readonly attribute long numBytesToFetch
attribute char onlineSubDirSeparator
attribute boolean allowContentChange
attribute boolean mimePartSelectorDetected
attribute nsImapContentModifiedType contentModified
attribute boolean fetchPartsOnDemand
attribute boolean msgLoadingFromCache
attribute boolean externalLinkUrl
attribute boolean validUrl
attribute nsISupports copyState
attribute nsIFileSpec msgFileSpec
attribute nsIImapMockChannel mockChannel
attribute boolean shouldStoreMsgOffline
attribute boolean rerunningUrl
const long nsImapAuthenticatedState = 0
const long nsImapSelectedState = 1
const long nsImapActionSendText = 0
const long nsImapTest = 0x00000001
const long nsImapCreateFolder = 0x00000005
const long nsImapDeleteFolder = 0x00000006
const long nsImapRenameFolder = 0x00000007
const long nsImapMoveFolderHierarchy = 0x00000008
const long nsImapLsubFolders = 0x00000009
const long nsImapGetMailAccountUrl = 0x0000000A
const long nsImapDiscoverChildrenUrl = 0x0000000B
const long nsImapDiscoverAllBoxesUrl = 0x0000000D
const long nsImapDiscoverAllAndSubscribedBoxesUrl = 0x0000000E
const long nsImapAppendMsgFromFile = 0x0000000F
const long nsImapSubscribe = 0x00000010
const long nsImapUnsubscribe = 0x00000011
const long nsImapRefreshACL = 0x00000012
const long nsImapRefreshAllACLs = 0x00000013
const long nsImapListFolder = 0x00000014
const long nsImapUpgradeToSubscription = 0x00000015
const long nsImapFolderStatus = 0x00000016
const long nsImapRefreshFolderUrls = 0x00000017
const long nsImapEnsureExistsFolder = 0x00000018
const long nsImapOfflineToOnlineCopy = 0x00000019
const long nsImapOfflineToOnlineMove = 0x0000001A
const long nsImapSelectFolder = 0x10000002
const long nsImapLiteSelectFolder = 0x10000003
const long nsImapExpungeFolder = 0x10000004
const long nsImapMsgFetch = 0x10000018
const long nsImapMsgHeader = 0x10000019
const long nsImapSearch = 0x1000001A
const long nsImapDeleteMsg = 0x1000001B
const long nsImapDeleteAllMsgs = 0x1000001C
const long nsImapAddMsgFlags = 0x1000001D
const long nsImapSubtractMsgFlags = 0x1000001E
const long nsImapSetMsgFlags = 0x1000001F
const long nsImapOnlineCopy = 0x10000020
const long nsImapOnlineMove = 0x10000021
const long nsImapOnlineToOfflineCopy = 0x10000022
const long nsImapOnlineToOfflineMove = 0x10000023
const long nsImapMsgPreview = 0x10000024
const long nsImapBiff = 0x10000026
const long nsImapSelectNoopFolder = 0x10000027
const long nsImapAppendDraftFromFile = 0x10000028
const long nsImapUidExpunge = 0x10000029
const long nsImapSaveMessageToDisk = 0x10000030
const long nsImapOpenMimePart = 0x10000031
const long nsImapMsgDownloadForOffline = 0x10000032
const long nsImapDeleteFolderAndMsgs = 0x10000033
const long nsImapUserDefinedMsgCommand = 0x10000034
const long nsImapUserDefinedFetchAttribute = 0x10000035
const long nsImapMsgFetchPeek = 0x10000036
const long nsImapMsgStoreCustomKeywords = 0x10000037
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 ()
void ParseImapPart (char *imapPartOfUrl)
void ParseFolderPath (char **resultingCanonicalPath)
void ParseSearchCriteriaString ()
void ParseUidChoice ()
void ParseMsgFlags ()
void ParseListOfMessageIds ()
void ParseCustomMsgFetchAttribute ()
void ParseNumBytes ()
nsresult GetMsgFolder (nsIMsgFolder **msgFolder)

Protected Attributes

char * m_listOfMessageIds
char * m_sourceCanonicalFolderPathSubString
char * m_destinationCanonicalFolderPathSubString
char * m_tokenPlaceHolder
char * m_urlidSubString
char m_onlineSubDirSeparator
char * m_searchCriteriaString
nsCString m_command
nsCString m_msgFetchAttribute
nsCString m_customAttributeResult
nsCString m_customCommandResult
nsCString m_customAddFlags
nsCString m_customSubtractFlags
PRInt32 m_numBytesToFetch
PRPackedBool m_validUrl
PRPackedBool m_runningUrl
PRPackedBool m_idsAreUids
PRPackedBool m_mimePartSelectorDetected
PRPackedBool m_allowContentChange
PRPackedBool m_fetchPartsOnDemand
PRPackedBool m_msgLoadingFromCache
PRPackedBool m_externalLinkUrl
PRPackedBool m_shouldStoreMsgOffline
PRPackedBool m_rerunningUrl
nsImapContentModifiedType m_contentModified
nsXPIDLCString m_userName
nsXPIDLCString m_serverKey
imapMessageFlagsType m_flags
nsImapAction m_imapAction
nsWeakPtr m_imapFolder
nsWeakPtr m_imapMailFolderSink
nsWeakPtr m_imapMessageSink
nsWeakPtr m_imapServerSink
nsCOMPtr< nsISupports > m_copyState
nsIFileSpecm_fileSpec
nsCOMPtr< nsIImapMockChannelm_mockChannel
nsCOMPtr< nsIFileSpecm_messageFileSpec
PRBool m_addDummyEnvelope
PRBool m_canonicalLineEnding
nsCString mURI
nsCString mCharsetOverride

Detailed Description

Definition at line 54 of file nsImapUrl.h.


Constructor & Destructor Documentation

nsImapUrl::~nsImapUrl ( ) [virtual]

Member Function Documentation

string nsIImapUrl::addOnlineDirectoryIfNecessary ( in string  onlineMailboxName) [inherited]
void nsIImapUrl::allocateCanonicalPath ( in string  aServerPath,
in char  aOnlineDelimiter,
out string  aAllocatedPath 
) [inherited]
void nsIImapUrl::allocateServerPath ( in string  aCanonicalPath,
in char  aOnlineDelimiter,
out string  aAllocatedPath 
) [inherited]
nsresult nsImapUrl::ConvertToCanonicalFormat ( const char *  folderName,
char  onlineDelimiter,
char **  resultingCanonicalPath 
) [static]

Definition at line 974 of file nsImapUrl.cpp.

{
  // Now, start the conversion to canonical form.

  char *canonicalPath;
  if (onlineDelimiter != '/')
  {
    nsXPIDLCString escapedPath;

    EscapeSlashes(folderName, getter_Copies(escapedPath));
    canonicalPath = ReplaceCharsInCopiedString(escapedPath, onlineDelimiter , '/');
  }
  else
  {
    canonicalPath = strdup(folderName);
  }
  if (canonicalPath)
    *resultingCanonicalPath = canonicalPath;

  return (canonicalPath) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:

nsresult nsImapUrl::EscapeSlashes ( const char *  sourcePath,
char **  resultPath 
) [static]

Definition at line 910 of file nsImapUrl.cpp.

{
  NS_ENSURE_ARG(sourcePath);
  NS_ENSURE_ARG(resultPath);
  PRInt32 extra = 0;
  PRInt32 len = strlen(sourcePath);
  const char *src = sourcePath;
  PRInt32 i;
  for ( i = 0; i < len; i++)
  {
    if (*src == '^')
      extra += 1; /* ^ -> ^^ */
    src++;
  }
  char* result = (char *)nsMemory::Alloc(len + extra + 1);
  if (!result)
    return NS_ERROR_OUT_OF_MEMORY;

  register unsigned char* dst = (unsigned char *) result;
  src = sourcePath;
  for (i = 0; i < len; i++)
  {
    unsigned char c = *src++;
    if (c == '/') 
      *dst++ = '^';
    else if (c == '^')
    {
      *dst++ = '^';
      *dst++ = '^';
    }
    else
      *dst++ = c;
  }
  *dst = '\0';     /* tack on eos */
  *resultPath = result;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 198 of file nsImapUrl.cpp.

Here is the call graph for this function:

nsresult nsImapUrl::GetMsgFolder ( nsIMsgFolder **  msgFolder) [protected]

Definition at line 1532 of file nsImapUrl.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:

virtual const char* nsImapUrl::GetUserName ( ) [inline, protected, virtual]

Definition at line 89 of file nsImapUrl.h.

{ return m_userName;}
void nsIImapUrl::Initialize ( ) [inherited]

Definition at line 1519 of file nsImapUrl.cpp.

Here is the caller graph for this function:

void nsImapUrl::ParseFolderPath ( char **  resultingCanonicalPath) [protected]

Definition at line 1405 of file nsImapUrl.cpp.

{
       char *resultPath = m_tokenPlaceHolder ? nsCRT::strtok(m_tokenPlaceHolder, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : (char *)NULL;
       
       if (!resultPath)
       {
              m_validUrl = PR_FALSE;
              return;
       }
       NS_ASSERTION(*resultingCanonicalPath == nsnull, "whoops, mem leak");

       char dirSeparator = *resultPath;

       *resultingCanonicalPath = PL_strdup(resultPath + 1);
       nsUnescape(*resultingCanonicalPath);
       // The delimiter will be set for a given URL, but will not be statically available
       // from an arbitrary URL.  It is the creator's responsibility to fill in the correct
       // delimiter from the folder's namespace when creating the URL.
       if (dirSeparator != kOnlineHierarchySeparatorUnknown)
              SetOnlineSubDirSeparator( dirSeparator);
       
       // if dirSeparator == kOnlineHierarchySeparatorUnknown, then this must be a create
       // of a top level imap box.  If there is an online subdir, we will automatically
       // use its separator.  If there is not an online subdir, we don't need a separator.
       
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsImapUrl::ParseImapPart ( char *  imapPartOfUrl) [protected]

Definition at line 490 of file nsImapUrl.cpp.

{
  m_tokenPlaceHolder = imapPartOfUrl;
  m_urlidSubString = m_tokenPlaceHolder ? nsCRT::strtok(m_tokenPlaceHolder, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : (char *)NULL;
  
  if (!m_urlidSubString)
  {
    m_validUrl = PR_FALSE;
    return;
  }
  
  if (!nsCRT::strcasecmp(m_urlidSubString, "fetch"))
  {
    m_imapAction  = nsImapMsgFetch;
    ParseUidChoice();
    PR_FREEIF(m_sourceCanonicalFolderPathSubString);
    ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    ParseListOfMessageIds(); 
    // if fetched by spam filter, the action will be changed to nsImapMsgFetchPeek
  }
  else /* if (fInternal) no concept of internal - not sure there will be one */
  {
    if (!nsCRT::strcasecmp(m_urlidSubString, "header"))
    {
      m_imapAction = nsImapMsgHeader;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "customFetch"))
    {
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      ParseCustomMsgFetchAttribute();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "previewBody"))
    {
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      ParseNumBytes();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "deletemsg"))
    {
      m_imapAction = nsImapDeleteMsg;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "uidexpunge"))
    {
      m_imapAction = nsImapUidExpunge;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "deleteallmsgs"))
    {
      m_imapAction = nsImapDeleteAllMsgs;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "addmsgflags"))
    {
      m_imapAction = nsImapAddMsgFlags;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      ParseMsgFlags();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "subtractmsgflags"))
    {
      m_imapAction = nsImapSubtractMsgFlags;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      ParseMsgFlags();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "setmsgflags"))
    {
      m_imapAction = nsImapSetMsgFlags;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      ParseMsgFlags();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "onlinecopy"))
    {
      m_imapAction = nsImapOnlineCopy;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      ParseFolderPath(&m_destinationCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "onlinemove"))
    {
      m_imapAction = nsImapOnlineMove;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      ParseFolderPath(&m_destinationCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "onlinetoofflinecopy"))
    {
      m_imapAction = nsImapOnlineToOfflineCopy;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      ParseFolderPath(&m_destinationCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "onlinetoofflinemove"))
    {
      m_imapAction = nsImapOnlineToOfflineMove;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      ParseFolderPath(&m_destinationCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "offlinetoonlinecopy"))
    {
      m_imapAction = nsImapOfflineToOnlineMove;
      ParseFolderPath(&m_destinationCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "search"))
    {
      m_imapAction = nsImapSearch;
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseSearchCriteriaString();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "test"))
    {
      m_imapAction = nsImapTest;
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "select"))
    {
      m_imapAction = nsImapSelectFolder;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      if (m_tokenPlaceHolder && *m_tokenPlaceHolder)
        ParseListOfMessageIds();
      else
        m_listOfMessageIds = PL_strdup("");
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "liteselect"))
    {
      m_imapAction = nsImapLiteSelectFolder;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "selectnoop"))
    {
      m_imapAction = nsImapSelectNoopFolder;
      m_listOfMessageIds = PL_strdup("");
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "expunge"))
    {
      m_imapAction = nsImapExpungeFolder;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      m_listOfMessageIds = PL_strdup("");        // no ids to UNDO
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "create"))
    {
      m_imapAction = nsImapCreateFolder;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "ensureExists"))
    {
      m_imapAction = nsImapEnsureExistsFolder;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "discoverchildren"))
    {
      m_imapAction = nsImapDiscoverChildrenUrl;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "discoverallboxes"))
    {
      m_imapAction = nsImapDiscoverAllBoxesUrl;
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "discoverallandsubscribedboxes"))
    {
      m_imapAction = nsImapDiscoverAllAndSubscribedBoxesUrl;
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "delete"))
    {
      m_imapAction = nsImapDeleteFolder;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "deletefolder"))
    {
      m_imapAction = nsImapDeleteFolderAndMsgs;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "rename"))
    {
      m_imapAction = nsImapRenameFolder;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseFolderPath(&m_destinationCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "movefolderhierarchy"))
    {
      m_imapAction = nsImapMoveFolderHierarchy;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      if (m_tokenPlaceHolder && *m_tokenPlaceHolder)    // handle promote to root
        ParseFolderPath(&m_destinationCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "list"))
    {
      m_imapAction = nsImapLsubFolders;
      ParseFolderPath(&m_destinationCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "biff"))
    {
      m_imapAction = nsImapBiff;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "netscape"))
    {
      m_imapAction = nsImapGetMailAccountUrl;
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "appendmsgfromfile"))
    {
      m_imapAction = nsImapAppendMsgFromFile;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "appenddraftfromfile"))
    {
      m_imapAction = nsImapAppendDraftFromFile;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseUidChoice();
      if (m_tokenPlaceHolder && *m_tokenPlaceHolder)
        ParseListOfMessageIds();
      else
        m_listOfMessageIds = strdup("");
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "subscribe"))
    {
      m_imapAction = nsImapSubscribe;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "unsubscribe"))
    {
      m_imapAction = nsImapUnsubscribe;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "refreshacl"))
    {
      m_imapAction = nsImapRefreshACL;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "refreshfolderurls"))
    {
      m_imapAction = nsImapRefreshFolderUrls;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "refreshallacls"))
    {
      m_imapAction = nsImapRefreshAllACLs;
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "listfolder"))
    {
      m_imapAction = nsImapListFolder;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "upgradetosubscription"))
    {
      m_imapAction = nsImapUpgradeToSubscription;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (!nsCRT::strcasecmp(m_urlidSubString, "folderstatus"))
    {
      m_imapAction = nsImapFolderStatus;
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
    }
    else if (m_imapAction == nsIImapUrl::nsImapUserDefinedMsgCommand)
    {
      m_command = m_urlidSubString; // save this
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
    }
    else if (m_imapAction == nsIImapUrl::nsImapMsgStoreCustomKeywords)
    {
      ParseUidChoice();
      ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
      ParseListOfMessageIds();
      PRBool addKeyword = (m_tokenPlaceHolder && *m_tokenPlaceHolder != '>');
      // if we're not adding a keyword, m_tokenPlaceHolder will now look like >keywordToSubtract>
      // and strtok will leave flagsPtr pointing to keywordToSubtract. So detect this
      // case and only set the customSubtractFlags.
      char *flagsPtr = m_tokenPlaceHolder ? nsCRT::strtok(m_tokenPlaceHolder, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : (char *)nsnull;
      if (addKeyword)
      {
        m_customAddFlags.Assign(flagsPtr);
        flagsPtr = m_tokenPlaceHolder ? nsCRT::strtok(m_tokenPlaceHolder, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : (char *)nsnull;
      }
      m_customSubtractFlags.Assign(flagsPtr);
    }
    else
    {
      m_validUrl = PR_FALSE;       
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1498 of file nsImapUrl.cpp.

{
  m_listOfMessageIds = m_tokenPlaceHolder ? nsCRT::strtok(m_tokenPlaceHolder, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : (char *)NULL;
  if (!m_listOfMessageIds)
    m_validUrl = PR_FALSE;
  else
  {
    m_listOfMessageIds = strdup(m_listOfMessageIds);
    m_mimePartSelectorDetected = PL_strstr(m_listOfMessageIds, "&part=") != 0 || PL_strstr(m_listOfMessageIds, "?part=") != 0;
    
    // if we're asking for just the body, don't download the whole message. see
    // nsMsgQuote::QuoteMessage() for the "header=" settings when replying to msgs.
    if (!m_fetchPartsOnDemand)
      m_fetchPartsOnDemand = (PL_strstr(m_listOfMessageIds, "?header=quotebody") != 0 || 
      PL_strstr(m_listOfMessageIds, "?header=only") != 0);
    // if it's a spam filter trying to fetch the msg, don't let it get marked read.
    if (PL_strstr(m_listOfMessageIds,"?header=filter") != 0)
      m_imapAction = nsImapMsgFetchPeek;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsImapUrl::ParseMsgFlags ( ) [protected]

Definition at line 1485 of file nsImapUrl.cpp.

{
       char *flagsPtr = m_tokenPlaceHolder ? nsCRT::strtok(m_tokenPlaceHolder, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : (char *)NULL;
       if (flagsPtr)
       {
              // the url is encodes the flags byte as ascii 
              int intFlags = atoi(flagsPtr);
              m_flags = (imapMessageFlagsType) intFlags;       // cast here 
       }
       else
              m_flags = 0;
}

Here is the caller graph for this function:

void nsImapUrl::ParseNumBytes ( ) [protected]

Definition at line 1524 of file nsImapUrl.cpp.

{
  const char *numBytes = (m_tokenPlaceHolder) ? nsCRT::strtok(m_tokenPlaceHolder, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : 0;
  m_numBytesToFetch = numBytes ? atoi(numBytes) : 0;
}

Here is the caller graph for this function:

Definition at line 1433 of file nsImapUrl.cpp.

{
       if (m_tokenPlaceHolder)
       {
              int quotedFlag = PR_FALSE;

              //skip initial separator
              while (*m_tokenPlaceHolder == *IMAP_URL_TOKEN_SEPARATOR)
                     m_tokenPlaceHolder++;
              
     char *saveTokenPlaceHolder = m_tokenPlaceHolder;

//            m_searchCriteriaString = m_tokenPlaceHolder;
              
              //looking for another separator outside quoted string
              while (*m_tokenPlaceHolder)
              {
                     if (*m_tokenPlaceHolder == '\\' && *(m_tokenPlaceHolder+1) == '"')
                            m_tokenPlaceHolder++;
                     else if (*m_tokenPlaceHolder == '"')
                            quotedFlag = !quotedFlag;
                     else if (!quotedFlag && *m_tokenPlaceHolder == *IMAP_URL_TOKEN_SEPARATOR)
                     {
                            *m_tokenPlaceHolder = '\0';
                            m_tokenPlaceHolder++;
                            break;
                     }
                     m_tokenPlaceHolder++;
              }
    m_searchCriteriaString = PL_strdup(saveTokenPlaceHolder);
              if (*m_tokenPlaceHolder == '\0')
                     m_tokenPlaceHolder = NULL;

              if (*m_searchCriteriaString == '\0')
                     m_searchCriteriaString = (char *)NULL;
       }
       else
              m_searchCriteriaString = (char *)NULL;
  if (!m_searchCriteriaString)
              m_validUrl = PR_FALSE;
}

Here is the caller graph for this function:

Definition at line 1476 of file nsImapUrl.cpp.

{
       char *uidChoiceString = m_tokenPlaceHolder ? nsCRT::strtok(m_tokenPlaceHolder, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : (char *)NULL;
       if (!uidChoiceString)
              m_validUrl = PR_FALSE;
       else
    m_idsAreUids = nsCRT::strcmp(uidChoiceString, "UID") == 0;
}

Here is the caller graph for this function:

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

Definition at line 302 of file nsImapUrl.cpp.

{
  nsresult rv = NS_OK;
  // extract the user name
  GetUserPass(m_userName);
  
  nsCAutoString imapPartOfUrl;
  rv = GetPath(imapPartOfUrl);
  NS_UnescapeURL(imapPartOfUrl);
  if (NS_SUCCEEDED(rv) && !imapPartOfUrl.IsEmpty())
  {
    ParseImapPart(imapPartOfUrl.BeginWriting()+1);  // GetPath leaves leading '/' in the path!!!
  }
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIImapUrl::removeChannel ( in nsresult  aStatus) [inherited]
char * nsImapUrl::ReplaceCharsInCopiedString ( const char *  stringToCopy,
char  oldChar,
char  newChar 
) [static]

Definition at line 1382 of file nsImapUrl.cpp.

{      
       char oldCharString[2];
       *oldCharString = oldChar;
       *(oldCharString+1) = 0;
       
       char *translatedString = PL_strdup(stringToCopy);
       char *currentSeparator = PL_strstr(translatedString, oldCharString);
       
       while(currentSeparator)
       {
              *currentSeparator = newChar;
              currentSeparator = PL_strstr(currentSeparator+1, oldCharString);
       }

       return translatedString;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 208 of file nsImapUrl.cpp.

{
  nsresult rv;
  m_imapFolder = do_GetWeakReference(aMsgFolder, &rv);
  if (aMsgFolder)
  {
    nsCOMPtr <nsIMsgIncomingServer> incomingServer;
    aMsgFolder->GetServer(getter_AddRefs(incomingServer));
    if (incomingServer)
      incomingServer->GetKey(getter_Copies(m_serverKey));
  }
  return rv;
}

Here is the call graph for this function:

Definition at line 124 of file nsImapUrl.cpp.

{
  if (aMsgWindow)
  {
    m_msgWindow = do_QueryInterface(aMsgWindow);
    if (m_mockChannel) {
      m_mockChannel->SetURI(this);
      nsCOMPtr<nsIDocShell> msgDocShell;
      m_msgWindow->GetRootDocShell(getter_AddRefs(msgDocShell));
      if (msgDocShell) {
        nsCOMPtr <nsIProgressEventSink> prevEventSink;
        m_mockChannel->GetProgressEventSink(getter_AddRefs(prevEventSink));
        nsCOMPtr<nsIInterfaceRequestor> docIR(do_QueryInterface(msgDocShell));
        m_mockChannel->SetNotificationCallbacks(docIR);
        // we want to use our existing event sink.
        if (prevEventSink)
          m_mockChannel->SetProgressEventSink(prevEventSink);
      }
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsImapUrl::SetQuery ( const nsACString &  aQuery)

Definition at line 294 of file nsImapUrl.cpp.

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

Here is the call graph for this function:

NS_IMETHODIMP nsImapUrl::SetSpec ( const nsACString &  aSpec)

Definition at line 283 of file nsImapUrl.cpp.

{
  nsresult rv = nsMsgMailNewsUrl::SetSpec(aSpec);
  if (NS_SUCCEEDED(rv))
  {
    m_validUrl = PR_TRUE;   // assume the best.
    rv = ParseUrl();
  }
  return rv;
}

Here is the call graph for this function:

nsresult nsImapUrl::UnescapeSlashes ( char *  path) [static]

Definition at line 948 of file nsImapUrl.cpp.

{
    register char *src = sourcePath;
    register char *dst = sourcePath;

    while (*src)
    {
      if (*src == '^')
      {
        if (*(src + 1) == '^')
        {
          *dst++ = '^';
          src++;   // skip over second '^'
        }
        else
          *dst++ = '/';
        src++;
      }
      else
        *dst++ = *src++;
    }

    *dst = 0;
    return NS_OK;
}

Member Data Documentation

Definition at line 135 of file nsIMsgMailNewsUrl.idl.

Definition at line 103 of file nsIImapUrl.idl.

Definition at line 136 of file nsIMsgMailNewsUrl.idl.

Definition at line 157 of file nsIMsgMailNewsUrl.idl.

readonly attribute string nsIImapUrl::command [inherited]

Definition at line 84 of file nsIImapUrl.idl.

Definition at line 105 of file nsIImapUrl.idl.

attribute nsISupports nsIImapUrl::copyState [inherited]

Definition at line 110 of file nsIImapUrl.idl.

Definition at line 86 of file nsIImapUrl.idl.

Definition at line 83 of file nsIImapUrl.idl.

Definition at line 82 of file nsIImapUrl.idl.

Definition at line 85 of file nsIImapUrl.idl.

Definition at line 87 of file nsIImapUrl.idl.

Definition at line 108 of file nsIImapUrl.idl.

Definition at line 106 of file nsIImapUrl.idl.

Definition at line 153 of file nsIMsgMailNewsUrl.idl.

Definition at line 154 of file nsIMsgMailNewsUrl.idl.

Definition at line 79 of file nsIImapUrl.idl.

Definition at line 73 of file nsIImapUrl.idl.

Definition at line 74 of file nsIImapUrl.idl.

Definition at line 81 of file nsIImapUrl.idl.

Definition at line 75 of file nsIImapUrl.idl.

Definition at line 150 of file nsImapUrl.h.

Definition at line 123 of file nsImapUrl.h.

Definition at line 151 of file nsImapUrl.h.

Definition at line 112 of file nsImapUrl.h.

Definition at line 129 of file nsImapUrl.h.

nsCOMPtr<nsISupports> nsImapUrl::m_copyState [protected]

Definition at line 144 of file nsImapUrl.h.

Definition at line 116 of file nsImapUrl.h.

Definition at line 114 of file nsImapUrl.h.

Definition at line 115 of file nsImapUrl.h.

Definition at line 117 of file nsImapUrl.h.

Definition at line 107 of file nsImapUrl.h.

Definition at line 126 of file nsImapUrl.h.

Definition at line 124 of file nsImapUrl.h.

Definition at line 145 of file nsImapUrl.h.

Definition at line 134 of file nsImapUrl.h.

Definition at line 121 of file nsImapUrl.h.

Definition at line 135 of file nsImapUrl.h.

Definition at line 137 of file nsImapUrl.h.

Definition at line 138 of file nsImapUrl.h.

Definition at line 139 of file nsImapUrl.h.

Definition at line 141 of file nsImapUrl.h.

char* nsImapUrl::m_listOfMessageIds [protected]

Definition at line 91 of file nsImapUrl.h.

Definition at line 149 of file nsImapUrl.h.

Definition at line 122 of file nsImapUrl.h.

Definition at line 146 of file nsImapUrl.h.

Definition at line 113 of file nsImapUrl.h.

Definition at line 125 of file nsImapUrl.h.

Definition at line 118 of file nsImapUrl.h.

Definition at line 110 of file nsImapUrl.h.

Definition at line 128 of file nsImapUrl.h.

Definition at line 120 of file nsImapUrl.h.

Definition at line 111 of file nsImapUrl.h.

Definition at line 132 of file nsImapUrl.h.

Definition at line 127 of file nsImapUrl.h.

Definition at line 106 of file nsImapUrl.h.

char* nsImapUrl::m_tokenPlaceHolder [protected]

Definition at line 108 of file nsImapUrl.h.

char* nsImapUrl::m_urlidSubString [protected]

Definition at line 109 of file nsImapUrl.h.

Definition at line 131 of file nsImapUrl.h.

Definition at line 119 of file nsImapUrl.h.

Definition at line 154 of file nsImapUrl.h.

Definition at line 134 of file nsIMsgMailNewsUrl.idl.

Definition at line 139 of file nsIMsgMailNewsUrl.idl.

Definition at line 104 of file nsIImapUrl.idl.

Definition at line 112 of file nsIImapUrl.idl.

Definition at line 111 of file nsIImapUrl.idl.

Definition at line 99 of file nsIImapUrl.idl.

Definition at line 107 of file nsIImapUrl.idl.

Definition at line 153 of file nsImapUrl.h.

Definition at line 133 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapAddMsgFlags = 0x1000001D [inherited]

Definition at line 174 of file nsIImapUrl.idl.

Definition at line 184 of file nsIImapUrl.idl.

Definition at line 147 of file nsIImapUrl.idl.

Definition at line 130 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapBiff = 0x10000026 [inherited]

Definition at line 182 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapCreateFolder = 0x00000005 [inherited]

Definition at line 138 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapDeleteAllMsgs = 0x1000001C [inherited]

Definition at line 173 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapDeleteFolder = 0x00000006 [inherited]

Definition at line 139 of file nsIImapUrl.idl.

Definition at line 189 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapDeleteMsg = 0x1000001B [inherited]

Definition at line 172 of file nsIImapUrl.idl.

Definition at line 146 of file nsIImapUrl.idl.

Definition at line 145 of file nsIImapUrl.idl.

Definition at line 144 of file nsIImapUrl.idl.

Definition at line 156 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapExpungeFolder = 0x10000004 [inherited]

Definition at line 168 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapFolderStatus = 0x00000016 [inherited]

Definition at line 154 of file nsIImapUrl.idl.

Definition at line 143 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapListFolder = 0x00000014 [inherited]

Definition at line 152 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapLiteSelectFolder = 0x10000003 [inherited]

Definition at line 167 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapLsubFolders = 0x00000009 [inherited]

Definition at line 142 of file nsIImapUrl.idl.

Definition at line 141 of file nsIImapUrl.idl.

Definition at line 188 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapMsgFetch = 0x10000018 [inherited]

Definition at line 169 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapMsgFetchPeek = 0x10000036 [inherited]

Definition at line 192 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapMsgHeader = 0x10000019 [inherited]

Definition at line 170 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapMsgPreview = 0x10000024 [inherited]

Definition at line 181 of file nsIImapUrl.idl.

Definition at line 193 of file nsIImapUrl.idl.

Definition at line 157 of file nsIImapUrl.idl.

Definition at line 158 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapOnlineCopy = 0x10000020 [inherited]

Definition at line 177 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapOnlineMove = 0x10000021 [inherited]

Definition at line 178 of file nsIImapUrl.idl.

Definition at line 179 of file nsIImapUrl.idl.

Definition at line 180 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapOpenMimePart = 0x10000031 [inherited]

Definition at line 187 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapRefreshACL = 0x00000012 [inherited]

Definition at line 150 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapRefreshAllACLs = 0x00000013 [inherited]

Definition at line 151 of file nsIImapUrl.idl.

Definition at line 155 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapRenameFolder = 0x00000007 [inherited]

Definition at line 140 of file nsIImapUrl.idl.

Definition at line 186 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapSearch = 0x1000001A [inherited]

Definition at line 171 of file nsIImapUrl.idl.

Definition at line 131 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapSelectFolder = 0x10000002 [inherited]

Definition at line 166 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapSelectNoopFolder = 0x10000027 [inherited]

Definition at line 183 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapSetMsgFlags = 0x1000001F [inherited]

Definition at line 176 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapSubscribe = 0x00000010 [inherited]

Definition at line 148 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapSubtractMsgFlags = 0x1000001E [inherited]

Definition at line 175 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapTest = 0x00000001 [inherited]

Definition at line 137 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapUidExpunge = 0x10000029 [inherited]

Definition at line 185 of file nsIImapUrl.idl.

const long nsIImapUrl::nsImapUnsubscribe = 0x00000011 [inherited]

Definition at line 149 of file nsIImapUrl.idl.

Definition at line 153 of file nsIImapUrl.idl.

Definition at line 191 of file nsIImapUrl.idl.

Definition at line 190 of file nsIImapUrl.idl.

Definition at line 101 of file nsIImapUrl.idl.

Definition at line 102 of file nsIImapUrl.idl.

Definition at line 137 of file nsIMsgMailNewsUrl.idl.

Definition at line 80 of file nsIImapUrl.idl.

Definition at line 115 of file nsIImapUrl.idl.

Definition at line 113 of file nsIImapUrl.idl.

Definition at line 132 of file nsIMsgMailNewsUrl.idl.

Definition at line 109 of file nsIImapUrl.idl.


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