From c38e892bbcfa870a10203b0688671e8523be81a3 Mon Sep 17 00:00:00 2001
From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Fri, 18 Jun 2021 16:17:35 -0400
Subject: [PATCH] account: add allow ip auto rewrite flag into config

Change-Id: I4c1f1ea7ed35d2645c13d3ca798bffa27d7b5696
---
 src/api/account.h       | 1 +
 src/newaccountmodel.cpp | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/api/account.h b/src/api/account.h
index 59deb661..bc90f21d 100644
--- a/src/api/account.h
+++ b/src/api/account.h
@@ -102,6 +102,7 @@ struct ConfProperties_t
     bool upnpEnabled;
     bool hasCustomUserAgent;
     bool allowIncoming;
+    bool allowIPAutoRewrite;
     QString archivePassword;
     bool archiveHasPassword;
     QString archivePath;
diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp
index 3b1b67ed..781497f2 100644
--- a/src/newaccountmodel.cpp
+++ b/src/newaccountmodel.cpp
@@ -837,6 +837,7 @@ account::Info::fromDetails(const MapStringString& details)
     confProperties.allowIncoming = toBool(details[ConfProperties::ALLOW_CERT_FROM_HISTORY])
                                    | toBool(details[ConfProperties::ALLOW_CERT_FROM_CONTACT])
                                    | toBool(details[ConfProperties::ALLOW_CERT_FROM_TRUSTED]);
+    confProperties.allowIPAutoRewrite = toBool(details[ConfProperties::ACCOUNT_IP_AUTO_REWRITE]);
     confProperties.archivePassword = details[ConfProperties::ARCHIVE_PASSWORD];
     confProperties.archiveHasPassword = toBool(details[ConfProperties::ARCHIVE_HAS_PASSWORD]);
     confProperties.archivePath = details[ConfProperties::ARCHIVE_PATH];
@@ -954,6 +955,7 @@ account::ConfProperties_t::toDetails() const
     details[ConfProperties::ALLOW_CERT_FROM_HISTORY] = toQString(this->allowIncoming);
     details[ConfProperties::ALLOW_CERT_FROM_CONTACT] = toQString(this->allowIncoming);
     details[ConfProperties::ALLOW_CERT_FROM_TRUSTED] = toQString(this->allowIncoming);
+    details[ConfProperties::ACCOUNT_IP_AUTO_REWRITE] = toQString(this->allowIPAutoRewrite);
     details[ConfProperties::ARCHIVE_PASSWORD] = this->archivePassword;
     details[ConfProperties::ARCHIVE_HAS_PASSWORD] = toQString(this->archiveHasPassword);
     details[ConfProperties::ARCHIVE_PATH] = this->archivePath;
-- 
GitLab