Skip to content
Snippets Groups Projects
Commit 3b2334fc authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

account: do not overwrite upnpEnabled_ when disabling account

Change-Id: Ia97ba77204f2a40fe57934d71be02a3b2647db67
GitLab: #328
parent fbd1c553
Branches
No related tags found
No related merge requests found
...@@ -109,6 +109,7 @@ Account::Account(const std::string& accountID) ...@@ -109,6 +109,7 @@ Account::Account(const std::string& accountID)
, accountCodecInfoList_() , accountCodecInfoList_()
, ringtonePath_(DEFAULT_RINGTONE_PATH) , ringtonePath_(DEFAULT_RINGTONE_PATH)
, ringtoneEnabled_(true) , ringtoneEnabled_(true)
, upnpEnabled_(true)
, displayName_("") , displayName_("")
, customUserAgent_("") , customUserAgent_("")
, hasCustomUserAgent_(false) , hasCustomUserAgent_(false)
...@@ -235,7 +236,7 @@ Account::serialize(YAML::Emitter& out) const ...@@ -235,7 +236,7 @@ Account::serialize(YAML::Emitter& out) const
out << YAML::Key << USER_AGENT_KEY << YAML::Value << customUserAgent_; out << YAML::Key << USER_AGENT_KEY << YAML::Value << customUserAgent_;
out << YAML::Key << DISPLAY_NAME_KEY << YAML::Value << displayName_; out << YAML::Key << DISPLAY_NAME_KEY << YAML::Value << displayName_;
out << YAML::Key << HOSTNAME_KEY << YAML::Value << hostname_; out << YAML::Key << HOSTNAME_KEY << YAML::Value << hostname_;
out << YAML::Key << UPNP_ENABLED_KEY << YAML::Value << bool(upnp_); out << YAML::Key << UPNP_ENABLED_KEY << YAML::Value << upnpEnabled_;
} }
void void
...@@ -284,9 +285,8 @@ Account::unserialize(const YAML::Node& node) ...@@ -284,9 +285,8 @@ Account::unserialize(const YAML::Node& node)
ringtonePath_ = DEFAULT_RINGTONE_PATH; ringtonePath_ = DEFAULT_RINGTONE_PATH;
} }
bool enabled; parseValue(node, UPNP_ENABLED_KEY, upnpEnabled_);
parseValue(node, UPNP_ENABLED_KEY, enabled); enableUpnp(upnpEnabled_ && isEnabled());
enableUpnp(enabled && isEnabled());
} }
void void
...@@ -310,9 +310,8 @@ Account::setAccountDetails(const std::map<std::string, std::string>& details) ...@@ -310,9 +310,8 @@ Account::setAccountDetails(const std::map<std::string, std::string>& details)
if (hasCustomUserAgent_) if (hasCustomUserAgent_)
parseString(details, Conf::CONFIG_ACCOUNT_USERAGENT, customUserAgent_); parseString(details, Conf::CONFIG_ACCOUNT_USERAGENT, customUserAgent_);
bool enabled; parseBool(details, Conf::CONFIG_UPNP_ENABLED, upnpEnabled_);
parseBool(details, Conf::CONFIG_UPNP_ENABLED, enabled); enableUpnp(upnpEnabled_ && isEnabled());
enableUpnp(enabled && isEnabled());
} }
std::map<std::string, std::string> std::map<std::string, std::string>
...@@ -332,7 +331,7 @@ Account::getAccountDetails() const ...@@ -332,7 +331,7 @@ Account::getAccountDetails() const
{DRing::Account::ConfProperties::ACTIVE_CALL_LIMIT, std::to_string(activeCallLimit_)}, {DRing::Account::ConfProperties::ACTIVE_CALL_LIMIT, std::to_string(activeCallLimit_)},
{Conf::CONFIG_RINGTONE_ENABLED, ringtoneEnabled_ ? TRUE_STR : FALSE_STR}, {Conf::CONFIG_RINGTONE_ENABLED, ringtoneEnabled_ ? TRUE_STR : FALSE_STR},
{Conf::CONFIG_RINGTONE_PATH, ringtonePath_}, {Conf::CONFIG_RINGTONE_PATH, ringtonePath_},
{Conf::CONFIG_UPNP_ENABLED, upnp_ ? TRUE_STR : FALSE_STR}}; {Conf::CONFIG_UPNP_ENABLED, upnpEnabled_ ? TRUE_STR : FALSE_STR}};
} }
std::map<std::string, std::string> std::map<std::string, std::string>
......
...@@ -498,6 +498,7 @@ protected: ...@@ -498,6 +498,7 @@ protected:
/** /**
* UPnP IGD controller and the mutex to access it * UPnP IGD controller and the mutex to access it
*/ */
bool upnpEnabled_;
mutable std::mutex upnp_mtx {}; mutable std::mutex upnp_mtx {};
std::unique_ptr<jami::upnp::Controller> upnp_; std::unique_ptr<jami::upnp::Controller> upnp_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment