Back to index

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

#include <nsPop3IncomingServer.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIPOP3INCOMINGSERVER
NS_DECL_NSILOCALMAILINCOMINGSERVER 
nsPop3IncomingServer ()
virtual ~nsPop3IncomingServer ()
NS_IMETHOD GetLocalStoreType (char **)
NS_IMETHOD PerformBiff (nsIMsgWindow *aMsgWindow)
NS_IMETHOD GetDownloadMessagesAtStartup (PRBool *getMessages)
NS_IMETHOD GetCanBeDefaultServer (PRBool *canBeDefaultServer)
NS_IMETHOD GetCanSearchMessages (PRBool *canSearchMessages)
NS_IMETHOD GetOfflineSupportLevel (PRInt32 *aSupportLevel)
NS_IMETHOD GetRootMsgFolder (nsIMsgFolder **aRootMsgFolder)
NS_IMETHOD GetCanFileMessagesOnServer (PRBool *aCanFileMessagesOnServer)
NS_IMETHOD GetCanCreateFoldersOnServer (PRBool *aCanCreateFoldersOnServer)
NS_IMETHOD GetNewMessages (nsIMsgFolder *aFolder, nsIMsgWindow *aMsgWindow, nsIUrlListener *aUrlListener)
void addUidlToMark (in string aUidl, in PRInt32 newStatus)
void markMessages ()
void downloadMailFromServers (in nsISupportsArray aServers, in nsIMsgWindow aMsgWindow, in nsIMsgFolder aFolder, in nsIUrlListener aListener)
void createDefaultMailboxes (in nsIFileSpec path)
void setFlagsOnDefaultMailboxes ()
nsIURI getNewMail (in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, in nsIMsgFolder aInbox)

Public Attributes

attribute boolean leaveMessagesOnServer
attribute boolean headersOnly
attribute boolean deleteMailLeftOnServer
attribute boolean authLogin
attribute boolean dotFix
attribute unsigned long pop3CapabilityFlags
attribute boolean deleteByAgeFromServer
attribute long numDaysToLeaveOnServer
attribute nsIPop3Protocol runningProtocol
attribute boolean authenticated
attribute string deferredToAccount
attribute boolean deferGetNewMail

Protected Member Functions

nsresult GetInbox (nsIMsgWindow *msgWindow, nsIMsgFolder **inbox)

Private Attributes

PRUint32 m_capabilityFlags
PRBool m_authenticated
nsCOMPtr< nsIPop3Protocolm_runningProtocol
nsCOMPtr< nsIMsgFolderm_rootMsgFolder
nsVoidArray m_uidlsToMark

Detailed Description

Definition at line 49 of file nsPop3IncomingServer.h.


Constructor & Destructor Documentation

NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIPOP3INCOMINGSERVER NS_DECL_NSILOCALMAILINCOMINGSERVER nsPop3IncomingServer::nsPop3IncomingServer ( )

Definition at line 103 of file nsPop3IncomingServer.cpp.

{
}

Member Function Documentation

void nsIPop3IncomingServer::addUidlToMark ( in string  aUidl,
in PRInt32  newStatus 
) [inherited]
void nsIPop3IncomingServer::downloadMailFromServers ( in nsISupportsArray  aServers,
in nsIMsgWindow  aMsgWindow,
in nsIMsgFolder  aFolder,
in nsIUrlListener  aListener 
) [inherited]

Definition at line 514 of file nsPop3IncomingServer.cpp.

{
    *canBeDefaultServer = PR_TRUE;
    return NS_OK;
}

Definition at line 431 of file nsPop3IncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(aCanCreateFoldersOnServer);

  nsXPIDLCString deferredToAccount;
  GetDeferredToAccount(getter_Copies(deferredToAccount));
  *aCanCreateFoldersOnServer = deferredToAccount.IsEmpty();
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 419 of file nsPop3IncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(aCanFileMessagesOnServer);

  nsXPIDLCString deferredToAccount;
  GetDeferredToAccount(getter_Copies(deferredToAccount));
  *aCanFileMessagesOnServer = deferredToAccount.IsEmpty();
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 521 of file nsPop3IncomingServer.cpp.

{
  // this will return false if this server is deferred, which is what we want.
  return GetCanFileMessagesOnServer(canSearchMessages);
}

Here is the call graph for this function:

Definition at line 505 of file nsPop3IncomingServer.cpp.

{
    // GetMessages is not automatically done for pop servers at startup.
    // We need to trigger that action. Return true.
    *getMessagesAtStartup = PR_TRUE;
    return NS_OK;
}
nsresult nsPop3IncomingServer::GetInbox ( nsIMsgWindow msgWindow,
nsIMsgFolder **  inbox 
) [protected]

Definition at line 293 of file nsPop3IncomingServer.cpp.

{
  nsCOMPtr<nsIMsgFolder> rootFolder;
  nsresult rv = GetRootMsgFolder(getter_AddRefs(rootFolder));
  if(NS_SUCCEEDED(rv) && rootFolder)
  {
    PRUint32 numFolders;
    rv = rootFolder->GetFoldersWithFlag(MSG_FOLDER_FLAG_INBOX, 1, &numFolders, inbox);
    if (!*inbox)
      return NS_ERROR_NULL_POINTER;
  }
  nsCOMPtr<nsIMsgLocalMailFolder> localInbox = do_QueryInterface(*inbox, &rv);
  if (NS_SUCCEEDED(rv) && localInbox)
  {
    nsCOMPtr <nsIMsgDatabase> db;
    rv = (*inbox)->GetMsgDatabase(msgWindow, getter_AddRefs(db));
    if (NS_FAILED(rv))
    {
      (*inbox)->SetMsgDatabase(nsnull);
      (void) localInbox->SetCheckForNewMessagesAfterParsing(PR_TRUE);
      // this will cause a reparse of the mail folder.
      localInbox->GetDatabaseWithReparse(nsnull, msgWindow, getter_AddRefs(db));
      return NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
    }
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 248 of file nsPop3IncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(type);
    *type = strdup("mailbox");
    return NS_OK;
}
nsIURI nsILocalMailIncomingServer::getNewMail ( in nsIMsgWindow  aMsgWindow,
in nsIUrlListener  aUrlListener,
in nsIMsgFolder  aInbox 
) [inherited]
NS_IMETHODIMP nsPop3IncomingServer::GetNewMessages ( nsIMsgFolder aFolder,
nsIMsgWindow aMsgWindow,
nsIUrlListener aUrlListener 
)

Definition at line 466 of file nsPop3IncomingServer.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIPop3Service> pop3Service = do_GetService(kCPop3ServiceCID, &rv);
  NS_ENSURE_SUCCESS(rv,rv);

  nsCOMPtr <nsIMsgFolder> inbox;
  rv = GetInbox(aMsgWindow, getter_AddRefs(inbox));
  NS_ENSURE_SUCCESS(rv, rv);
  nsCOMPtr <nsIURI> url;
  nsCOMPtr <nsIMsgIncomingServer> server;
  nsCOMPtr <nsISupportsArray> deferredServers;
  nsXPIDLCString deferredToAccount;
  GetDeferredToAccount(getter_Copies(deferredToAccount));

  if (deferredToAccount.IsEmpty())
  {
    aFolder->GetServer(getter_AddRefs(server));
    GetDeferredServers(server, getter_AddRefs(deferredServers));
  }
  PRUint32 numDeferredServers;
  if (deferredToAccount.IsEmpty() && deferredServers && NS_SUCCEEDED(deferredServers->Count(&numDeferredServers))
    && numDeferredServers > 0)
  {
    nsPop3GetMailChainer *getMailChainer = new nsPop3GetMailChainer;
    getMailChainer->AddRef(); // this object owns itself and releases when done.
    nsCOMPtr <nsISupports> supports;
    this->QueryInterface(NS_GET_IID(nsISupports), getter_AddRefs(supports));
    deferredServers->InsertElementAt(supports, 0);
    rv = getMailChainer->GetNewMailForServers(deferredServers, aMsgWindow, inbox, aUrlListener);
  }
  else
    rv = pop3Service->GetNewMail(aMsgWindow, aUrlListener, inbox, this, getter_AddRefs(url));
  return rv;
}

Here is the call graph for this function:

Definition at line 528 of file nsPop3IncomingServer.cpp.

{
    NS_ENSURE_ARG_POINTER(aSupportLevel);
    nsresult rv;
    
    rv = GetIntValue("offline_support_level", aSupportLevel);
    if (*aSupportLevel != OFFLINE_SUPPORT_LEVEL_UNDEFINED) return rv;
    
    // set default value
    *aSupportLevel = OFFLINE_SUPPORT_LEVEL_NONE;
    return NS_OK;
}

Here is the call graph for this function:

Definition at line 257 of file nsPop3IncomingServer.cpp.

{
  NS_ENSURE_ARG_POINTER(aRootMsgFolder);
  nsresult rv = NS_OK;
  if (!m_rootMsgFolder)
  {
    nsXPIDLCString deferredToAccount;
    GetDeferredToAccount(getter_Copies(deferredToAccount));
    if (deferredToAccount.IsEmpty())
    {
      rv = CreateRootFolder();
      m_rootMsgFolder = m_rootFolder;
    }
    else
    {
      nsCOMPtr <nsIMsgAccountManager> accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
      NS_ENSURE_SUCCESS(rv,rv);
      nsCOMPtr <nsIMsgAccount> account;
      rv = accountManager->GetAccount(deferredToAccount, getter_AddRefs(account));
      NS_ENSURE_SUCCESS(rv,rv);
      if (account)
      {
        nsCOMPtr <nsIMsgIncomingServer> incomingServer;
        rv = account->GetIncomingServer(getter_AddRefs(incomingServer));
        NS_ENSURE_SUCCESS(rv,rv);
        // make sure we're not deferred to ourself...
        if (incomingServer && incomingServer != this) 
          rv = incomingServer->GetRootMsgFolder(getter_AddRefs(m_rootMsgFolder));
      }
    }
  }

  NS_IF_ADDREF(*aRootMsgFolder = m_rootMsgFolder);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 321 of file nsPop3IncomingServer.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIPop3Service> pop3Service(do_GetService(kCPop3ServiceCID, &rv));
  if (NS_FAILED(rv)) return rv;
  
  nsCOMPtr<nsIMsgFolder> inbox;
  nsCOMPtr<nsIMsgFolder> rootMsgFolder;
  nsCOMPtr<nsIUrlListener> urlListener;
  rv = GetRootMsgFolder(getter_AddRefs(rootMsgFolder));
  NS_ENSURE_SUCCESS(rv,rv);
  if (!rootMsgFolder) return NS_ERROR_FAILURE;

  PRUint32 numFolders;
  rv = rootMsgFolder->GetFoldersWithFlag(MSG_FOLDER_FLAG_INBOX, 1,
                                         &numFolders,
                                         getter_AddRefs(inbox));
  NS_ENSURE_SUCCESS(rv,rv);
  if (numFolders != 1) return NS_ERROR_FAILURE;

  nsCOMPtr <nsIMsgIncomingServer> server;
  inbox->GetServer(getter_AddRefs(server));

  server->SetPerformingBiff(PR_TRUE);

  urlListener = do_QueryInterface(inbox);

  PRBool downloadOnBiff = PR_FALSE;
  rv = GetDownloadOnBiff(&downloadOnBiff);
  if (downloadOnBiff)
  {
    nsCOMPtr <nsIMsgLocalMailFolder> localInbox = do_QueryInterface(inbox, &rv);
    if (localInbox && NS_SUCCEEDED(rv))
    {
      PRBool valid = PR_FALSE;
      nsCOMPtr <nsIMsgDatabase> db;
      rv = inbox->GetMsgDatabase(aMsgWindow, getter_AddRefs(db));
      if (NS_SUCCEEDED(rv) && db)
        rv = db->GetSummaryValid(&valid);
      if (NS_SUCCEEDED(rv) && valid)
        rv = pop3Service->GetNewMail(aMsgWindow, urlListener, inbox, this, nsnull);
      else
      {
        PRBool isLocked;
        inbox->GetLocked(&isLocked);
        if (!isLocked)
        {
          rv = localInbox->ParseFolder(aMsgWindow, urlListener);
        }
        if (NS_SUCCEEDED(rv))
          rv = localInbox->SetCheckForNewMessagesAfterParsing(PR_TRUE);
      }
    }
  }
  else
    rv = pop3Service->CheckForNewMail(nsnull, urlListener, inbox, this, nsnull);
    // it's important to pass in null for the msg window if we are performing biff
        // this makes sure that we don't show any kind of UI during biff.

  return NS_OK;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 60 of file nsIPop3IncomingServer.idl.

Definition at line 51 of file nsIPop3IncomingServer.idl.

Definition at line 65 of file nsIPop3IncomingServer.idl.

Definition at line 62 of file nsIPop3IncomingServer.idl.

Definition at line 54 of file nsIPop3IncomingServer.idl.

Definition at line 50 of file nsIPop3IncomingServer.idl.

Definition at line 52 of file nsIPop3IncomingServer.idl.

Definition at line 49 of file nsIPop3IncomingServer.idl.

Definition at line 48 of file nsIPop3IncomingServer.idl.

Definition at line 79 of file nsPop3IncomingServer.h.

Definition at line 78 of file nsPop3IncomingServer.h.

Definition at line 81 of file nsPop3IncomingServer.h.

Definition at line 80 of file nsPop3IncomingServer.h.

Definition at line 82 of file nsPop3IncomingServer.h.

Definition at line 55 of file nsIPop3IncomingServer.idl.

Definition at line 53 of file nsIPop3IncomingServer.idl.

Definition at line 56 of file nsIPop3IncomingServer.idl.


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