diff options
author | fanquake <fanquake@gmail.com> | 2022-02-21 15:30:46 +0000 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-02-22 15:36:19 +0000 |
commit | 4c3e3c57463b029d335e685d3dcdaf26456666cf (patch) | |
tree | 9edc1a66757f5d4fcd2aa5a4d94cb52fd1ce8ff6 /src/clientversion.cpp | |
parent | c44e734dca64a15fae92255a5d848c04adaad2fa (diff) |
refactor: shift CopyrightHolders() and LicenseInfo() to clientversion.cpp
Diffstat (limited to 'src/clientversion.cpp')
-rw-r--r-- | src/clientversion.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 9b65952b02..192e9c52bc 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -3,9 +3,13 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <clientversion.h> +#include <util/translation.h> #include <tinyformat.h> +#include <sstream> +#include <string> +#include <vector> /** * Name of client reported in the 'version' message. Report the same name @@ -72,3 +76,32 @@ std::string FormatSubVersion(const std::string& name, int nClientVersion, const ss << "/"; return ss.str(); } + +std::string CopyrightHolders(const std::string& strPrefix) +{ + const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION); + std::string strCopyrightHolders = strPrefix + copyright_devs; + + // Make sure Bitcoin Core copyright is not removed by accident + if (copyright_devs.find("Bitcoin Core") == std::string::npos) { + strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers"; + } + return strCopyrightHolders; +} + +std::string LicenseInfo() +{ + const std::string URL_SOURCE_CODE = "<https://github.com/bitcoin/bitcoin>"; + + return CopyrightHolders(strprintf(_("Copyright (C) %i-%i").translated, 2009, COPYRIGHT_YEAR) + " ") + "\n" + + "\n" + + strprintf(_("Please contribute if you find %s useful. " + "Visit %s for further information about the software.").translated, PACKAGE_NAME, "<" PACKAGE_URL ">") + + "\n" + + strprintf(_("The source code is available from %s.").translated, URL_SOURCE_CODE) + + "\n" + + "\n" + + _("This is experimental software.").translated + "\n" + + strprintf(_("Distributed under the MIT software license, see the accompanying file %s or %s").translated, "COPYING", "<https://opensource.org/licenses/MIT>") + + "\n"; +} |