FarString CPerson::getAddresses() const { FarString addresses = GetMailboxName(); for ( PPerson p = m_Next; p != NULL ; p = p->m_Next ) addresses += ", " + m_Next->GetMailboxName(); return addresses; }
NS_IMETHODIMP nsImportGenericMail::GetData(const char *dataId, nsISupports **_retval) { nsresult rv = NS_OK; NS_PRECONDITION(_retval != nullptr, "null ptr"); if (!_retval) return NS_ERROR_NULL_POINTER; *_retval = nullptr; if (!PL_strcasecmp(dataId, "mailInterface")) { *_retval = m_pInterface; NS_IF_ADDREF(m_pInterface); } if (!PL_strcasecmp(dataId, "mailBoxes")) { if (!m_pMailboxes) GetDefaultMailboxes(); *_retval = m_pMailboxes; NS_IF_ADDREF(m_pMailboxes); } if (!PL_strcasecmp(dataId, "mailLocation")) { if (!m_pSrcLocation) GetDefaultLocation(); NS_IF_ADDREF(*_retval = m_pSrcLocation); } if (!PL_strcasecmp(dataId, "mailDestination")) { if (!m_pDestFolder) GetDefaultDestination(); NS_IF_ADDREF(*_retval = m_pDestFolder); } if (!PL_strcasecmp(dataId, "migration")) { nsCOMPtr<nsISupportsPRBool> migrationString = do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); migrationString->SetData(m_performingMigration); NS_IF_ADDREF(*_retval = migrationString); } if (!PL_strcasecmp(dataId, "currentMailbox")) { // create an nsISupportsString, get the current mailbox // name being imported and put it in the string nsCOMPtr<nsISupportsString> data = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; if (m_pThreadData) { GetMailboxName(m_pThreadData->currentMailbox, data); } NS_ADDREF(*_retval = data); } return rv; }
nsresult nsBeckyMail::CollectMailboxesInDirectory(nsIFile *aDirectory, uint32_t aDepth, nsIMutableArray *aCollected) { nsAutoString mailboxName; nsresult rv = GetMailboxName(aDirectory, mailboxName); NS_ENSURE_SUCCESS(rv, rv); if (aDepth != 0) AppendMailboxDescriptor(aDirectory, mailboxName, aDepth, aCollected); nsCOMPtr<nsIFile> folderListFile; rv = nsBeckyUtils::GetFolderListFile(aDirectory, getter_AddRefs(folderListFile)); bool folderListExists = false; if (NS_SUCCEEDED(rv)) { rv = CollectMailboxesInFolderListFile(folderListFile, aDepth, aCollected); folderListExists = true; } nsCOMPtr<nsISimpleEnumerator> entries; rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries)); NS_ENSURE_SUCCESS(rv, rv); bool more; while (NS_SUCCEEDED(entries->HasMoreElements(&more)) && more) { nsCOMPtr<nsISupports> entry; rv = entries->GetNext(getter_AddRefs(entry)); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIFile> file = do_QueryInterface(entry, &rv); NS_ENSURE_SUCCESS(rv, rv); nsAutoString name; rv = file->GetLeafName(name); NS_ENSURE_SUCCESS(rv, rv); if (StringEndsWith(name, NS_LITERAL_STRING(".bmf"))) { AppendMailboxDescriptor(file, mailboxName, aDepth, aCollected); } // The Folder.lst file is not created if there is only one sub folder, // so we need to find the sub folder by our hands. // The folder name does not begin with # or ! maybe. Yes, maybe... if (!folderListExists) { if (StringBeginsWith(name, NS_LITERAL_STRING("#")) || StringBeginsWith(name, NS_LITERAL_STRING("!"))) continue; bool isDirectory = false; rv = file->IsDirectory(&isDirectory); if (isDirectory) { CollectMailboxesInDirectory(file, aDepth + 1, aCollected); continue; } } } return NS_OK; }