diff --git a/.gitignore b/.gitignore index 9245c7ac0f2efee573c9569ea62958ad707e133f..8048d8c5f6236fde5c74369756d4bba9c0014ce7 100644 --- a/.gitignore +++ b/.gitignore @@ -251,3 +251,6 @@ _Pvt_Extensions !config.h Generated\ Files/ + +# Visual Studio generated app install files +.appx \ No newline at end of file diff --git a/Package.appxmanifest b/Package.appxmanifest index 55e756bbf3545c57d74444e01000f496ad0f1373..a20a16c4b69fe367615152bfceb0c07695d96767 100644 --- a/Package.appxmanifest +++ b/Package.appxmanifest @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap uap3 mp"> - <Identity Name="Savoir-faireLinux.GNURing" Publisher="CN=8121A5F7-3CA1-4CAA-92B2-4F595B011941" Version="0.0.1.0" /> + <Identity Name="Savoir-faireLinux.GNURing" Publisher="CN=8121A5F7-3CA1-4CAA-92B2-4F595B011941" Version="1.0.1.0" /> <mp:PhoneIdentity PhoneProductId="2385953f-9019-423d-aa82-d1bbacfa258b" PhonePublisherId="00000000-0000-0000-0000-000000000000" /> <Properties> <DisplayName>GNU Ring</DisplayName> diff --git a/VCardUtils.cpp b/VCardUtils.cpp index 68999c3f95ccf9bb087a2fcd1963db0e1515e56a..fe8521b021eb7b1b1619ccf88bf9923e465a0587 100644 --- a/VCardUtils.cpp +++ b/VCardUtils.cpp @@ -99,45 +99,48 @@ VCard::receiveChunk(const std::string& args, const std::string& payload) return VCARD_INCOMPLETE; } +std::string +getVCardValue(std::string data, std::string key) +{ + std::string value; + std::stringstream _data(data); + std::string _line; + while (std::getline(_data, _line)) { + if (_line.find(key) != std::string::npos) { + value = _line.substr(key.length()); + break; + } + } + value.erase(std::remove(value.begin(), value.end(), '\r'), value.end()); + return value; +} + int VCard::parseFromString() { std::stringstream _data(m_data); std::string _line; - // save hash of old photo - auto md5_0 = Utils::computeMD5(Utils::toPlatformString(m_mParts[Property::PHOTO])); - m_mParts.clear(); - bool foundUID = false; - while (std::getline(_data, _line)) { - if (_line.find("UID:") != std::string::npos) { - foundUID = true; - break; - } - } - if (foundUID) - m_mParts[Property::UID] = _line.substr(4); - else + m_mParts[Property::UID] = getVCardValue(m_data, "UID:"); + if (m_mParts[Property::UID].empty()) m_mParts[Property::UID] = Utils::genID(0LL, 9999999999999LL); + MSG_(m_mParts[Property::UID]); + + m_mParts[Property::FN] = getVCardValue(m_data, "FN:"); + MSG_(m_mParts[Property::FN]); - bool foundFN = false; while (std::getline(_data, _line)) { - if (_line.find("FN:") != std::string::npos) { - foundFN = true; + if (_line.find("PHOTO;") != std::string::npos) break; - } } - if (foundFN) - m_mParts[Property::FN] = _line.substr(3); while (std::getline(_data, _line)) { if (_line.find("PHOTO;") != std::string::npos) break; } - // because android client builds vcard differently (TYPE=PNG: vs PNG:) size_t pos = _line.find("PNG:"); if (pos == std::string::npos) { pos = _line.find("JPEG:"); @@ -147,13 +150,6 @@ VCard::parseFromString() else m_mParts[Property::PHOTO].append(_line.substr(pos + 4)); - // avoid updating an unchanged photo - auto md5_1 = Utils::computeMD5(Utils::toPlatformString(m_mParts[Property::PHOTO])); - if (md5_0 == md5_1) { - MSG_("Duplicate Vcard PHOTO received"); - return 0; - } - return 1; } @@ -323,5 +319,12 @@ VCard::setData(const std::string& data) std::string VCard::getPart(const std::string& part) { - return m_mParts.at(part); + std::string p; + try { + p = m_mParts.at(part); + } + catch (std::exception& e) { + MSG_(e.what()); + } + return p; } \ No newline at end of file diff --git a/_language-fr.appx b/_language-fr.appx deleted file mode 100644 index 4b9c411cadd65e65de2bf0f43a7299b4abeca66f..0000000000000000000000000000000000000000 Binary files a/_language-fr.appx and /dev/null differ diff --git a/_scale-100.appx b/_scale-100.appx deleted file mode 100644 index a1b6872643a84b471783f1e0a8083164f9f8a3f8..0000000000000000000000000000000000000000 Binary files a/_scale-100.appx and /dev/null differ diff --git a/_scale-125.appx b/_scale-125.appx deleted file mode 100644 index dae8a5197feb1e5c6f03a38333d42a4a9fd23ad6..0000000000000000000000000000000000000000 Binary files a/_scale-125.appx and /dev/null differ diff --git a/_scale-150.appx b/_scale-150.appx deleted file mode 100644 index eafedef0938a69e8dd66543bfc54b7d04518800c..0000000000000000000000000000000000000000 Binary files a/_scale-150.appx and /dev/null differ diff --git a/_scale-400.appx b/_scale-400.appx deleted file mode 100644 index 1763977eae3165e5e4d0cacb53ff092facc95b6f..0000000000000000000000000000000000000000 Binary files a/_scale-400.appx and /dev/null differ