diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mail/components/migration/src/nsMailProfileMigratorUtils.h | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mail/components/migration/src/nsMailProfileMigratorUtils.h')
-rw-r--r-- | comm/mail/components/migration/src/nsMailProfileMigratorUtils.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/comm/mail/components/migration/src/nsMailProfileMigratorUtils.h b/comm/mail/components/migration/src/nsMailProfileMigratorUtils.h new file mode 100644 index 0000000000..01f21d0d72 --- /dev/null +++ b/comm/mail/components/migration/src/nsMailProfileMigratorUtils.h @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mailprofilemigratorutils___h___ +#define mailprofilemigratorutils___h___ + +#define MIGRATION_ITEMBEFOREMIGRATE "Migration:ItemBeforeMigrate" +#define MIGRATION_ITEMAFTERMIGRATE "Migration:ItemAfterMigrate" +#define MIGRATION_STARTED "Migration:Started" +#define MIGRATION_ENDED "Migration:Ended" +#define MIGRATION_PROGRESS "Migration:Progress" + +#define NOTIFY_OBSERVERS(message, item) \ + mObserverService->NotifyObservers(nullptr, message, item) + +#define COPY_DATA(func, replace, itemIndex) \ + if (NS_SUCCEEDED(rv) && (aItems & itemIndex || !aItems)) { \ + nsAutoString index; \ + index.AppendInt(itemIndex); \ + NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get()); \ + rv = func(replace); \ + NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get()); \ + } + +#include "nsIPrefBranch.h" +#include "nsIFile.h" +#include "nsString.h" +#include "nsCOMPtr.h" +class nsIProfileStartup; + +// Proxy utilities shared by the Opera and IE migrators +void ParseOverrideServers(const char* aServers, nsIPrefBranch* aBranch); +void SetProxyPref(const nsACString& aHostPort, const char* aPref, + const char* aPortPref, nsIPrefBranch* aPrefs); + +struct MigrationData { + char16_t* fileName; + uint32_t sourceFlag; + bool replaceOnly; +}; + +class nsIFile; +void GetMigrateDataFromArray(MigrationData* aDataArray, + int32_t aDataArrayLength, bool aReplace, + nsIFile* aSourceProfile, uint16_t* aResult); + +// get the base directory of the *target* profile +// this is already cloned, modify it to your heart's content +void GetProfilePath(nsIProfileStartup* aStartup, + nsCOMPtr<nsIFile>& aProfileDir); + +#endif |