Back to index

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

#include <nsImapIncomingServer.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS_INHERITED nsImapIncomingServer ()
virtual ~nsImapIncomingServer ()
NS_IMETHOD SetKey (const char *aKey)
NS_IMETHOD GetLocalStoreType (char **type)
NS_DECL_NSIIMAPINCOMINGSERVER
NS_DECL_NSIIMAPSERVERSINK
NS_DECL_NSIMSGLOGONREDIRECTIONREQUESTER
NS_DECL_NSISUBSCRIBABLESERVER
NS_DECL_NSIURLLISTENER
NS_IMETHOD 
PerformBiff (nsIMsgWindow *aMsgWindow)
NS_IMETHOD PerformExpand (nsIMsgWindow *aMsgWindow)
NS_IMETHOD CloseCachedConnections ()
NS_IMETHOD GetConstructedPrettyName (PRUnichar **retval)
NS_IMETHOD GetCanBeDefaultServer (PRBool *canBeDefaultServer)
NS_IMETHOD GetCanCompactFoldersOnServer (PRBool *canCompactFoldersOnServer)
NS_IMETHOD GetCanUndoDeleteOnServer (PRBool *canUndoDeleteOnServer)
NS_IMETHOD GetCanSearchMessages (PRBool *canSearchMessages)
NS_IMETHOD GetCanEmptyTrashOnExit (PRBool *canEmptyTrashOnExit)
NS_IMETHOD GetIsSecureServer (PRBool *isSecureServer)
NS_IMETHOD GetOfflineSupportLevel (PRInt32 *aSupportLevel)
NS_IMETHOD GeneratePrettyNameForMigration (PRUnichar **aPrettyName)
NS_IMETHOD GetSupportsDiskSpace (PRBool *aSupportsDiskSpace)
NS_IMETHOD GetCanCreateFoldersOnServer (PRBool *aCanCreateFoldersOnServer)
 Get the preference that tells us whether the imap server in question allows us to create subfolders.
NS_IMETHOD GetCanFileMessagesOnServer (PRBool *aCanFileMessagesOnServer)
NS_IMETHOD GetFilterScope (nsMsgSearchScopeValue *filterScope)
NS_IMETHOD GetSearchScope (nsMsgSearchScopeValue *searchScope)
NS_IMETHOD GetServerRequiresPasswordForBiff (PRBool *aServerRequiresPasswordForBiff)
NS_IMETHOD OnUserOrHostNameChanged (const char *oldName, const char *newName)
NS_IMETHOD GetNumIdleConnections (PRInt32 *aNumIdleConnections)
NS_IMETHOD ForgetSessionPassword ()
NS_IMETHOD GetMsgFolderFromURI (nsIMsgFolder *aFolderResource, const char *aURI, nsIMsgFolder **aFolder)
NS_IMETHOD SetSocketType (PRInt32 aSocketType)
boolean getIsPFC (in string folderName)
nsIMsgFolder getPFC (in boolean createIfMissing)
void GetImapConnectionAndLoadUrl (in nsIEventQueue aClientEventQueue, in nsIImapUrl aImapUrl, in nsISupports aConsumer)
void RemoveConnection (in nsIImapProtocol aImapConnection)
void ResetNamespaceReferences ()
void pseudoInterruptMsgLoad (in nsIMsgFolder aImapFolder, in nsIMsgWindow aMsgWindow, out boolean interrupted)
void ResetConnection (in string folderName)
void CloseConnectionForFolder (in nsIMsgFolder aMsgFolder)
void reDiscoverAllFolders ()
nsIURI subscribeToFolder (in wstring name, in boolean subscribe)
nsIMsgFolder GetReadMailPFC (in boolean createIfMissing)
nsIMsgFolder GetSentMailPFC (in boolean createIfMissing)
void GetNewMessagesForNonInboxFolders (in nsIMsgFolder aRootFolder, in nsIMsgWindow aWindow, in boolean forceAllFolders, in boolean performingBiff)
void allowFolderConversion (out boolean allowConversion)
void convertFolderName (in string originalName, out wstring convertedName)
void hideFolderName (in string originalName, out boolean hideFolder)
string getTrashFolderByRedirectorType ()
string getUriWithNamespacePrefixIfNecessary (in long namespaceType, in string originalUri)
boolean possibleImapMailbox (in string folderPath, in wchar hierarchyDelim, in long boxFlags)
boolean folderNeedsACLInitialized (in string folderPath)
void addFolderRights (in string folderPath, in string userName, in string rights)
void refreshFolderRights (in string folderPath)
void discoveryDone ()
void onlineFolderDelete (in string aFolderName)
void onlineFolderCreateFailed (in string aFolderName)
void onlineFolderRename (in nsIMsgWindow msgWindow, in string oldName, in string newName)
void folderIsNoSelect (in string aFolderName, out boolean aResult)
void setFolderAdminURL (in string aFolderName, in string adminUrl)
boolean folderVerifiedOnline (in string aFolderName)
void setCapability (in unsigned long capability)
void loadNextQueuedUrl (in nsIImapProtocol aProtocol, out boolean urlRun)
void retryUrl (in nsIImapUrl aImapUrl)
void abortQueuedUrls ()
void getImapStringByID (in long aMsgId, out wstring aString)
void formatStringWithHostNameByID (in long aMsgId, out wstring aString)
void fEAlert (in wstring aString, in nsIMsgWindow aMsgWindow)
void fEAlertFromServer (in string aString, in nsIMsgWindow aMsgWindow)
void commitNamespaces ()
void promptForPassword (out string aString, in nsIMsgWindow aMsgWindow)
void setMailServerUrls (in string manageMailAccount, in string manageLists, in string manageFilters)
void RemoveChannelFromUrl (in nsIMsgMailNewsUrl aUrl, in unsigned long statusCode)
void forgetPassword ()
string cramMD5Hash (in string decodedChallenge, in string key)
void OnLogonRedirectionError (in wstring pErrMsg, in boolean badPassword)
void OnLogonRedirectionProgress (in nsMsgLogonRedirectionState pState)
void OnLogonRedirectionReply (in wstring pHost, in unsigned short pPort, in string pCookieData, in unsigned short pCookieSize)
void startPopulating (in nsIMsgWindow aMsgWindow, in boolean forceToServer)
void startPopulatingWithUri (in nsIMsgWindow aMsgWindow, in boolean forceToServer, in string uri)
void stopPopulating (in nsIMsgWindow aMsgWindow)
boolean setState (in AUTF8String path, in boolean state)
void subscribeCleanup ()
void subscribe (in wstring name)
void unsubscribe (in wstring name)
void commitSubscribeChanges ()
void setIncomingServer (in nsIMsgIncomingServer server)
void addTo (in AUTF8String aName, in boolean addAsSubscribed, in boolean aSubscribable, in boolean aChangeIfExists)
void setAsSubscribed (in AUTF8String path)
void updateSubscribed ()
void setShowFullName (in boolean showFullName)
boolean hasChildren (in AUTF8String path)
boolean isSubscribed (in AUTF8String path)
boolean isSubscribable (in AUTF8String path)
AString getLeafName (in AUTF8String path)
void getChildren (in AUTF8String path, in nsISupportsArray array)
AUTF8String getFirstChildURI (in AUTF8String path)
void setSearchValue (in AString searchValue)
void OnStartRunningUrl (in nsIURI url)
void OnStopRunningUrl (in nsIURI url, in nsresult aExitCode)

Public Attributes

attribute long maximumConnectionsNumber
attribute long timeOutLimits
attribute string adminUrl
attribute string serverDirectory
attribute long capabilityPref
attribute boolean cleanupInboxOnExit
attribute nsMsgImapDeleteModel deleteModel
attribute boolean dualUseFolders
attribute long emptyTrashThreshhold
attribute string personalNamespace
attribute string publicNamespace
attribute string otherUsersNamespace
attribute boolean offlineDownload
attribute boolean overrideNamespaces
attribute boolean usingSubscription
attribute string manageMailAccountUrl
attribute boolean fetchByChunks
attribute boolean mimePartsOnDemand
attribute boolean isAOLServer
attribute boolean aOLMailboxView
attribute boolean storeReadMailInPFC
attribute boolean storeSentMailInPFC
attribute boolean useIdle
attribute wstring trashFolderName
attribute boolean downloadBodiesOnGetNewMail
attribute boolean autoSyncOfflineStores
attribute boolean doingLsub
attribute string redirectorType
attribute boolean shuttingDown
attribute boolean userAuthenticated
readonly attribute string arbitraryHeaders
readonly attribute boolean showAttachmentsInline
attribute nsISubscribeListener subscribeListener
attribute char delimiter
readonly attribute boolean supportsSubscribeSearch

Protected Member Functions

nsresult GetFolder (const char *name, nsIMsgFolder **pFolder)
nsresult ResetFoldersToUnverified (nsIMsgFolder *parentFolder)
nsresult GetUnverifiedSubFolders (nsIMsgFolder *parentFolder, nsISupportsArray *aFoldersArray, PRInt32 *aNumUnverifiedFolders)
nsresult GetUnverifiedFolders (nsISupportsArray *aFolderArray, PRInt32 *aNumUnverifiedFolders)
nsresult DeleteNonVerifiedFolders (nsIMsgFolder *parentFolder)
PRBool NoDescendentsAreVerified (nsIMsgFolder *parentFolder)
PRBool AllDescendentsAreNoSelect (nsIMsgFolder *parentFolder)
nsresult GetStringBundle ()
const char * GetPFCName ()
nsresult GetPFCForStringId (PRBool createIfMissing, PRInt32 stringId, nsIMsgFolder **aFolder)

Private Member Functions

nsresult SubscribeToFolder (const PRUnichar *aName, PRBool subscribe)
nsresult GetImapConnection (nsIEventQueue *aEventQueue, nsIImapUrl *aImapUrl, nsIImapProtocol **aImapConnection)
nsresult CreateProtocolInstance (nsIEventQueue *aEventQueue, nsIImapProtocol **aImapConnection)
nsresult RequestOverrideInfo (nsIMsgWindow *aMsgWindow)
nsresult CreateHostSpecificPrefName (const char *prefPrefix, nsCAutoString &prefName)
nsresult DoomUrlIfChannelHasError (nsIImapUrl *aImapUrl, PRBool *urlDoomed)
PRBool ConnectionTimeOut (nsIImapProtocol *aImapConnection)
nsresult GetFormattedStringFromID (const PRUnichar *aValue, PRInt32 aID, PRUnichar **aResult)
nsresult CreatePrefNameWithRedirectorType (const char *prefSuffix, nsCAutoString &prefName)
nsresult GetPrefForServerAttribute (const char *prefSuffix, PRBool *prefValue)
nsresult AddFolderToSubscribeDialog (const char *parentUri, const char *uri, const char *folderName)
nsresult EnsureInner ()
nsresult ClearInner ()

Private Attributes

nsCOMPtr< nsISupportsArraym_connectionCache
nsCOMPtr< nsISupportsArraym_urlQueue
nsCOMPtr< nsIStringBundlem_stringBundle
nsCOMArray< nsIMsgFolderm_subscribeFolders
nsCOMArray< nsIMsgImapMailFolderm_foldersToStat
nsVoidArray m_urlConsumers
PRUint32 m_capability
nsCString m_manageMailAccountUrl
PRPackedBool m_readPFCName
PRPackedBool m_readRedirectorType
PRPackedBool m_userAuthenticated
PRPackedBool m_waitingForConnectionInfo
PRPackedBool mDoingSubscribeDialog
PRPackedBool mDoingLsub
PRPackedBool m_shuttingDown
nsCString m_pfcName
nsCString m_redirectorType
PRInt32 m_redirectedLogonRetries
nsCOMPtr< nsIMsgLogonRedirectorm_logonRedirector
nsCOMPtr< nsISubscribableServermInner

Detailed Description

Definition at line 55 of file nsImapIncomingServer.h.


Constructor & Destructor Documentation

Definition at line 136 of file nsImapIncomingServer.cpp.

{
    nsresult rv = ClearInner();
    NS_ASSERTION(NS_SUCCEEDED(rv), "ClearInner failed");

    CloseCachedConnections();
}

Here is the call graph for this function:


Member Function Documentation

void nsIImapServerSink::addFolderRights ( in string  folderPath,
in string  userName,
in string  rights 
) [inherited]
nsresult nsImapIncomingServer::AddFolderToSubscribeDialog ( const char *  parentUri,
const char *  uri,
const char *  folderName 
) [private]
void nsISubscribableServer::addTo ( in AUTF8String  aName,
in boolean  addAsSubscribed,
in boolean  aSubscribable,
in boolean  aChangeIfExists 
) [inherited]

Definition at line 1987 of file nsImapIncomingServer.cpp.

{
  PRBool allDescendentsAreNoSelect = PR_TRUE;
  nsCOMPtr<nsIEnumerator> subFolders;
  
  nsresult rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
  if(NS_SUCCEEDED(rv))
  {
    nsAdapterEnumerator *simpleEnumerator =      new nsAdapterEnumerator(subFolders);
    if (simpleEnumerator == nsnull)
      return NS_ERROR_OUT_OF_MEMORY;
    PRBool moreFolders;
    
    while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders && allDescendentsAreNoSelect)
    {
      nsCOMPtr<nsISupports> child;
      rv = simpleEnumerator->GetNext(getter_AddRefs(child));
      if (NS_SUCCEEDED(rv) && child) 
      {
        PRBool childIsNoSelect = PR_FALSE;
        nsCOMPtr <nsIMsgImapMailFolder> childImapFolder = do_QueryInterface(child, &rv);
        if (NS_SUCCEEDED(rv) && childImapFolder)
        {
          PRUint32 flags;
          
          nsCOMPtr <nsIMsgFolder> childFolder = do_QueryInterface(child, &rv);
          rv = childFolder->GetFlags(&flags);
          childIsNoSelect = NS_SUCCEEDED(rv) && (flags & MSG_FOLDER_FLAG_IMAP_NOSELECT);
          allDescendentsAreNoSelect = !childIsNoSelect && AllDescendentsAreNoSelect(childFolder);
        }
      }
    }
    delete simpleEnumerator;
  }
#if 0
  int numberOfSubfolders = parentFolder->GetNumSubFolders();
  
  for (int childIndex=0; allDescendantsAreNoSelect && (childIndex < numberOfSubfolders); childIndex++)
  {
    MSG_IMAPFolderInfoMail *currentChild = (MSG_IMAPFolderInfoMail *) parentFolder->GetSubFolder(childIndex);
    allDescendentsAreNoSelect = (currentChild->GetFolderPrefFlags() & MSG_FOLDER_PREF_IMAPNOSELECT) &&
      AllDescendentsAreNoSelect(currentChild);
  }
#endif // 0
  return allDescendentsAreNoSelect;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3085 of file nsImapIncomingServer.cpp.

{
    nsresult rv = NS_OK;

    if (mInner) {
        rv = mInner->SetSubscribeListener(nsnull);
        NS_ENSURE_SUCCESS(rv,rv);

        rv = mInner->SetIncomingServer(nsnull);
        NS_ENSURE_SUCCESS(rv,rv);

        mInner = nsnull;
    }
    return NS_OK;
}

Here is the caller graph for this function:

Definition at line 1044 of file nsImapIncomingServer.cpp.

{
  nsCOMPtr<nsIImapProtocol> connection;
  PR_CEnterMonitor(this);
  
  // iterate through the connection cache closing open connections.
  PRUint32 cnt;
  
  nsresult rv = m_connectionCache->Count(&cnt);
  if (NS_FAILED(rv)) return rv;
  
  for (PRUint32 i = cnt; i>0; i--)
  {
    connection = do_QueryElementAt(m_connectionCache, i-1);
    if (connection)
      connection->TellThreadToDie(PR_TRUE);
  }

  PR_CExitMonitor(this);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Definition at line 662 of file nsImapIncomingServer.cpp.

{
    PRBool retVal = PR_FALSE;
    if (!aConnection) return retVal;
    nsresult rv;

    PR_CEnterMonitor(this);
    PRInt32 timeoutInMinutes = 0;
    rv = GetTimeOutLimits(&timeoutInMinutes);
    if (NS_FAILED(rv) || timeoutInMinutes <= 0 || timeoutInMinutes > 29)
    {
        timeoutInMinutes = 29;
        SetTimeOutLimits(timeoutInMinutes);
    }

    PRTime cacheTimeoutLimits;

    LL_I2L(cacheTimeoutLimits, timeoutInMinutes * 60 * 1000000); // in
                                                              // microseconds
    PRTime lastActiveTimeStamp;
    rv = aConnection->GetLastActiveTimeStamp(&lastActiveTimeStamp);

    PRTime elapsedTime;
    LL_SUB(elapsedTime, PR_Now(), lastActiveTimeStamp);
    PRTime t;
    LL_SUB(t, elapsedTime, cacheTimeoutLimits);
    if (LL_GE_ZERO(t))
    {
        nsCOMPtr<nsIImapProtocol> aProtocol(do_QueryInterface(aConnection,
                                                              &rv));
        if (NS_SUCCEEDED(rv) && aProtocol)
        {
            m_connectionCache->RemoveElement(aConnection);
            aProtocol->TellThreadToDie(PR_FALSE);
            retVal = PR_TRUE;
        }
    }
    PR_CExitMonitor(this);
    return retVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIImapIncomingServer::convertFolderName ( in string  originalName,
out wstring  convertedName 
) [inherited]
string nsIImapServerSink::cramMD5Hash ( in string  decodedChallenge,
in string  key 
) [inherited]
nsresult nsImapIncomingServer::CreateHostSpecificPrefName ( const char *  prefPrefix,
nsCAutoString prefName 
) [private]

Definition at line 3180 of file nsImapIncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(prefPrefix);

  nsXPIDLCString hostName;
  nsresult rv = GetHostName(getter_Copies(hostName));
  NS_ENSURE_SUCCESS(rv,rv);

  prefName = prefPrefix;
  prefName.Append(".");
  prefName.Append(hostName.get());

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsImapIncomingServer::CreatePrefNameWithRedirectorType ( const char *  prefSuffix,
nsCAutoString prefName 
) [private]

Definition at line 3399 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(prefSuffix);

    nsXPIDLCString redirectorType;
    nsresult rv = GetRedirectorType(getter_Copies(redirectorType));
    if (NS_FAILED(rv)) 
        return rv;
    if (!redirectorType)
        return NS_ERROR_FAILURE;
 
    prefName.Assign("imap.");
    prefName.Append(redirectorType);
    prefName.Append(prefSuffix);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsImapIncomingServer::CreateProtocolInstance ( nsIEventQueue aEventQueue,
nsIImapProtocol **  aImapConnection 
) [private]

Definition at line 889 of file nsImapIncomingServer.cpp.

{
  // create a new connection and add it to the connection cache
  // we may need to flag the protocol connection as busy so we don't get
  // a race condition where someone else goes through this code 

  PRBool useSecAuth;
  GetUseSecAuth(&useSecAuth);
  nsresult rv;
  // pre-flight that we have nss - on the ui thread
  if (useSecAuth)
  {
    nsCOMPtr<nsISignatureVerifier> verifier = do_GetService(SIGNATURE_VERIFIER_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);
  }
  nsIImapProtocol * protocolInstance;
  rv = CallCreateInstance(kImapProtocolCID, &protocolInstance);
  if (NS_SUCCEEDED(rv) && protocolInstance)
  {
    nsCOMPtr<nsIImapHostSessionList> hostSession = 
      do_GetService(kCImapHostSessionListCID, &rv);
    if (NS_SUCCEEDED(rv))
      rv = protocolInstance->Initialize(hostSession, this, aEventQueue);
  }
  
  // take the protocol instance and add it to the connectionCache
  if (protocolInstance)
    m_connectionCache->AppendElement(protocolInstance);
  *aImapConnection = protocolInstance; // this is already ref counted.
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1876 of file nsImapIncomingServer.cpp.

{
  PRBool autoUnsubscribeFromNoSelectFolders = PR_TRUE;
  nsresult rv;
  nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
  if (NS_SUCCEEDED(rv))
    prefBranch->GetBoolPref("mail.imap.auto_unsubscribe_from_noselect_folders", &autoUnsubscribeFromNoSelectFolders);
  
  nsCOMPtr<nsIEnumerator> subFolders;
  
  rv = curFolder->GetSubFolders(getter_AddRefs(subFolders));
  if(NS_SUCCEEDED(rv))
  {
    nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
    if (simpleEnumerator == nsnull)
      return NS_ERROR_OUT_OF_MEMORY;
    PRBool moreFolders;
    
    while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders)
    {
      nsCOMPtr<nsISupports> child;
      rv = simpleEnumerator->GetNext(getter_AddRefs(child));
      if (NS_SUCCEEDED(rv) && child) 
      {
        PRBool childVerified = PR_FALSE;
        nsCOMPtr <nsIMsgImapMailFolder> childImapFolder = do_QueryInterface(child, &rv);
        if (NS_SUCCEEDED(rv) && childImapFolder)
        {
          PRUint32 flags;
          
          nsCOMPtr <nsIMsgFolder> childFolder = do_QueryInterface(child, &rv);
          rv = childImapFolder->GetVerifiedAsOnlineFolder(&childVerified);
          
          rv = childFolder->GetFlags(&flags);
          PRBool folderIsNoSelectFolder = NS_SUCCEEDED(rv) && ((flags & MSG_FOLDER_FLAG_IMAP_NOSELECT) != 0);
          
          PRBool usingSubscription = PR_TRUE;
          GetUsingSubscription(&usingSubscription);
          if (usingSubscription)
          {
            PRBool folderIsNameSpace = PR_FALSE;
            PRBool noDescendentsAreVerified = NoDescendentsAreVerified(childFolder);
            PRBool shouldDieBecauseNoSelect = (folderIsNoSelectFolder ? 
              ((noDescendentsAreVerified || AllDescendentsAreNoSelect(childFolder)) && !folderIsNameSpace)
              : PR_FALSE);
            if (!childVerified && (noDescendentsAreVerified || shouldDieBecauseNoSelect))
            {
            }
            
          }
          else
          {
          }
        }
      }
    }
    delete simpleEnumerator;
  }
  
    
  nsCOMPtr<nsIMsgFolder> parent;
  rv = curFolder->GetParent(getter_AddRefs(parent));
  
  if (NS_SUCCEEDED(rv) && parent)
  {
    nsCOMPtr<nsIMsgImapMailFolder> imapParent = do_QueryInterface(parent);
    if (imapParent)
      imapParent->RemoveSubFolder(curFolder);
  }
  
  return rv;
}

Here is the call graph for this function:

nsresult nsImapIncomingServer::DoomUrlIfChannelHasError ( nsIImapUrl aImapUrl,
PRBool urlDoomed 
) [private]

Definition at line 609 of file nsImapIncomingServer.cpp.

{
  nsresult rv = NS_OK;

  nsCOMPtr<nsIMsgMailNewsUrl> aMailNewsUrl(do_QueryInterface(aImapUrl, &rv));
  
  if (aMailNewsUrl && aImapUrl)
  {
    nsCOMPtr <nsIImapMockChannel> mockChannel;
    
    if (NS_SUCCEEDED(aImapUrl->GetMockChannel(getter_AddRefs(mockChannel))) && mockChannel)
    {
      nsresult requestStatus;
      nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
      if (!request)
        return NS_ERROR_FAILURE;
      request->GetStatus(&requestStatus);
      if (NS_FAILED(requestStatus))
      {
        nsresult res;
        *urlDoomed = PR_TRUE;
        nsImapProtocol::LogImapUrl("dooming url", aImapUrl);
        
        mockChannel->Close(); // try closing it to get channel listener nulled out.
        
        if (aMailNewsUrl)
        {
          nsCOMPtr<nsICacheEntryDescriptor>  cacheEntry;
          res = aMailNewsUrl->GetMemCacheEntry(getter_AddRefs(cacheEntry));
          if (NS_SUCCEEDED(res) && cacheEntry)
            cacheEntry->Doom();
          // we're aborting this url - tell listeners
          aMailNewsUrl->SetUrlState(PR_FALSE, NS_MSG_ERROR_URL_ABORTED);
        }
      }
    }
  }
  return rv;
}

Here is the call graph for this function:

Definition at line 3068 of file nsImapIncomingServer.cpp.

{
    nsresult rv = NS_OK;

    if (mInner) return NS_OK;

    mInner = do_CreateInstance(kSubscribableServerCID,&rv);
    NS_ENSURE_SUCCESS(rv,rv);
    if (!mInner) return NS_ERROR_FAILURE;

    rv = SetIncomingServer(this);
    NS_ENSURE_SUCCESS(rv,rv);

    return NS_OK;
}

Here is the call graph for this function:

void nsIImapServerSink::fEAlert ( in wstring  aString,
in nsIMsgWindow  aMsgWindow 
) [inherited]
void nsIImapServerSink::fEAlertFromServer ( in string  aString,
in nsIMsgWindow  aMsgWindow 
) [inherited]
void nsIImapServerSink::folderIsNoSelect ( in string  aFolderName,
out boolean  aResult 
) [inherited]

Definition at line 2297 of file nsImapIncomingServer.cpp.

{
  nsresult rv = nsMsgIncomingServer::ForgetSessionPassword();
  NS_ENSURE_SUCCESS(rv,rv);

  // fix for bugscape bug #15485
  // if we use turbo, and we logout, we need to make sure
  // the server doesn't think it's authenticated.
  // the biff timer continues to fire when you use turbo
  // (see #143848).  if we exited, we've set the password to null
  // but if we're authenticated, and the biff timer goes off
  // we'll still perform biff, because we use m_userAuthenticated
  // to determine if we require a password for biff.
  // (if authenticated, we don't require a password
  // see nsMsgBiffManager::PerformBiff())
  // performing biff without a password will pop up the prompt dialog
  // which is pretty wacky, when it happens after you quit the application
  m_userAuthenticated = PR_FALSE;
  return NS_OK;
}
void nsIImapServerSink::formatStringWithHostNameByID ( in long  aMsgId,
out wstring  aString 
) [inherited]

Pretty name for migrated account is of format username:<port>, provided the port is valid and not the default

Definition at line 3305 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aPrettyName);
    nsresult rv = NS_OK;
   
    nsXPIDLCString userName;
    nsXPIDLCString hostName;

    // Get user name to construct pretty name
    rv = GetUsername(getter_Copies(userName));
    NS_ENSURE_SUCCESS(rv, rv);
    
    // Get host name to construct pretty name
    rv = GetHostName(getter_Copies(hostName));
    NS_ENSURE_SUCCESS(rv, rv);

    PRInt32 defaultServerPort;
    PRInt32 defaultSecureServerPort;

    nsCOMPtr <nsIMsgProtocolInfo> protocolInfo = do_GetService("@mozilla.org/messenger/protocol/info;1?type=imap", &rv);
    NS_ENSURE_SUCCESS(rv,rv);

    // Get the default port
    rv = protocolInfo->GetDefaultServerPort(PR_FALSE, &defaultServerPort);
    NS_ENSURE_SUCCESS(rv,rv);

    // Get the default secure port
    rv = protocolInfo->GetDefaultServerPort(PR_TRUE, &defaultSecureServerPort);
    NS_ENSURE_SUCCESS(rv,rv);

    // Get the current server port
    PRInt32 serverPort = PORT_NOT_SET;
    rv = GetPort(&serverPort);
    NS_ENSURE_SUCCESS(rv,rv);

    // Is the server secure ?
    PRInt32 socketType;
    rv = GetSocketType(&socketType);
    NS_ENSURE_SUCCESS(rv,rv);
    PRBool isSecure = (socketType == nsIMsgIncomingServer::useSSL);

    // Is server port a default port ?
    PRBool isItDefaultPort = PR_FALSE;
    if (((serverPort == defaultServerPort) && !isSecure)|| 
        ((serverPort == defaultSecureServerPort) && isSecure)) {
        isItDefaultPort = PR_TRUE;
    }

    // Construct pretty name from username and hostname
    nsAutoString constructedPrettyName;
    constructedPrettyName.AssignWithConversion(userName);
    constructedPrettyName.AppendLiteral("@");
    constructedPrettyName.AppendWithConversion(hostName);

    // If the port is valid and not default, add port value to the pretty name
    if ((serverPort > 0) && (!isItDefaultPort)) {
        constructedPrettyName.AppendLiteral(":");
        constructedPrettyName.AppendInt(serverPort);
    }

    // Format the pretty name
    rv = GetFormattedStringFromID(constructedPrettyName.get(), IMAP_DEFAULT_ACCOUNT_NAME, aPrettyName);
    NS_ENSURE_SUCCESS(rv, rv);

    return rv;
}

Here is the call graph for this function:

Definition at line 3108 of file nsImapIncomingServer.cpp.

{
    *canBeDefaultServer = PR_TRUE;
    return NS_OK;
}

Definition at line 3115 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(canCompactFoldersOnServer);

    // Initialize canCompactFoldersOnServer true, a default value for IMAP
    *canCompactFoldersOnServer = PR_TRUE;

    GetPrefForServerAttribute("canCompactFoldersOnServer", canCompactFoldersOnServer);

    return NS_OK;
}

Here is the call graph for this function:

Get the preference that tells us whether the imap server in question allows us to create subfolders.

Some ISPs might not want users to create any folders besides the existing ones. Then a pref in the format imap.<redirector type>="">.canCreateFolders should be added as controller pref to mailnews.js We do want to identify all those servers that don't allow creation of subfolders and take them out of the account picker in the Copies and Folder panel.

Definition at line 3262 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aCanCreateFoldersOnServer);

    // Initialize aCanCreateFoldersOnServer true, a default value for IMAP
    *aCanCreateFoldersOnServer = PR_TRUE;

    GetPrefForServerAttribute("canCreateFolders", aCanCreateFoldersOnServer);

    return NS_OK;
}

Here is the call graph for this function:

Definition at line 3154 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(canEmptyTrashOnExit);

    // Initialize canEmptyTrashOnExit true, a default value for IMAP
    *canEmptyTrashOnExit = PR_TRUE;

    GetPrefForServerAttribute("canEmptyTrashOnExit", canEmptyTrashOnExit);

    return NS_OK;
}

Here is the call graph for this function:

Definition at line 3453 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aCanFileMessagesOnServer);

    // Initialize aCanFileMessagesOnServer true, a default value for IMAP
    *aCanFileMessagesOnServer = PR_TRUE;

    GetPrefForServerAttribute("canFileMessages", aCanFileMessagesOnServer);

    return NS_OK;
}

Here is the call graph for this function:

Definition at line 3141 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(canSearchMessages);

    // Initialize canSearchMessages true, a default value for IMAP
    *canSearchMessages = PR_TRUE;

    GetPrefForServerAttribute("canSearchMessages", canSearchMessages);

    return NS_OK;
}

Here is the call graph for this function:

Definition at line 3128 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(canUndoDeleteOnServer);

    // Initialize canUndoDeleteOnServer true, a default value for IMAP
    *canUndoDeleteOnServer = PR_TRUE;

    GetPrefForServerAttribute("canUndoDeleteOnServer", canUndoDeleteOnServer);

    return NS_OK;
}

Here is the call graph for this function:

void nsISubscribableServer::getChildren ( in AUTF8String  path,
in nsISupportsArray  array 
) [inherited]

Definition at line 205 of file nsImapIncomingServer.cpp.

{
    
  nsXPIDLCString username;
  nsXPIDLCString hostName;
  nsresult rv;

  nsCOMPtr<nsIMsgAccountManager> accountManager = 
           do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv,rv);

  nsCOMPtr<nsIMsgIdentity> identity;
  rv = accountManager->GetFirstIdentityForServer(this, getter_AddRefs(identity));
  NS_ENSURE_SUCCESS(rv,rv);

  nsAutoString emailAddress;

  if (NS_SUCCEEDED(rv) && identity)
  {
    nsXPIDLCString identityEmailAddress;
    identity->GetEmail(getter_Copies(identityEmailAddress));
    emailAddress.AssignWithConversion(identityEmailAddress);
  }
  else
  {
    rv = GetRealUsername(getter_Copies(username));
    if (NS_FAILED(rv)) return rv;
    rv = GetRealHostName(getter_Copies(hostName));
    if (NS_FAILED(rv)) return rv;
    if ((const char*)username && (const char *) hostName &&
        PL_strcmp((const char*)username, "")!=0) {
      emailAddress.AssignWithConversion(username);
      emailAddress.AppendLiteral("@");
      emailAddress.AppendWithConversion(hostName);

    }
  }

  rv = GetFormattedStringFromID(emailAddress.get(), IMAP_DEFAULT_ACCOUNT_NAME, retval);
  return rv;
}

Here is the call graph for this function:

Definition at line 3479 of file nsImapIncomingServer.cpp.

{
   NS_ENSURE_ARG_POINTER(filterScope);

   *filterScope = nsMsgSearchScope::onlineMailFilter;
   return NS_OK;
}
AUTF8String nsISubscribableServer::getFirstChildURI ( in AUTF8String  path) [inherited]
nsresult nsImapIncomingServer::GetFolder ( const char *  name,
nsIMsgFolder **  pFolder 
) [protected]

Definition at line 1629 of file nsImapIncomingServer.cpp.

{
    nsresult rv = NS_ERROR_NULL_POINTER;
    if (!name || !*name || !pFolder) return rv;
    *pFolder = nsnull;
    nsCOMPtr<nsIMsgFolder> rootFolder;
    rv = GetRootFolder(getter_AddRefs(rootFolder));
    if (NS_SUCCEEDED(rv) && rootFolder)
    {
        nsXPIDLCString uri;
        rv = rootFolder->GetURI(getter_Copies(uri));
        if (NS_SUCCEEDED(rv) && uri)
        {
          nsCAutoString uriString(uri);
          uriString.Append('/');
          uriString.Append(name);
          nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &rv));
          if (NS_FAILED(rv)) return rv;
          nsCOMPtr<nsIRDFResource> res;
          rv = rdf->GetResource(uriString, getter_AddRefs(res));
          if (NS_SUCCEEDED(rv))
          {
              nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
              if (NS_SUCCEEDED(rv) && folder)
              {
                  *pFolder = folder;
                  NS_ADDREF(*pFolder);
              }
          }
        }
    }
    return rv;
}

Here is the call graph for this function:

Definition at line 3378 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aResult);

    nsresult rv;
    rv = GetStringBundle();
    if (m_stringBundle)
    {
        const PRUnichar *formatStrings[] =
        {
            aValue,
        };
        rv = m_stringBundle->FormatStringFromID(aID,
                                    formatStrings, 1,
                                    aResult);
        NS_ENSURE_SUCCESS(rv, rv);
    }
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsImapIncomingServer::GetImapConnection ( nsIEventQueue aEventQueue,
nsIImapUrl aImapUrl,
nsIImapProtocol **  aImapConnection 
) [private]

Definition at line 704 of file nsImapIncomingServer.cpp.

{
  nsresult rv = NS_OK;
  PRBool canRunUrlImmediately = PR_FALSE;
  PRBool canRunButBusy = PR_FALSE;
  nsCOMPtr<nsIImapProtocol> connection;
  nsCOMPtr<nsIImapProtocol> freeConnection;
  PRBool isBusy = PR_FALSE;
  PRBool isInboxConnection = PR_FALSE;
  nsXPIDLCString redirectorType;

  PR_CEnterMonitor(this);

  GetRedirectorType(getter_Copies(redirectorType));
  PRBool redirectLogon = !redirectorType.IsEmpty();

  PRInt32 maxConnections = 5; // default to be five
  rv = GetMaximumConnectionsNumber(&maxConnections);
  if (NS_FAILED(rv) || maxConnections == 0)
  {
      maxConnections = 5;
      rv = SetMaximumConnectionsNumber(maxConnections);
  }
  else if (maxConnections < 1)
  {   // forced to use at least 1
      maxConnections = 1;
      rv = SetMaximumConnectionsNumber(maxConnections);
  }

  PRUint32 cnt;
  rv = m_connectionCache->Count(&cnt);
  if (NS_FAILED(rv)) return rv;

  *aImapConnection = nsnull;
       // iterate through the connection cache for a connection that can handle this url.
  PRBool userCancelled = PR_FALSE;

  // loop until we find a connection that can run the url, or doesn't have to wait?
  for (PRUint32 i = 0; i < cnt && !canRunUrlImmediately && !canRunButBusy; i++) 
  {
    connection = do_QueryElementAt(m_connectionCache, i);
    if (connection)
    {
      if (ConnectionTimeOut(connection))
      {
        connection = nsnull;
        i--; cnt--; // if the connection times out, we'll remove it from the array,
            // so we need to adjust the array index.
      }
      else
      {
        rv = connection->CanHandleUrl(aImapUrl, &canRunUrlImmediately, &canRunButBusy);
#ifdef DEBUG_bienvenu
        nsXPIDLCString curSelectedFolderName;
        if (connection)    
          connection->GetSelectedMailboxName(getter_Copies(curSelectedFolderName));
        // check that no other connection is in the same selected state.
        if (!curSelectedFolderName.IsEmpty())
        {
          for (PRUint32 j = 0; j < cnt; j++)
          {
            if (j != i)
            {
              nsCOMPtr<nsIImapProtocol> otherConnection = do_QueryElementAt(m_connectionCache, j);
              if (otherConnection)
              {
                nsXPIDLCString otherSelectedFolderName;
                otherConnection->GetSelectedMailboxName(getter_Copies(otherSelectedFolderName));
                NS_ASSERTION(!curSelectedFolderName.Equals(otherSelectedFolderName), "two connections selected on same folder");
              }

            }
          }
        }
#endif // DEBUG_bienvenu
      }
    }
    if (NS_FAILED(rv)) 
    {
        connection = nsnull;
        rv = NS_OK; // don't want to return this error, just don't use the connection
        continue;
    }

    // if this connection is wrong, but it's not busy, check if we should designate
    // it as the free connection.
    if (!canRunUrlImmediately && !canRunButBusy && connection)
    {
        rv = connection->IsBusy(&isBusy, &isInboxConnection);
        if (NS_FAILED(rv)) 
          continue;
        // if max connections is <= 1, we have to re-use the inbox connection.
        if (!isBusy && (!isInboxConnection || maxConnections <= 1))
        {
          if (!freeConnection)
            freeConnection = connection;
          else  // check which is the better free connection to use.
          {     // We prefer one not in the selected state.
            nsXPIDLCString selectedFolderName;
            connection->GetSelectedMailboxName(getter_Copies(selectedFolderName));
            if (selectedFolderName.IsEmpty())
              freeConnection = connection;
          }
        }
    }
    // don't leave this loop with connection set if we can't use it!
    if (!canRunButBusy && !canRunUrlImmediately)
      connection = nsnull;
  }
  
  if (ConnectionTimeOut(connection))
      connection = nsnull;
  if (ConnectionTimeOut(freeConnection))
    freeConnection = nsnull;
  
  if (!canRunButBusy && redirectLogon && (!connection || !canRunUrlImmediately))
  {
    // here's where we'd start the asynchronous process of requesting a connection to the 
    // AOL Imap server and getting back an ip address, port #, and cookie.
    // if m_overRideUrlConnectionInfo is true, then we can go ahead and make a connection to this server.
    // We should set some sort of timer on this override info.
    if (!m_waitingForConnectionInfo)
    {
      m_waitingForConnectionInfo = PR_TRUE;
      nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aImapUrl, &rv);
      nsCOMPtr<nsIMsgWindow> aMsgWindow;
      if (NS_SUCCEEDED(rv)) 
        rv = mailnewsUrl->GetMsgWindow(getter_AddRefs(aMsgWindow));
      
      rv = RequestOverrideInfo(aMsgWindow);
      if (m_waitingForConnectionInfo)
      canRunButBusy = PR_TRUE;
      else 
        userCancelled = PR_TRUE;
    }    
  }
  nsImapState requiredState;
  aImapUrl->GetRequiredImapState(&requiredState);
  // refresh cnt in case we killed one or more dead connections. This
  // will prevent us from not spinning up a new connection when all
  // connections were dead.
  (void) m_connectionCache->Count(&cnt);
  // if we got here and we have a connection, then we should return it!
  if (canRunUrlImmediately && connection)
  {
    *aImapConnection = connection;
    NS_IF_ADDREF(*aImapConnection);
  }
  else if (canRunButBusy)
  {
      // do nothing; return NS_OK; for queuing
  }
  else if (userCancelled)
  {
    rv = NS_BINDING_ABORTED;  // user cancelled
  }
  // CanHandleUrl will pretend that some types of urls require a selected state url
  // (e.g., a folder delete or msg append) but we shouldn't create new connections
  // for these types of urls if we have a free connection. So we check the actual
  // required state here.
  else if (cnt < ((PRUint32)maxConnections) && aEventQueue 
      && (!freeConnection || requiredState == nsIImapUrl::nsImapSelectedState))
  {    
    rv = CreateProtocolInstance(aEventQueue, aImapConnection);
  }
  else if (freeConnection)
  {
    *aImapConnection = freeConnection;
    NS_IF_ADDREF(*aImapConnection);
  }
  else // cannot get anyone to handle the url queue it
  {
    if (cnt >= (PRUint32) maxConnections)
      nsImapProtocol::LogImapUrl("exceeded connection cache limit", aImapUrl);

      // caller will queue the url
  }

  PR_CExitMonitor(this);
  return rv;
}

Here is the call graph for this function:

void nsIImapIncomingServer::GetImapConnectionAndLoadUrl ( in nsIEventQueue  aClientEventQueue,
in nsIImapUrl  aImapUrl,
in nsISupports  aConsumer 
) [inherited]
void nsIImapServerSink::getImapStringByID ( in long  aMsgId,
out wstring  aString 
) [inherited]
boolean nsIImapIncomingServer::getIsPFC ( in string  folderName) [inherited]

Definition at line 3167 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(isSecureServer);

    // Initialize isSecureServer true, a default value for IMAP
    *isSecureServer = PR_TRUE;

    GetPrefForServerAttribute("isSecureServer", isSecureServer);

    return NS_OK;
}

Here is the call graph for this function:

AString nsISubscribableServer::getLeafName ( in AUTF8String  path) [inherited]

Definition at line 248 of file nsImapIncomingServer.cpp.

NS_IMETHODIMP nsImapIncomingServer::GetMsgFolderFromURI ( nsIMsgFolder aFolderResource,
const char *  aURI,
nsIMsgFolder **  aFolder 
)

Definition at line 3742 of file nsImapIncomingServer.cpp.

{
  nsCOMPtr<nsIMsgFolder> rootMsgFolder;
  nsresult rv = GetRootMsgFolder(getter_AddRefs(rootMsgFolder));
  NS_ENSURE_SUCCESS(rv, rv);
  if (!rootMsgFolder)
    return NS_ERROR_UNEXPECTED;

  nsCOMPtr <nsIMsgFolder> msgFolder;
  PRBool namespacePrefixAdded = PR_FALSE;
  nsXPIDLCString folderUriWithNamespace;

  // Check if the folder exists as is...Even if we have a personal namespace,
  // it might be in another namespace (e.g., shared) and this will catch that.
  rv = rootMsgFolder->GetChildWithURI(aURI, PR_TRUE, PR_FALSE, getter_AddRefs(msgFolder));

  // If we couldn't find the folder as is, check if we need to prepend the
  // personal namespace
  if (!msgFolder)
  {
    GetUriWithNamespacePrefixIfNecessary(kPersonalNamespace, aURI, getter_Copies(folderUriWithNamespace));
    if (!folderUriWithNamespace.IsEmpty()) 
    {
      namespacePrefixAdded = PR_TRUE;
      rv = rootMsgFolder->GetChildWithURI(folderUriWithNamespace, PR_TRUE, PR_FALSE, getter_AddRefs(msgFolder));
    }
    else 
    {
      rv = rootMsgFolder->GetChildWithURI(aURI, PR_TRUE, PR_FALSE, getter_AddRefs(msgFolder));
    }
  }

  if (NS_FAILED(rv) || !msgFolder) {
    // we didn't find the folder so we will have to create new one.
    if (namespacePrefixAdded)
    {
      nsCOMPtr <nsIRDFService> rdf = do_GetService("@mozilla.org/rdf/rdf-service;1", &rv);
      NS_ENSURE_SUCCESS(rv,rv);

      nsCOMPtr<nsIRDFResource> resource;
      rv = rdf->GetResource(folderUriWithNamespace, getter_AddRefs(resource));
      NS_ENSURE_SUCCESS(rv,rv);
      
      nsCOMPtr <nsIMsgFolder> folderResource;
      folderResource = do_QueryInterface(resource, &rv);
      NS_ENSURE_SUCCESS(rv,rv);
      msgFolder = folderResource;
    }
    else
      msgFolder = aFolderResource;
  }

  NS_IF_ADDREF(*aFolder = msgFolder);
  return NS_OK;
}

Here is the call graph for this function:

void nsIImapIncomingServer::GetNewMessagesForNonInboxFolders ( in nsIMsgFolder  aRootFolder,
in nsIMsgWindow  aWindow,
in boolean  forceAllFolders,
in boolean  performingBiff 
) [inherited]

Definition at line 3219 of file nsImapIncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(aNumIdleConnections);
  *aNumIdleConnections = 0;
  
  nsresult rv = NS_OK;
  nsCOMPtr<nsIImapProtocol> connection;
  PRBool isBusy = PR_FALSE;
  PRBool isInboxConnection;
  PR_CEnterMonitor(this);
  
  PRUint32 cnt;
  
  rv = m_connectionCache->Count(&cnt);
  if (NS_FAILED(rv)) return rv;
  // loop counting idle connections
  for (PRUint32 i = 0; i < cnt; i++) 
  {
    connection = do_QueryElementAt(m_connectionCache, i);
    if (connection)
    {
      rv = connection->IsBusy(&isBusy, &isInboxConnection);
      if (NS_FAILED(rv)) 
        continue;
      if (!isBusy)
        (*aNumIdleConnections)++;
    }
  }
  PR_CExitMonitor(this);
  return rv;
}

Here is the call graph for this function:

Definition at line 3275 of file nsImapIncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aSupportLevel);
    nsresult rv = NS_OK;
    
    rv = GetIntValue("offline_support_level", aSupportLevel);
    if (*aSupportLevel != OFFLINE_SUPPORT_LEVEL_UNDEFINED) return rv;
    
    nsCAutoString prefName;
    rv = CreateHostSpecificPrefName("default_offline_support_level", prefName);
    NS_ENSURE_SUCCESS(rv,rv);

    nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
    if (NS_SUCCEEDED(rv) && prefBranch) {
      rv = prefBranch->GetIntPref(prefName.get(), aSupportLevel);
    } 

    // Couldn't get the pref value with the hostname. 
    // Fall back on IMAP default value
    if (NS_FAILED(rv)) {
      // set default value
      *aSupportLevel = OFFLINE_SUPPORT_LEVEL_REGULAR;
    }
    return NS_OK;
}

Here is the call graph for this function:

nsIMsgFolder nsIImapIncomingServer::getPFC ( in boolean  createIfMissing) [inherited]
nsresult nsImapIncomingServer::GetPFCForStringId ( PRBool  createIfMissing,
PRInt32  stringId,
nsIMsgFolder **  aFolder 
) [protected]

Definition at line 1107 of file nsImapIncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(aFolder);
  nsCOMPtr <nsIMsgFolder> pfcParent;

  nsresult rv = GetPFC(createIfMissing, getter_AddRefs(pfcParent));
  NS_ENSURE_SUCCESS(rv, rv);
  nsXPIDLCString pfcURI;
  pfcParent->GetURI(getter_Copies(pfcURI));

  rv = GetStringBundle();
  NS_ENSURE_SUCCESS(rv, rv);
       nsXPIDLString pfcName;
       rv = m_stringBundle->GetStringFromID(stringId, getter_Copies(pfcName));
  NS_ENSURE_SUCCESS(rv, rv);
  nsCAutoString pfcMailUri(pfcURI);
//  pfcMailUri.Append(".sbd");
  pfcMailUri.Append('/');
  AppendUTF16toUTF8(pfcName, pfcMailUri);
  pfcParent->GetChildWithURI(pfcMailUri.get(), PR_FALSE, PR_FALSE /* caseInsensitive*/, aFolder);
  if (!*aFolder && createIfMissing)
  {
              // get the URI from the incoming server
         nsCOMPtr<nsIRDFService> rdf = do_GetService("@mozilla.org/rdf/rdf-service;1", &rv);
    NS_ENSURE_SUCCESS(rv,rv);

    nsCOMPtr<nsIRDFResource> res;
         rv = rdf->GetResource(pfcMailUri, getter_AddRefs(res));
         NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr <nsIMsgFolder> parentToCreate = do_QueryInterface(res, &rv);
    NS_ENSURE_SUCCESS(rv, rv);
    
    parentToCreate->SetParent(pfcParent);
    parentToCreate->CreateStorageIfMissing(nsnull);
    NS_IF_ADDREF(*aFolder = parentToCreate);
  }
  return rv;
}

Here is the call graph for this function:

const char * nsImapIncomingServer::GetPFCName ( ) [protected]

Definition at line 1066 of file nsImapIncomingServer.cpp.

Here is the call graph for this function:

nsresult nsImapIncomingServer::GetPrefForServerAttribute ( const char *  prefSuffix,
PRBool prefValue 
) [private]

Definition at line 3418 of file nsImapIncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(prefSuffix);
  nsresult rv;
  nsCAutoString prefName;
  nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);

  nsXPIDLCString serverKey;
  rv = GetKey(getter_Copies(serverKey));

  // Time to check if this server has the pref 
  // (mail.server.<serverkey>.prefSuffix) already set
  nsMsgIncomingServer::getPrefName(serverKey, 
                                   prefSuffix, 
                                   prefName);
  rv = prefBranch->GetBoolPref(prefName.get(), prefValue);

  // If the server pref is not set in then look at the 
  // pref set with redirector type
  if (NS_FAILED(rv)) 
  {
    nsCAutoString redirectorType;
    redirectorType.Assign(".");
    redirectorType.Append(prefSuffix);

    rv = CreatePrefNameWithRedirectorType(redirectorType.get(), prefName);

    if (NS_SUCCEEDED(rv)) 
      rv = prefBranch->GetBoolPref(prefName.get(), prefValue);
  }

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3488 of file nsImapIncomingServer.cpp.

{
   NS_ENSURE_ARG_POINTER(searchScope);
   
   if (WeAreOffline()) {
     *searchScope = nsMsgSearchScope::offlineMail;
   }
   else {
     *searchScope = nsMsgSearchScope::onlineMail;
   }
   return NS_OK;
}

Here is the call graph for this function:

Definition at line 2318 of file nsImapIncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(aServerRequiresPasswordForBiff);
  // if the user has already been authenticated, we've got the password
  *aServerRequiresPasswordForBiff = !m_userAuthenticated;
  return NS_OK;
}

Definition at line 2120 of file nsImapIncomingServer.cpp.

{
  nsresult res;
       if (!m_stringBundle)
       {
              static const char propertyURL[] = IMAP_MSGS_URL;

              nsCOMPtr<nsIStringBundleService> sBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &res); 
              if (NS_SUCCEEDED(res) && (nsnull != sBundleService)) 
              {
                     res = sBundleService->CreateBundle(propertyURL, getter_AddRefs(m_stringBundle));
              }
       }
  return (m_stringBundle) ? NS_OK : res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3196 of file nsImapIncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(aSupportsDiskSpace);
  nsCAutoString prefName;
  nsresult rv = CreateHostSpecificPrefName("default_supports_diskspace", prefName);
  NS_ENSURE_SUCCESS(rv,rv);

  nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
  if (NS_SUCCEEDED(rv) && prefBranch) {
     rv = prefBranch->GetBoolPref(prefName.get(), aSupportsDiskSpace);
  }

  // Couldn't get the default value with the hostname.
  // Fall back on IMAP default value
  if (NS_FAILED(rv)) {
     // set default value
     *aSupportsDiskSpace = PR_TRUE;
  }
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsImapIncomingServer::GetUnverifiedFolders ( nsISupportsArray aFolderArray,
PRInt32 aNumUnverifiedFolders 
) [protected]

Definition at line 2223 of file nsImapIncomingServer.cpp.

{
  // can't have both be null, but one null is OK, since the caller
  // may just be trying to count the number of unverified folders.
  if (!aFoldersArray && !aNumUnverifiedFolders)
    return NS_ERROR_NULL_POINTER;

  if (aNumUnverifiedFolders)
    *aNumUnverifiedFolders = 0;
  nsCOMPtr<nsIMsgFolder> rootFolder;
  nsresult rv = GetRootFolder(getter_AddRefs(rootFolder));
  if(NS_SUCCEEDED(rv) && rootFolder)
  {
    nsCOMPtr <nsIMsgImapMailFolder> imapRoot = do_QueryInterface(rootFolder);
    if (imapRoot)
      imapRoot->SetVerifiedAsOnlineFolder(PR_TRUE); // don't need to verify the root.
    rv = GetUnverifiedSubFolders(rootFolder, aFoldersArray, aNumUnverifiedFolders);
  }
  return rv;
}

Here is the call graph for this function:

nsresult nsImapIncomingServer::GetUnverifiedSubFolders ( nsIMsgFolder parentFolder,
nsISupportsArray aFoldersArray,
PRInt32 aNumUnverifiedFolders 
) [protected]

Definition at line 2244 of file nsImapIncomingServer.cpp.

{
  nsresult rv = NS_OK;
  
  nsCOMPtr <nsIMsgImapMailFolder> imapFolder = do_QueryInterface(parentFolder);
  PRBool verified = PR_FALSE, explicitlyVerify = PR_FALSE;
  if (imapFolder)
  {
    rv = imapFolder->GetVerifiedAsOnlineFolder(&verified);
    if (NS_SUCCEEDED(rv))
      rv = imapFolder->GetExplicitlyVerify(&explicitlyVerify);
    
    if (NS_SUCCEEDED(rv) && (!verified || explicitlyVerify))
    {
      if (aFoldersArray)
      {
        nsCOMPtr <nsISupports> supports = do_QueryInterface(imapFolder);
        aFoldersArray->AppendElement(supports);
      }
      if (aNumUnverifiedFolders)
        (*aNumUnverifiedFolders)++;
    }
  }
  nsCOMPtr<nsIEnumerator> subFolders;
  
  rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
  if(NS_SUCCEEDED(rv))
  {
    nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
    if (simpleEnumerator == nsnull)
      return NS_ERROR_OUT_OF_MEMORY;
    PRBool moreFolders;
    
    while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders)
    {
      nsCOMPtr<nsISupports> child;
      rv = simpleEnumerator->GetNext(getter_AddRefs(child));
      if (NS_SUCCEEDED(rv) && child) 
      {
        nsCOMPtr <nsIMsgFolder> childFolder = do_QueryInterface(child, &rv);
        if (NS_SUCCEEDED(rv) && childFolder)
        {
          rv = GetUnverifiedSubFolders(childFolder, aFoldersArray, aNumUnverifiedFolders);
          if (NS_FAILED(rv))
            break;
        }
      }
    }
    delete simpleEnumerator;
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

string nsIImapIncomingServer::getUriWithNamespacePrefixIfNecessary ( in long  namespaceType,
in string  originalUri 
) [inherited]
boolean nsISubscribableServer::hasChildren ( in AUTF8String  path) [inherited]
void nsIImapIncomingServer::hideFolderName ( in string  originalName,
out boolean  hideFolder 
) [inherited]
boolean nsISubscribableServer::isSubscribable ( in AUTF8String  path) [inherited]
boolean nsISubscribableServer::isSubscribed ( in AUTF8String  path) [inherited]
void nsIImapServerSink::loadNextQueuedUrl ( in nsIImapProtocol  aProtocol,
out boolean  urlRun 
) [inherited]

Definition at line 1950 of file nsImapIncomingServer.cpp.

{
  PRBool nobodyIsVerified = PR_TRUE;
  
  nsCOMPtr<nsIEnumerator> subFolders;
  
  nsresult rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
  if(NS_SUCCEEDED(rv))
  {
    nsAdapterEnumerator *simpleEnumerator =      new nsAdapterEnumerator(subFolders);
    if (simpleEnumerator == nsnull)
      return NS_ERROR_OUT_OF_MEMORY;
    PRBool moreFolders;
    
    while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders && nobodyIsVerified)
    {
      nsCOMPtr<nsISupports> child;
      rv = simpleEnumerator->GetNext(getter_AddRefs(child));
      if (NS_SUCCEEDED(rv) && child) 
      {
        PRBool childVerified = PR_FALSE;
        nsCOMPtr <nsIMsgImapMailFolder> childImapFolder = do_QueryInterface(child, &rv);
        if (NS_SUCCEEDED(rv) && childImapFolder)
        {
          nsCOMPtr <nsIMsgFolder> childFolder = do_QueryInterface(child, &rv);
          rv = childImapFolder->GetVerifiedAsOnlineFolder(&childVerified);
          nobodyIsVerified = !childVerified && NoDescendentsAreVerified(childFolder);
        }
      }
    }
    delete simpleEnumerator;
  }
  
  return nobodyIsVerified;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIImapServerSink::onlineFolderDelete ( in string  aFolderName) [inherited]
void nsIImapServerSink::onlineFolderRename ( in nsIMsgWindow  msgWindow,
in string  oldName,
in string  newName 
) [inherited]
void nsIMsgLogonRedirectionRequester::OnLogonRedirectionError ( in wstring  pErrMsg,
in boolean  badPassword 
) [inherited]

Here is the caller graph for this function:

void nsIMsgLogonRedirectionRequester::OnLogonRedirectionReply ( in wstring  pHost,
in unsigned short  pPort,
in string  pCookieData,
in unsigned short  pCookieSize 
) [inherited]

Here is the caller graph for this function:

void nsIUrlListener::OnStopRunningUrl ( in nsIURI  url,
in nsresult  aExitCode 
) [inherited]

Here is the caller graph for this function:

NS_IMETHODIMP nsImapIncomingServer::OnUserOrHostNameChanged ( const char *  oldName,
const char *  newName 
)

Definition at line 3628 of file nsImapIncomingServer.cpp.

{
  nsresult rv;
  // 1. Do common things in the base class.
  rv = nsMsgIncomingServer::OnUserOrHostNameChanged(oldName, newName);
  NS_ENSURE_SUCCESS(rv,rv);

  // 2. Reset 'HaveWeEverDiscoveredFolders' flag so the new folder list can be
  //    reloaded (ie, DiscoverMailboxList() will be invoked in nsImapProtocol).
  nsCOMPtr<nsIImapHostSessionList> hostSessionList = do_GetService(kCImapHostSessionListCID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);
  nsXPIDLCString serverKey;
  rv = GetKey(getter_Copies(serverKey));
  NS_ENSURE_SUCCESS(rv, rv);
  hostSessionList->SetHaveWeEverDiscoveredFoldersForHost(serverKey.get(), PR_FALSE);

  // 3. Make all the existing folders 'unverified' so that they can be
  //    removed from the folder pane after users log into the new server.
  ResetFoldersToUnverified(nsnull);
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 1029 of file nsImapIncomingServer.cpp.

{
  
  nsCOMPtr<nsIMsgFolder> rootMsgFolder;
  nsresult rv = GetRootMsgFolder(getter_AddRefs(rootMsgFolder));
  if(NS_SUCCEEDED(rv))
  {
    SetPerformingBiff(PR_TRUE);
    rv = rootMsgFolder->GetNewMessages(aMsgWindow, nsnull);
  }
  return rv;
}

Here is the call graph for this function:

Definition at line 995 of file nsImapIncomingServer.cpp.

{
    nsXPIDLCString password;
    nsresult rv;

    
    rv = GetPassword(getter_Copies(password));
    if (NS_FAILED(rv)) return rv;
    if (password.IsEmpty())
        return NS_OK;

    rv = ResetFoldersToUnverified(nsnull);
    
    nsCOMPtr<nsIMsgFolder> rootMsgFolder;
    rv = GetRootFolder(getter_AddRefs(rootMsgFolder));
       if (NS_FAILED(rv)) return rv;
       if (!rootMsgFolder) return NS_ERROR_FAILURE;

    nsCOMPtr<nsIImapService> imapService = do_GetService(kImapServiceCID, &rv);
    if (NS_FAILED(rv)) return rv;
    if (!imapService) return NS_ERROR_FAILURE;
    nsCOMPtr<nsIEventQueue> queue;
    // get the Event Queue for this thread...
    nsCOMPtr<nsIEventQueueService> pEventQService = 
             do_GetService(kEventQueueServiceCID, &rv);
    if (NS_FAILED(rv)) return rv;
       if (!pEventQService) return NS_ERROR_FAILURE;
 
    rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
    if (NS_FAILED(rv)) return rv;
    rv = imapService->DiscoverAllFolders(queue, rootMsgFolder, this, aMsgWindow, nsnull);
       return rv;    
}

Here is the call graph for this function:

boolean nsIImapServerSink::possibleImapMailbox ( in string  folderPath,
in wchar  hierarchyDelim,
in long  boxFlags 
) [inherited]
void nsIImapServerSink::promptForPassword ( out string  aString,
in nsIMsgWindow  aMsgWindow 
) [inherited]
void nsIImapIncomingServer::pseudoInterruptMsgLoad ( in nsIMsgFolder  aImapFolder,
in nsIMsgWindow  aMsgWindow,
out boolean  interrupted 
) [inherited]
void nsIImapServerSink::RemoveChannelFromUrl ( in nsIMsgMailNewsUrl  aUrl,
in unsigned long  statusCode 
) [inherited]

Definition at line 2482 of file nsImapIncomingServer.cpp.

{
  
  nsresult rv;
  nsCAutoString contractID(NS_MSGLOGONREDIRECTORSERVICE_CONTRACTID);
  nsXPIDLCString redirectorType;
  
  GetRedirectorType(getter_Copies(redirectorType));
  contractID.Append('/');
  contractID.Append(redirectorType);
  
  m_logonRedirector = do_GetService(contractID.get(), &rv);
  if (m_logonRedirector && NS_SUCCEEDED(rv))
  {
    nsCOMPtr <nsIMsgLogonRedirectionRequester> logonRedirectorRequester;
    rv = QueryInterface(NS_GET_IID(nsIMsgLogonRedirectionRequester), getter_AddRefs(logonRedirectorRequester));
    if (NS_SUCCEEDED(rv))
    {
      nsXPIDLCString password;
      nsXPIDLCString userName;
      PRBool requiresPassword = PR_TRUE;
      
      GetRealUsername(getter_Copies(userName));
      m_logonRedirector->RequiresPassword(userName, redirectorType.get(), &requiresPassword);
      
      if (requiresPassword)
      {
        GetPassword(getter_Copies(password));
        
        if (password.IsEmpty())
          PromptForPassword(getter_Copies(password), aMsgWindow);
        
        if (password.IsEmpty())  // if still empty then the user canceld out of the password dialog
        {
          // be sure to clear the waiting for connection info flag because we aren't waiting
          // anymore for a connection...
          m_waitingForConnectionInfo = PR_FALSE;
          return NS_OK;
        }
      }
      else
      {
        SetUserAuthenticated(PR_TRUE);  // we are already authenicated
      }
      
      nsCOMPtr<nsIPrompt> dialogPrompter;
      if (aMsgWindow)
        aMsgWindow->GetPromptDialog(getter_AddRefs(dialogPrompter));
      rv = m_logonRedirector->Logon(userName, password, redirectorType, dialogPrompter, logonRedirectorRequester, nsMsgLogonRedirectionServiceIDs::Imap);
      if (NS_FAILED(rv)) 
        return OnLogonRedirectionError(nsnull, PR_TRUE);
    }
  }
  
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2179 of file nsImapIncomingServer.cpp.

{
  nsresult rv = NS_OK;
  if (!parentFolder) 
  {
    nsCOMPtr<nsIMsgFolder> rootFolder;
    rv = GetRootFolder(getter_AddRefs(rootFolder));
    if (NS_FAILED(rv)) return rv;
    return ResetFoldersToUnverified(rootFolder);
  }
  else 
  {
    nsCOMPtr<nsIEnumerator> subFolders;
    nsCOMPtr<nsIMsgImapMailFolder> imapFolder =
      do_QueryInterface(parentFolder, &rv);
    if (NS_FAILED(rv)) return rv;
    rv = imapFolder->SetVerifiedAsOnlineFolder(PR_FALSE);
    rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
    if (NS_FAILED(rv)) return rv;
    nsAdapterEnumerator *simpleEnumerator = new
      nsAdapterEnumerator(subFolders);
    if (!simpleEnumerator) return NS_ERROR_OUT_OF_MEMORY;
    PRBool moreFolders = PR_FALSE;
    while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders))
      && moreFolders) 
    {
      nsCOMPtr<nsISupports> child;
      rv = simpleEnumerator->GetNext(getter_AddRefs(child));
      if (NS_SUCCEEDED(rv) && child) 
      {
        nsCOMPtr<nsIMsgFolder> childFolder = do_QueryInterface(child,
          &rv);
        if (NS_SUCCEEDED(rv) && childFolder) 
        {
          rv = ResetFoldersToUnverified(childFolder);
          if (NS_FAILED(rv)) break;
        }
      }
    }
    delete simpleEnumerator;
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void nsIImapServerSink::retryUrl ( in nsIImapUrl  aImapUrl) [inherited]
void nsISubscribableServer::setAsSubscribed ( in AUTF8String  path) [inherited]
void nsIImapServerSink::setCapability ( in unsigned long  capability) [inherited]
void nsIImapServerSink::setFolderAdminURL ( in string  aFolderName,
in string  adminUrl 
) [inherited]

Definition at line 144 of file nsImapIncomingServer.cpp.

{
  nsMsgIncomingServer::SetKey(aKey);

  // okay now that the key has been set, we need to add ourselves to the
  // host session list...

  // every time we create an imap incoming server, we need to add it to the
  // host session list!! 

  nsresult rv;
  nsCOMPtr<nsIImapHostSessionList> hostSession = 
          do_GetService(kCImapHostSessionListCID, &rv);
  if (NS_FAILED(rv)) return rv;

  hostSession->AddHostToList(aKey, this);
  nsMsgImapDeleteModel deleteModel = nsMsgImapDeleteModels::MoveToTrash; // default to trash
  GetDeleteModel(&deleteModel);
  hostSession->SetDeleteIsMoveToTrashForHost(aKey, deleteModel == nsMsgImapDeleteModels::MoveToTrash); 
  hostSession->SetShowDeletedMessagesForHost(aKey, deleteModel == nsMsgImapDeleteModels::IMAPDelete);

  nsXPIDLCString onlineDir;
  rv = GetServerDirectory(getter_Copies(onlineDir));
  if (NS_FAILED(rv)) return rv;
  if (onlineDir)
      hostSession->SetOnlineDirForHost(aKey, (const char *) onlineDir);

  nsXPIDLCString personalNamespace;
  nsXPIDLCString publicNamespace;
  nsXPIDLCString otherUsersNamespace;

  rv = GetPersonalNamespace(getter_Copies(personalNamespace));
  if (NS_FAILED(rv)) return rv;
  rv = GetPublicNamespace(getter_Copies(publicNamespace));
  if (NS_FAILED(rv)) return rv;
  rv = GetOtherUsersNamespace(getter_Copies(otherUsersNamespace));
  if (NS_FAILED(rv)) return rv;

  if (!personalNamespace && !publicNamespace && !otherUsersNamespace)
      personalNamespace.Adopt(nsCRT::strdup("\"\""));

  hostSession->SetNamespaceFromPrefForHost(aKey, personalNamespace,
                                           kPersonalNamespace);

  if (publicNamespace && PL_strlen(publicNamespace))
      hostSession->SetNamespaceFromPrefForHost(aKey, publicNamespace,
                                               kPublicNamespace);

  if (otherUsersNamespace && PL_strlen(otherUsersNamespace))
      hostSession->SetNamespaceFromPrefForHost(aKey, otherUsersNamespace,
                                               kOtherUsersNamespace);
  PRInt32 capability;
  rv = GetCapabilityPref(&capability);
  NS_ENSURE_SUCCESS(rv, rv);
  hostSession->SetCapabilityForHost(aKey, capability);
  return rv;
}

Here is the call graph for this function:

void nsIImapServerSink::setMailServerUrls ( in string  manageMailAccount,
in string  manageLists,
in string  manageFilters 
) [inherited]
void nsISubscribableServer::setSearchValue ( in AString  searchValue) [inherited]
void nsISubscribableServer::setShowFullName ( in boolean  showFullName) [inherited]

Definition at line 3616 of file nsImapIncomingServer.cpp.

{
  PRInt32 oldSocketType;
  nsresult rv = GetSocketType(&oldSocketType);
  if (NS_SUCCEEDED(rv) && oldSocketType != aSocketType)
    CloseCachedConnections();
  nsCAutoString fullPrefName;
  getPrefName(m_serverKey.get(), "socketType", fullPrefName);
  return m_prefBranch->SetIntPref(fullPrefName.get(), aSocketType);
}

Here is the call graph for this function:

boolean nsISubscribableServer::setState ( in AUTF8String  path,
in boolean  state 
) [inherited]
void nsISubscribableServer::startPopulating ( in nsIMsgWindow  aMsgWindow,
in boolean  forceToServer 
) [inherited]
void nsISubscribableServer::startPopulatingWithUri ( in nsIMsgWindow  aMsgWindow,
in boolean  forceToServer,
in string  uri 
) [inherited]
void nsISubscribableServer::subscribe ( in wstring  name) [inherited]
nsIURI nsIImapIncomingServer::subscribeToFolder ( in wstring  name,
in boolean  subscribe 
) [inherited]

Definition at line 2940 of file nsImapIncomingServer.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIImapService> imapService = do_GetService(kImapServiceCID, &rv);
  if (NS_FAILED(rv)) return rv;
  if (!imapService) return NS_ERROR_FAILURE;
  
  nsCOMPtr<nsIMsgFolder> rootMsgFolder;
  rv = GetRootFolder(getter_AddRefs(rootMsgFolder));
  if (NS_FAILED(rv)) return rv;
  if (!rootMsgFolder) return NS_ERROR_FAILURE;
  
  // Locate the folder so that the correct hierarchical delimiter is used in the
  // folder pathnames, otherwise root's (ie, '^') is used and this is wrong.
  
  // aName is not a genuine UTF-16 but just a zero-padded modified UTF-7 
  NS_LossyConvertUTF16toASCII folderCName(aName);
  nsCOMPtr<nsIMsgFolder> msgFolder;
  if (rootMsgFolder && aName && (*aName))
  {
    rv = rootMsgFolder->FindSubFolder(folderCName, getter_AddRefs(msgFolder));
  }
  
  nsCOMPtr<nsIEventQueue> queue;
  // get the Event Queue for this thread...
  nsCOMPtr<nsIEventQueueService> pEventQService = 
    do_GetService(kEventQueueServiceCID, &rv);
  if (NS_FAILED(rv)) return rv;
  
  rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
  if (NS_FAILED(rv)) return rv;

  nsAutoString unicodeName;
  rv = CopyMUTF7toUTF16(folderCName, unicodeName);
  NS_ENSURE_SUCCESS(rv, rv);

  if (subscribe)
    rv = imapService->SubscribeFolder(queue, msgFolder, unicodeName.get(), nsnull, aUri);
  else 
    rv = imapService->UnsubscribeFolder(queue, msgFolder, unicodeName.get(), nsnull, nsnull);
  
  if (NS_FAILED(rv)) return rv;
  return NS_OK;
}

Here is the call graph for this function:

void nsISubscribableServer::unsubscribe ( in wstring  name) [inherited]

Member Data Documentation

Definition at line 64 of file nsIImapIncomingServer.idl.

Definition at line 81 of file nsIImapIncomingServer.idl.

Definition at line 77 of file nsIImapServerSink.idl.

Definition at line 90 of file nsIImapIncomingServer.idl.

Definition at line 66 of file nsIImapIncomingServer.idl.

Definition at line 67 of file nsIImapIncomingServer.idl.

Definition at line 68 of file nsIImapIncomingServer.idl.

Definition at line 61 of file nsISubscribableServer.idl.

Definition at line 108 of file nsIImapIncomingServer.idl.

Definition at line 89 of file nsIImapIncomingServer.idl.

Definition at line 69 of file nsIImapIncomingServer.idl.

Definition at line 70 of file nsIImapIncomingServer.idl.

Definition at line 78 of file nsIImapIncomingServer.idl.

Definition at line 80 of file nsIImapIncomingServer.idl.

Definition at line 138 of file nsImapIncomingServer.h.

Definition at line 132 of file nsImapIncomingServer.h.

Definition at line 136 of file nsImapIncomingServer.h.

Definition at line 150 of file nsImapIncomingServer.h.

Definition at line 139 of file nsImapIncomingServer.h.

Definition at line 147 of file nsImapIncomingServer.h.

Definition at line 140 of file nsImapIncomingServer.h.

Definition at line 141 of file nsImapIncomingServer.h.

Definition at line 149 of file nsImapIncomingServer.h.

Definition at line 148 of file nsImapIncomingServer.h.

Definition at line 146 of file nsImapIncomingServer.h.

Definition at line 134 of file nsImapIncomingServer.h.

Definition at line 135 of file nsImapIncomingServer.h.

Definition at line 137 of file nsImapIncomingServer.h.

Definition at line 133 of file nsImapIncomingServer.h.

Definition at line 142 of file nsImapIncomingServer.h.

Definition at line 143 of file nsImapIncomingServer.h.

Definition at line 77 of file nsIImapIncomingServer.idl.

Definition at line 62 of file nsIImapIncomingServer.idl.

Definition at line 145 of file nsImapIncomingServer.h.

Definition at line 144 of file nsImapIncomingServer.h.

Definition at line 79 of file nsIImapIncomingServer.idl.

Definition at line 155 of file nsImapIncomingServer.h.

Definition at line 74 of file nsIImapIncomingServer.idl.

Definition at line 73 of file nsIImapIncomingServer.idl.

Definition at line 75 of file nsIImapIncomingServer.idl.

Definition at line 71 of file nsIImapIncomingServer.idl.

Definition at line 72 of file nsIImapIncomingServer.idl.

Definition at line 113 of file nsIImapIncomingServer.idl.

Definition at line 65 of file nsIImapIncomingServer.idl.

Definition at line 80 of file nsIImapServerSink.idl.

Definition at line 116 of file nsIImapIncomingServer.idl.

Definition at line 82 of file nsIImapIncomingServer.idl.

Definition at line 83 of file nsIImapIncomingServer.idl.

Definition at line 60 of file nsISubscribableServer.idl.

Definition at line 100 of file nsISubscribableServer.idl.

Definition at line 63 of file nsIImapIncomingServer.idl.

Definition at line 85 of file nsIImapIncomingServer.idl.

Definition at line 84 of file nsIImapIncomingServer.idl.

Definition at line 72 of file nsIImapServerSink.idl.

Definition at line 76 of file nsIImapIncomingServer.idl.


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