| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #include "DownloadableSubscription.h" | 18 #include "DownloadableSubscription.h" |
| 19 | 19 |
| 20 DownloadableSubscription::DownloadableSubscription(const String& id) | 20 DownloadableSubscription::DownloadableSubscription(const String& id, const KeyVa lues& properties) |
| 21 : Subscription(Type::DOWNLOADABLE, id), mFixedTitle(false), mLastCheck(0), | 21 : Subscription(Type::DOWNLOADABLE, id, properties), mFixedTitle(false), mLas tCheck(0), |
| 22 mHardExpiration(0), mSoftExpiration(0), mLastDownload(0), mLastSuccess(0), | 22 mHardExpiration(0), mSoftExpiration(0), mLastDownload(0), mLastSuccess(0), |
| 23 mErrorCount(0), mDataRevision(0), mDownloadCount(0) | 23 mErrorCount(0), mDataRevision(0), mDownloadCount(0) |
| 24 { | 24 { |
| 25 SetTitle(id); | 25 const auto* titleProp = findPropertyValue(properties, u"title"_str); |
|
sergei
2017/09/18 19:20:07
Why is the title set to ID only for downloadable s
Wladimir Palant
2017/12/21 10:30:38
The ID is only meaningful for downloadable subscri
| |
| 26 SetTitle(titleProp ? *titleProp : id); | |
| 27 parseProperty(properties, mFixedTitle, u"fixedTitle"_str); | |
| 28 parseProperty(properties, mHomepage, u"homepage"_str); | |
| 29 parseProperty(properties, mLastCheck, u"lastCheck"_str); | |
| 30 parseProperty(properties, mHardExpiration, u"expires"_str); | |
| 31 parseProperty(properties, mSoftExpiration, u"softExpiration"_str); | |
| 32 parseProperty(properties, mLastDownload, u"lastDownload"_str); | |
| 33 parseProperty(properties, mDownloadStatus, u"downloadStatus"_str); | |
| 34 parseProperty(properties, mLastSuccess, u"lastSuccess"_str); | |
| 35 parseProperty(properties, mErrorCount, u"errors"_str); | |
| 36 parseProperty(properties, mDataRevision, u"version"_str); | |
| 37 parseProperty(properties, mRequiredVersion, u"requiredVersion"_str); | |
| 38 parseProperty(properties, mDownloadCount, u"downloadCount"_str); | |
| 26 } | 39 } |
| 27 | 40 |
| 28 OwnedString DownloadableSubscription::Serialize() const | 41 OwnedString DownloadableSubscription::SerializeProperties() const |
| 29 { | 42 { |
| 30 OwnedString result(Subscription::Serialize()); | 43 OwnedString result(Subscription::DoSerializeProperties()); |
| 31 if (mFixedTitle) | 44 if (mFixedTitle) |
| 32 result.append(u"fixedTitle=true\n"_str); | 45 result.append(u"fixedTitle=true\n"_str); |
| 33 if (!mHomepage.empty()) | 46 if (!mHomepage.empty()) |
| 34 { | 47 { |
| 35 result.append(u"homepage="_str); | 48 result.append(u"homepage="_str); |
| 36 result.append(mHomepage); | 49 result.append(mHomepage); |
| 37 result.append(u'\n'); | 50 result.append(u'\n'); |
| 38 } | 51 } |
| 39 if (mLastCheck) | 52 if (mLastCheck) |
| 40 { | 53 { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 result.append(u'\n'); | 104 result.append(u'\n'); |
| 92 } | 105 } |
| 93 if (mDownloadCount) | 106 if (mDownloadCount) |
| 94 { | 107 { |
| 95 result.append(u"downloadCount="_str); | 108 result.append(u"downloadCount="_str); |
| 96 result.append(mDownloadCount); | 109 result.append(mDownloadCount); |
| 97 result.append(u'\n'); | 110 result.append(u'\n'); |
| 98 } | 111 } |
| 99 return result; | 112 return result; |
| 100 } | 113 } |
| OLD | NEW |