From 1bd3edae689f06f4e029e489a0a0f74b9459deea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Wed, 27 Jun 2018 10:32:05 -0400
Subject: [PATCH] account: group incoming call options

Group all options to allow calls from peer into a single option
to avoid confusion for the end user.

Change-Id: I6116c9ad89ce869df2aa41199fc2fdc189db4b89
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
---
 src/api/account.h       |  4 +---
 src/newaccountmodel.cpp | 14 +++++++-------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/api/account.h b/src/api/account.h
index d9170888..bdb32901 100644
--- a/src/api/account.h
+++ b/src/api/account.h
@@ -111,9 +111,7 @@ struct ConfProperties_t {
     std::string             userAgent;
     bool                    upnpEnabled;
     bool                    hasCustomUserAgent;
-    bool                    allowIncomingFromHistory;
-    bool                    allowIncomingFromContact;
-    bool                    allowIncomingFromTrusted;
+    bool                    allowIncoming;
     std::string             archivePassword;
     bool                    archiveHasPassword;
     std::string             archivePath;
diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp
index 78b9c9fb..4e9bb6be 100644
--- a/src/newaccountmodel.cpp
+++ b/src/newaccountmodel.cpp
@@ -1,5 +1,5 @@
 /****************************************************************************
- *   Copyright (C) 2017-2018 Savoir-faire Linux                                  *
+ *   Copyright (C) 2017-2018 Savoir-faire Linux                             *
  *   Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>             *
  *   Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>           *
  *                                                                          *
@@ -501,9 +501,9 @@ account::Info::fromDetails(const MapStringString& details)
     confProperties.userAgent                            = toStdString(details[ConfProperties::USER_AGENT]);
     confProperties.upnpEnabled                          = toBool(details[ConfProperties::UPNP_ENABLED]);
     confProperties.hasCustomUserAgent                   = toBool(details[ConfProperties::HAS_CUSTOM_USER_AGENT]);
-    confProperties.allowIncomingFromHistory             = toBool(details[ConfProperties::ALLOW_CERT_FROM_HISTORY]);
-    confProperties.allowIncomingFromContact             = toBool(details[ConfProperties::ALLOW_CERT_FROM_CONTACT]);
-    confProperties.allowIncomingFromTrusted             = toBool(details[ConfProperties::ALLOW_CERT_FROM_TRUSTED]);
+    confProperties.allowIncoming                        = toBool(details[ConfProperties::ALLOW_CERT_FROM_HISTORY])
+                                                        | toBool(details[ConfProperties::ALLOW_CERT_FROM_CONTACT])
+                                                        | toBool(details[ConfProperties::ALLOW_CERT_FROM_TRUSTED]);
     confProperties.archivePassword                      = toStdString(details[ConfProperties::ARCHIVE_PASSWORD]);
     confProperties.archiveHasPassword                   = toBool(details[ConfProperties::ARCHIVE_HAS_PASSWORD]);
     confProperties.archivePath                          = toStdString(details[ConfProperties::ARCHIVE_PATH]);
@@ -598,9 +598,9 @@ account::ConfProperties_t::toDetails() const
     details[ConfProperties::USER_AGENT]                 = toQString(this->userAgent);
     details[ConfProperties::UPNP_ENABLED]               = toQString(this->upnpEnabled);
     details[ConfProperties::HAS_CUSTOM_USER_AGENT]      = toQString(this->hasCustomUserAgent);
-    details[ConfProperties::ALLOW_CERT_FROM_HISTORY]    = toQString(this->allowIncomingFromHistory);
-    details[ConfProperties::ALLOW_CERT_FROM_CONTACT]    = toQString(this->allowIncomingFromContact);
-    details[ConfProperties::ALLOW_CERT_FROM_TRUSTED]    = toQString(this->allowIncomingFromTrusted);
+    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::ARCHIVE_PASSWORD]           = toQString(this->archivePassword);
     details[ConfProperties::ARCHIVE_HAS_PASSWORD]       = toQString(this->archiveHasPassword);
     details[ConfProperties::ARCHIVE_PATH]               = toQString(this->archivePath);
-- 
GitLab