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:
@@ -4594,27 +4594,41 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
if (d.vstickerset.type() == mtpc_messages_stickerSet) {
|
||||
const MTPDmessages_stickerSet &set(d.vstickerset.c_messages_stickerSet());
|
||||
if (set.vset.type() == mtpc_stickerSet) {
|
||||
const QVector<MTPDocument> &v(set.vdocuments.c_vector().v);
|
||||
StickerPack pack;
|
||||
pack.reserve(v.size());
|
||||
for (int32 i = 0, l = v.size(); i < l; ++i) {
|
||||
DocumentData *doc = App::feedDocument(v.at(i));
|
||||
if (!doc || !doc->sticker()) continue;
|
||||
|
||||
pack.push_back(doc);
|
||||
}
|
||||
|
||||
const MTPDstickerSet &s(set.vset.c_stickerSet());
|
||||
|
||||
StickerSets &sets(cRefStickerSets());
|
||||
StickerSets::iterator it = sets.find(s.vid.v);
|
||||
if (it != sets.cend()) {
|
||||
Global::StickersByEmoji_RemovePack(it->stickers);
|
||||
} else {
|
||||
if (it == sets.cend()) {
|
||||
it = sets.insert(s.vid.v, StickerSet(s.vid.v, s.vaccess_hash.v, stickerSetTitle(s), qs(s.vshort_name), s.vcount.v, s.vhash.v, s.vflags.v));
|
||||
}
|
||||
it->stickers = pack;
|
||||
Global::StickersByEmoji_AddPack(pack);
|
||||
|
||||
const QVector<MTPDocument> &v(set.vdocuments.c_vector().v);
|
||||
it->stickers.clear();
|
||||
it->stickers.reserve(v.size());
|
||||
for (int32 i = 0, l = v.size(); i < l; ++i) {
|
||||
DocumentData *doc = App::feedDocument(v.at(i));
|
||||
if (!doc || !doc->sticker()) continue;
|
||||
|
||||
it->stickers.push_back(doc);
|
||||
}
|
||||
it->emoji.clear();
|
||||
const QVector<MTPStickerPack> &packs(set.vpacks.c_vector().v);
|
||||
for (int32 i = 0, l = packs.size(); i < l; ++i) {
|
||||
if (packs.at(i).type() != mtpc_stickerPack) continue;
|
||||
const MTPDstickerPack &pack(packs.at(i).c_stickerPack());
|
||||
if (EmojiPtr e = emojiGetNoColor(emojiFromText(qs(pack.vemoticon)))) {
|
||||
const QVector<MTPlong> &stickers(pack.vdocuments.c_vector().v);
|
||||
StickerPack p;
|
||||
p.reserve(stickers.size());
|
||||
for (int32 j = 0, c = stickers.size(); j < c; ++j) {
|
||||
DocumentData *doc = App::document(stickers.at(j).v);
|
||||
if (!doc || !doc->sticker()) continue;
|
||||
|
||||
p.push_back(doc);
|
||||
}
|
||||
it->emoji.insert(e, p);
|
||||
}
|
||||
}
|
||||
|
||||
StickerSetsOrder &order(cRefStickerSetsOrder());
|
||||
int32 insertAtIndex = 0, currentIndex = order.indexOf(s.vid.v);
|
||||
@@ -4627,8 +4641,8 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
|
||||
StickerSets::iterator custom = sets.find(CustomStickerSetId);
|
||||
if (custom != sets.cend()) {
|
||||
for (int32 i = 0, l = pack.size(); i < l; ++i) {
|
||||
int32 removeIndex = custom->stickers.indexOf(pack.at(i));
|
||||
for (int32 i = 0, l = it->stickers.size(); i < l; ++i) {
|
||||
int32 removeIndex = custom->stickers.indexOf(it->stickers.at(i));
|
||||
if (removeIndex >= 0) custom->stickers.removeAt(removeIndex);
|
||||
}
|
||||
if (custom->stickers.isEmpty()) {
|
||||
|
Reference in New Issue
Block a user