2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

version 0.8.19 with fixed stickerpacks and voice messages changelog

This commit is contained in:
John Preston
2015-06-01 23:24:09 +03:00
parent 67e6d12384
commit 635cae4f94
13 changed files with 29 additions and 45 deletions

View File

@@ -2266,7 +2266,7 @@ namespace Local {
}
}
EncryptedDescriptor data(size);
data.stream << quint32(cStickerSetsOrder().size()) << cStickersHash();
data.stream << quint32(cStickerSets().size()) << cStickersHash();
_writeStickerSet(data.stream, DefaultStickerSetId);
_writeStickerSet(data.stream, CustomStickerSetId);
for (StickerSetsOrder::const_iterator i = cStickerSetsOrder().cbegin(), e = cStickerSetsOrder().cend(); i != e; ++i) {
@@ -2278,19 +2278,15 @@ namespace Local {
}
void importOldRecentStickers() {
LOG(("Stickers: importOldStickers()"));
if (!_recentStickersKeyOld) return;
FileReadDescriptor stickers;
if (!readEncryptedFile(stickers, _recentStickersKeyOld)) {
LOG(("Stickers: could not readEncryptedFile(_recentStickersKeyOld)!"));
clearKey(_recentStickersKeyOld);
_recentStickersKeyOld = 0;
_writeMap();
return;
}
LOG(("Stickers: clearing everything in import-old!"));
StickerSets &sets(cRefStickerSets());
sets.clear();
@@ -2338,7 +2334,6 @@ namespace Local {
}
if (recent.size() < StickerPanPerRow * StickerPanRowsPerPage && qAbs(value) > 1) recent.push_back(qMakePair(doc, qAbs(value)));
}
LOG(("Stickers: read %1 default stickers and %2 custom stickers").arg(def.stickers.size()).arg(custom.stickers.size()));
if (def.stickers.isEmpty()) sets.remove(DefaultStickerSetId);
if (custom.stickers.isEmpty()) sets.remove(CustomStickerSetId);
@@ -2348,25 +2343,21 @@ namespace Local {
clearKey(_recentStickersKeyOld);
_recentStickersKeyOld = 0;
_writeMap();
LOG(("Stickers: writing stickers and clearing old-stickers"));
}
void readStickers() {
LOG(("Stickers: readStickers()"));
if (!_stickersKey) {
return importOldRecentStickers();
}
FileReadDescriptor stickers;
if (!readEncryptedFile(stickers, _stickersKey)) {
LOG(("Stickers: could not readEncryptedFile(_stickersKey)!"));
clearKey(_stickersKey);
_stickersKey = 0;
_writeMap();
return;
}
LOG(("Stickers: clearing everything in read"));
StickerSets &sets(cRefStickerSets());
sets.clear();
@@ -2376,6 +2367,10 @@ namespace Local {
quint32 cnt;
QByteArray hash;
stickers.stream >> cnt >> hash;
if (stickers.version < 8019) {
hash.clear(); // bad data in old caches
cnt += 2; // try to read at least something
}
for (uint32 i = 0; i < cnt; ++i) {
quint64 setId = 0, setAccess = 0;
QString setTitle, setShortName;
@@ -2386,8 +2381,10 @@ namespace Local {
setTitle = lang(lng_stickers_default_set);
} else if (setId == CustomStickerSetId) {
setTitle = lang(lng_custom_stickers);
} else {
} else if (setId) {
order.push_back(setId);
} else {
continue;
}
StickerSet &set(sets.insert(setId, StickerSet(setId, setAccess, setTitle, setShortName)).value());
set.stickers.reserve(scnt);
@@ -2441,8 +2438,6 @@ namespace Local {
}
cSetStickersHash(hash);
LOG(("Stickers: read %1 sets").arg(sets.size()));
}
void writeBackground(int32 id, const QImage &img) {