2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 15:15:13 +00:00

dev version 0.9.19 sending stickers by emoji

This commit is contained in:
John Preston
2016-01-09 20:51:42 +08:00
parent a72a31e722
commit b13579c7d9
19 changed files with 184 additions and 143 deletions

View File

@@ -2843,6 +2843,16 @@ namespace Local {
}
_writeStorageImageLocation(stream, doc->sticker()->loc);
}
if (AppVersion > 9018) {
stream << qint32(it->emoji.size());
for (StickersByEmojiMap::const_iterator j = it->emoji.cbegin(), e = it->emoji.cend(); j != e; ++j) {
stream << emojiString(j.key()) << qint32(j->size());
for (int32 k = 0, l = j->size(); k < l; ++k) {
stream << quint64(j->at(k)->id);
}
}
}
}
void writeStickers() {
@@ -2881,6 +2891,14 @@ namespace Local {
// loc
size += _storageImageLocationSize();
}
if (AppVersion > 9018) {
size += sizeof(qint32); // emojiCount
for (StickersByEmojiMap::const_iterator j = i->emoji.cbegin(), e = i->emoji.cend(); j != e; ++j) {
size += _stringSize(emojiString(j.key())) + sizeof(qint32) + (j->size() * sizeof(quint64));
}
}
++setsCount;
}
@@ -2920,8 +2938,6 @@ namespace Local {
RecentStickerPack &recent(cRefRecentStickers());
recent.clear();
Global::SetStickersByEmoji(StickersByEmojiMap());
StickerSet &def(sets.insert(DefaultStickerSetId, StickerSet(DefaultStickerSetId, 0, lang(lng_stickers_default_set), QString(), 0, 0, MTPDstickerSet::flag_official)).value());
StickerSet &custom(sets.insert(CustomStickerSetId, StickerSet(CustomStickerSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, 0)).value());
@@ -2995,8 +3011,6 @@ namespace Local {
StickerSetsOrder &order(cRefStickerSetsOrder());
order.clear();
Global::SetStickersByEmoji(StickersByEmojiMap());
quint32 cnt;
QByteArray hash;
stickers.stream >> cnt >> hash; // ignore hash, it is counted
@@ -3078,8 +3092,27 @@ namespace Local {
++set.count;
}
if (setId != CustomStickerSetId) {
Global::StickersByEmoji_AddPack(set.stickers);
if (stickers.version > 9018) {
qint32 emojiCount;
stickers.stream >> emojiCount;
for (int32 j = 0; j < emojiCount; ++j) {
QString emojiString;
qint32 stickersCount;
stickers.stream >> emojiString >> stickersCount;
StickerPack pack;
pack.reserve(stickersCount);
for (int32 k = 0; k < stickersCount; ++k) {
quint64 id;
stickers.stream >> id;
DocumentData *doc = App::document(id);
if (!doc || !doc->sticker()) continue;
pack.push_back(doc);
}
if (EmojiPtr e = emojiGetNoColor(emojiFromText(emojiString))) {
set.emoji.insert(e, pack);
}
}
}
}
}