From 4f8d7f8d1cfa8b74046fafff6f5ddeebf6cb7cc2 Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Fri, 8 Nov 2013 00:40:21 +0200 Subject: [PATCH] [ssu] Introduce rnd default domain, add workaround for keeping old rnd domains intact on upgrade --- libssu/ssu.cpp | 2 ++ libssu/ssucoreconfig.cpp | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libssu/ssu.cpp b/libssu/ssu.cpp index cd41b07..30f6668 100644 --- a/libssu/ssu.cpp +++ b/libssu/ssu.cpp @@ -312,6 +312,8 @@ void Ssu::sendRegistration(QString usernameDomain, QString password){ } else { // No domain defined username = usernameDomain; + if (settings->contains("default-rnd-domain")) + setDomain(settings->value("default-rnd-domain").toString()); } ssuCaCertificate = SsuRepoManager::caCertificatePath(); diff --git a/libssu/ssucoreconfig.cpp b/libssu/ssucoreconfig.cpp index 99eb879..bf260e9 100644 --- a/libssu/ssucoreconfig.cpp +++ b/libssu/ssucoreconfig.cpp @@ -58,12 +58,23 @@ int SsuCoreConfig::deviceMode(){ } QString SsuCoreConfig::domain(bool pretty){ - if (contains("domain")) + if (contains("domain")){ + // this is a workaround for upgrading existing devices to + // Jolla sales setup. it should be removed in a few weeks + // this should keep devices with old default domain in rnd + // mode using the proper domain + if (contains("default-rnd-domain") && + isRegistered() && + value("domain").toString() == "sales" && + (deviceMode() & Ssu::RndMode) == Ssu::RndMode) + setValue("domain", value("default-rnd-domain")); + // + if (pretty) return value("domain").toString().replace(":", "-"); else return value("domain").toString(); - else + } else return ""; }