mirror of https://github.com/procxx/kepka.git
dev version 0.9.19 sending stickers by emoji
This commit is contained in:
parent
a72a31e722
commit
b13579c7d9
|
@ -672,9 +672,9 @@ void ApiWrap::scheduleStickerSetRequest(uint64 setId, uint64 access) {
|
|||
|
||||
void ApiWrap::requestStickerSets() {
|
||||
for (QMap<uint64, QPair<uint64, mtpRequestId> >::iterator i = _stickerSetRequests.begin(), j = i, e = _stickerSetRequests.end(); i != e; i = j) {
|
||||
++j;
|
||||
if (i.value().second) continue;
|
||||
|
||||
++j;
|
||||
int32 wait = (j == e) ? 0 : 10;
|
||||
i.value().second = MTP::send(MTPmessages_GetStickerSet(MTP_inputStickerSetID(MTP_long(i.key()), MTP_long(i.value().first))), rpcDone(&ApiWrap::gotStickerSet, i.key()), rpcFail(&ApiWrap::gotStickerSetFail, i.key()), 0, wait);
|
||||
}
|
||||
|
@ -685,7 +685,6 @@ void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result)
|
|||
|
||||
if (result.type() != mtpc_messages_stickerSet) return;
|
||||
const MTPDmessages_stickerSet &d(result.c_messages_stickerSet());
|
||||
const QVector<MTPStickerPack> &v(d.vpacks.c_vector().v);
|
||||
|
||||
if (d.vset.type() != mtpc_stickerSet) return;
|
||||
const MTPDstickerSet &s(d.vset.c_stickerSet());
|
||||
|
@ -733,14 +732,31 @@ void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result)
|
|||
}
|
||||
}
|
||||
|
||||
Global::StickersByEmoji_RemovePack(it->stickers);
|
||||
if (pack.isEmpty()) {
|
||||
int32 removeIndex = cStickerSetsOrder().indexOf(setId);
|
||||
if (removeIndex >= 0) cRefStickerSetsOrder().removeAt(removeIndex);
|
||||
sets.erase(it);
|
||||
} else {
|
||||
it->stickers = pack;
|
||||
Global::StickersByEmoji_AddPack(it->stickers);
|
||||
it->emoji.clear();
|
||||
const QVector<MTPStickerPack> &v(d.vpacks.c_vector().v);
|
||||
for (int32 i = 0, l = v.size(); i < l; ++i) {
|
||||
if (v.at(i).type() != mtpc_stickerPack) continue;
|
||||
|
||||
const MTPDstickerPack &pack(v.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (writeRecent) {
|
||||
|
|
|
@ -1969,7 +1969,6 @@ namespace App {
|
|||
if (api()) api()->clearWebPageRequests();
|
||||
cSetRecentStickers(RecentStickerPack());
|
||||
cSetStickerSets(StickerSets());
|
||||
Global::SetStickersByEmoji(StickersByEmojiMap());
|
||||
cSetStickerSetsOrder(StickerSetsOrder());
|
||||
cSetLastStickersUpdate(0);
|
||||
cSetSavedGifs(SavedGifs());
|
||||
|
|
|
@ -705,9 +705,8 @@ void Application::checkMapVersion() {
|
|||
if (Local::oldMapVersion() < AppVersion) {
|
||||
if (Local::oldMapVersion()) {
|
||||
QString versionFeatures;
|
||||
if (cDevVersion() && Local::oldMapVersion() < 9016) {
|
||||
// versionFeatures = QString::fromUtf8("\xe2\x80\x94 Sticker management: manually rearrange your sticker packs, pack order is now synced across all your devices\n\xe2\x80\x94 Click and hold on a sticker to preview it before sending\n\xe2\x80\x94 New context menu for chats in chats list\n\xe2\x80\x94 Support for all existing emoji");// .replace('@', qsl("@") + QChar(0x200D));
|
||||
versionFeatures = lng_new_version_text(lt_gifs_link, qsl("https://telegram.org/blog/gif-revolution"), lt_bots_link, qsl("https://telegram.org/blog/inline-bots")).trimmed();
|
||||
if (cDevVersion() && Local::oldMapVersion() < 9019) {
|
||||
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Choose an emoticon and see the suggested stickers\n\xe2\x80\x94 Bug fixes in minor improvements");// .replace('@', qsl("@") + QChar(0x200D));
|
||||
} else if (Local::oldMapVersion() < 9016) {
|
||||
versionFeatures = lng_new_version_text(lt_gifs_link, qsl("https://telegram.org/blog/gif-revolution"), lt_bots_link, qsl("https://telegram.org/blog/inline-bots")).trimmed();
|
||||
} else {
|
||||
|
|
|
@ -43,6 +43,7 @@ _input(set), _installRequest(0) {
|
|||
|
||||
void StickerSetInner::gotSet(const MTPmessages_StickerSet &set) {
|
||||
_pack.clear();
|
||||
_emoji.clear();
|
||||
if (set.type() == mtpc_messages_stickerSet) {
|
||||
const MTPDmessages_stickerSet &d(set.c_messages_stickerSet());
|
||||
const QVector<MTPDocument> &v(d.vdocuments.c_vector().v);
|
||||
|
@ -53,6 +54,23 @@ void StickerSetInner::gotSet(const MTPmessages_StickerSet &set) {
|
|||
|
||||
_pack.push_back(doc);
|
||||
}
|
||||
const QVector<MTPStickerPack> &packs(d.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);
|
||||
}
|
||||
_emoji.insert(e, p);
|
||||
}
|
||||
}
|
||||
if (d.vset.type() == mtpc_stickerSet) {
|
||||
const MTPDstickerSet &s(d.vset.c_stickerSet());
|
||||
_setTitle = stickerSetTitle(s);
|
||||
|
@ -91,8 +109,12 @@ void StickerSetInner::installDone(const MTPBool &result) {
|
|||
StickerSets &sets(cRefStickerSets());
|
||||
|
||||
_setFlags &= ~MTPDstickerSet::flag_disabled;
|
||||
sets.insert(_setId, StickerSet(_setId, _setAccess, _setTitle, _setShortName, _setCount, _setHash, _setFlags)).value().stickers = _pack;
|
||||
Global::StickersByEmoji_AddPack(_pack);
|
||||
StickerSets::iterator it = sets.find(_setId);
|
||||
if (it == sets.cend()) {
|
||||
it = sets.insert(_setId, StickerSet(_setId, _setAccess, _setTitle, _setShortName, _setCount, _setHash, _setFlags));
|
||||
}
|
||||
it.value().stickers = _pack;
|
||||
it.value().emoji = _emoji;
|
||||
|
||||
StickerSetsOrder &order(cRefStickerSetsOrder());
|
||||
int32 insertAtIndex = 0, currentIndex = order.indexOf(_setId);
|
||||
|
@ -868,7 +890,6 @@ void StickersBox::onSave() {
|
|||
if (removeIndex >= 0) cRefStickerSetsOrder().removeAt(removeIndex);
|
||||
sets.erase(it);
|
||||
}
|
||||
Global::StickersByEmoji_RemovePack(it->stickers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -881,7 +902,6 @@ void StickersBox::onSave() {
|
|||
MTPInputStickerSet setId = (it->id && it->access) ? MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)) : MTP_inputStickerSetShortName(MTP_string(it->shortName));
|
||||
_disenableRequests.insert(MTP::send(MTPmessages_InstallStickerSet(setId, MTP_boolFalse()), rpcDone(&StickersBox::disenableDone), rpcFail(&StickersBox::disenableFail), 0, 5), NullType());
|
||||
it->flags &= ~MTPDstickerSet::flag_disabled;
|
||||
Global::StickersByEmoji_AddPack(it->stickers);
|
||||
}
|
||||
order.push_back(reorder.at(i));
|
||||
}
|
||||
|
@ -890,7 +910,6 @@ void StickersBox::onSave() {
|
|||
if (it->id == CustomStickerSetId || it->id == RecentStickerSetId || order.contains(it->id)) {
|
||||
++it;
|
||||
} else {
|
||||
Global::StickersByEmoji_RemovePack(it->stickers);
|
||||
it = sets.erase(it);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
void init();
|
||||
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
||||
|
||||
bool loaded() const;
|
||||
int32 notInstalled() const;
|
||||
bool official() const;
|
||||
|
@ -60,6 +60,7 @@ private:
|
|||
bool installFailed(const RPCError &error);
|
||||
|
||||
StickerPack _pack;
|
||||
StickersByEmojiMap _emoji;
|
||||
bool _loaded;
|
||||
uint64 _setId, _setAccess;
|
||||
QString _title, _setTitle, _setShortName;
|
||||
|
@ -118,7 +119,7 @@ public:
|
|||
void mousePressEvent(QMouseEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
|
||||
|
||||
void rebuild();
|
||||
bool savingStart() {
|
||||
if (_saving) return false;
|
||||
|
@ -201,7 +202,7 @@ public:
|
|||
StickersBox();
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
||||
|
||||
void closePressed();
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -20,9 +20,9 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
static const int32 AppVersion = 9018;
|
||||
static const wchar_t *AppVersionStr = L"0.9.18";
|
||||
static const bool DevVersion = false;
|
||||
static const int32 AppVersion = 9019;
|
||||
static const wchar_t *AppVersionStr = L"0.9.19";
|
||||
static const bool DevVersion = true;
|
||||
//#define BETA_VERSION (9015008ULL) // just comment this line to build public version
|
||||
|
||||
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
|
||||
|
|
|
@ -3564,7 +3564,6 @@ void EmojiPan::onRemoveSetSure() {
|
|||
Ui::hideLayer();
|
||||
StickerSets::iterator it = cRefStickerSets().find(_removingSetId);
|
||||
if (it != cRefStickerSets().cend() && !(it->flags & MTPDstickerSet::flag_official)) {
|
||||
Global::StickersByEmoji_RemovePack(it->stickers);
|
||||
if (it->id && it->access) {
|
||||
MTP::send(MTPmessages_UninstallStickerSet(MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access))));
|
||||
} else if (!it->shortName.isEmpty()) {
|
||||
|
@ -3842,7 +3841,7 @@ void EmojiPan::recountContentMaxHeight() {
|
|||
updateContentHeight();
|
||||
}
|
||||
|
||||
MentionsInner::MentionsInner(MentionsDropdown *parent, MentionRows *mrows, HashtagRows *hrows, BotCommandRows *brows, StickerByEmojiRows *srows)
|
||||
MentionsInner::MentionsInner(MentionsDropdown *parent, MentionRows *mrows, HashtagRows *hrows, BotCommandRows *brows, StickerPack *srows)
|
||||
: _parent(parent)
|
||||
, _mrows(mrows)
|
||||
, _hrows(hrows)
|
||||
|
@ -4290,7 +4289,7 @@ void MentionsDropdown::showStickers(EmojiPtr emoji) {
|
|||
bool resetScroll = (_emoji != emoji);
|
||||
_emoji = emoji;
|
||||
if (!emoji) {
|
||||
rowsUpdated(_mrows, _hrows, _brows, StickerByEmojiRows(), false);
|
||||
rowsUpdated(_mrows, _hrows, _brows, StickerPack(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4312,16 +4311,31 @@ void MentionsDropdown::updateFiltered(bool resetScroll) {
|
|||
MentionRows mrows;
|
||||
HashtagRows hrows;
|
||||
BotCommandRows brows;
|
||||
StickerByEmojiRows srows;
|
||||
StickerPack srows;
|
||||
if (_emoji) {
|
||||
const StickersByEmojiMap &stickers(Global::StickersByEmoji());
|
||||
StickersByEmojiMap::const_iterator it = stickers.constFind(emojiGetNoColor(_emoji));
|
||||
if (it != stickers.cend() && !it->isEmpty()) {
|
||||
srows.reserve(it->size());
|
||||
for (StickersByEmojiList::const_iterator i = it->cbegin(), e = it->cend(); i != e; ++i) {
|
||||
srows.push_back(i.key());
|
||||
QMap<uint64, uint64> setsToRequest;
|
||||
StickerSets &sets(cRefStickerSets());
|
||||
const StickerSetsOrder &order(cStickerSetsOrder());
|
||||
for (int32 i = 0, l = order.size(); i < l; ++i) {
|
||||
StickerSets::iterator it = sets.find(order.at(i));
|
||||
if (it != sets.cend()) {
|
||||
if (it->emoji.isEmpty()) {
|
||||
setsToRequest.insert(it->id, it->access);
|
||||
it->flags |= MTPDstickerSet_flag_NOT_LOADED;
|
||||
} else {
|
||||
StickersByEmojiMap::const_iterator i = it->emoji.constFind(emojiGetNoColor(_emoji));
|
||||
if (i != it->emoji.cend()) {
|
||||
srows.append(*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!setsToRequest.isEmpty() && App::api()) {
|
||||
for (QMap<uint64, uint64>::const_iterator i = setsToRequest.cbegin(), e = setsToRequest.cend(); i != e; ++i) {
|
||||
App::api()->scheduleStickerSetRequest(i.key(), i.value());
|
||||
}
|
||||
App::api()->requestStickerSets();
|
||||
}
|
||||
} else if (_filter.at(0) == '@') {
|
||||
if (_chat) {
|
||||
mrows.reserve((_addInlineBots ? cRecentInlineBots().size() : 0) + (_chat->participants.isEmpty() ? _chat->lastAuthors.size() : _chat->participants.size()));
|
||||
|
@ -4464,7 +4478,7 @@ void MentionsDropdown::updateFiltered(bool resetScroll) {
|
|||
_inner.setRecentInlineBotsInRows(recentInlineBots);
|
||||
}
|
||||
|
||||
void MentionsDropdown::rowsUpdated(const MentionRows &mrows, const HashtagRows &hrows, const BotCommandRows &brows, const StickerByEmojiRows &srows, bool resetScroll) {
|
||||
void MentionsDropdown::rowsUpdated(const MentionRows &mrows, const HashtagRows &hrows, const BotCommandRows &brows, const StickerPack &srows, bool resetScroll) {
|
||||
if (mrows.isEmpty() && hrows.isEmpty() && brows.isEmpty() && srows.isEmpty()) {
|
||||
if (!isHidden()) {
|
||||
hideStart();
|
||||
|
|
|
@ -727,7 +727,6 @@ private:
|
|||
typedef QList<UserData*> MentionRows;
|
||||
typedef QList<QString> HashtagRows;
|
||||
typedef QList<QPair<UserData*, const BotCommand*> > BotCommandRows;
|
||||
typedef QList<DocumentData*> StickerByEmojiRows;
|
||||
|
||||
class MentionsDropdown;
|
||||
class MentionsInner : public TWidget {
|
||||
|
@ -735,7 +734,7 @@ class MentionsInner : public TWidget {
|
|||
|
||||
public:
|
||||
|
||||
MentionsInner(MentionsDropdown *parent, MentionRows *mrows, HashtagRows *hrows, BotCommandRows *brows, StickerByEmojiRows *srows);
|
||||
MentionsInner(MentionsDropdown *parent, MentionRows *mrows, HashtagRows *hrows, BotCommandRows *brows, StickerPack *srows);
|
||||
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
@ -774,7 +773,7 @@ private:
|
|||
MentionRows *_mrows;
|
||||
HashtagRows *_hrows;
|
||||
BotCommandRows *_brows;
|
||||
StickerByEmojiRows *_srows;
|
||||
StickerPack *_srows;
|
||||
int32 _stickersPerRow, _recentInlineBotsInRows;
|
||||
int32 _sel;
|
||||
bool _mouseSel;
|
||||
|
@ -845,9 +844,9 @@ private:
|
|||
MentionRows _mrows;
|
||||
HashtagRows _hrows;
|
||||
BotCommandRows _brows;
|
||||
StickerByEmojiRows _srows;
|
||||
StickerPack _srows;
|
||||
|
||||
void rowsUpdated(const MentionRows &mrows, const HashtagRows &hrows, const BotCommandRows &brows, const StickerByEmojiRows &srows, bool resetScroll);
|
||||
void rowsUpdated(const MentionRows &mrows, const HashtagRows &hrows, const BotCommandRows &brows, const StickerPack &srows, bool resetScroll);
|
||||
|
||||
ScrollArea _scroll;
|
||||
MentionsInner _inner;
|
||||
|
|
|
@ -179,8 +179,6 @@ namespace Global {
|
|||
|
||||
struct Data {
|
||||
uint64 LaunchId;
|
||||
|
||||
StickersByEmojiMap StickersByEmoji;
|
||||
};
|
||||
|
||||
Data *_data = 0;
|
||||
|
@ -188,6 +186,7 @@ namespace Global {
|
|||
Initializer::Initializer() {
|
||||
initThirdParty();
|
||||
_data = new Data();
|
||||
|
||||
memset_rand(&_data->LaunchId, sizeof(_data->LaunchId));
|
||||
}
|
||||
|
||||
|
@ -211,46 +210,4 @@ Type &Ref##Name() { \
|
|||
|
||||
DefineGlobalReadOnly(uint64, LaunchId);
|
||||
|
||||
DefineGlobal(StickersByEmojiMap, StickersByEmoji);
|
||||
|
||||
void StickersByEmoji_Add(DocumentData *doc) {
|
||||
if (StickerData *sticker = doc->sticker()) {
|
||||
if (EmojiPtr emoji = emojiGetNoColor(emojiFromText(sticker->alt))) {
|
||||
RefStickersByEmoji()[emoji].insert(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool StickersByEmoji_Remove(DocumentData *doc) {
|
||||
if (StickerData *sticker = doc->sticker()) {
|
||||
if (EmojiPtr emoji = emojiGetNoColor(emojiFromText(sticker->alt))) {
|
||||
StickersByEmojiMap stickers(RefStickersByEmoji());
|
||||
StickersByEmojiMap::iterator iList = stickers.find(emoji);
|
||||
if (iList != stickers.cend()) {
|
||||
StickersByEmojiList::iterator iEntry = iList->find(doc);
|
||||
if (iEntry != iList->cend()) {
|
||||
iList->erase(iEntry);
|
||||
if (iList->isEmpty()) {
|
||||
stickers.erase(iList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void StickersByEmoji_AddPack(const StickerPack &pack) {
|
||||
for (StickerPack::const_iterator i = pack.cbegin(), e = pack.cend(); i != e; ++i) {
|
||||
StickersByEmoji_Add(*i);
|
||||
}
|
||||
}
|
||||
|
||||
void StickersByEmoji_RemovePack(const StickerPack &pack) {
|
||||
for (StickerPack::const_iterator i = pack.cbegin(), e = pack.cend(); i != e; ++i) {
|
||||
StickersByEmoji_Remove(*i);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -96,9 +96,6 @@ namespace Notify {
|
|||
|
||||
};
|
||||
|
||||
typedef OrderedSet<DocumentData*> StickersByEmojiList;
|
||||
typedef QMap<EmojiPtr, StickersByEmojiList> StickersByEmojiMap;
|
||||
|
||||
namespace Global {
|
||||
|
||||
class Initializer {
|
||||
|
@ -114,10 +111,4 @@ namespace Global {
|
|||
|
||||
DeclareGlobalReadOnly(uint64, LaunchId);
|
||||
|
||||
DeclareGlobal(StickersByEmojiMap, StickersByEmoji);
|
||||
void StickersByEmoji_Add(DocumentData *doc);
|
||||
bool StickersByEmoji_Remove(DocumentData *doc);
|
||||
void StickersByEmoji_AddPack(const StickerPack &pack);
|
||||
void StickersByEmoji_RemovePack(const StickerPack &pack);
|
||||
|
||||
};
|
||||
|
|
|
@ -3164,24 +3164,24 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) {
|
|||
for (int32 i = 0, l = d_sets.size(); i != l; ++i) {
|
||||
if (d_sets.at(i).type() == mtpc_stickerSet) {
|
||||
const MTPDstickerSet &set(d_sets.at(i).c_stickerSet());
|
||||
StickerSets::iterator i = sets.find(set.vid.v);
|
||||
StickerSets::iterator it = sets.find(set.vid.v);
|
||||
QString title = stickerSetTitle(set);
|
||||
if (i == sets.cend()) {
|
||||
i = sets.insert(set.vid.v, StickerSet(set.vid.v, set.vaccess_hash.v, title, qs(set.vshort_name), set.vcount.v, set.vhash.v, set.vflags.v | MTPDstickerSet_flag_NOT_LOADED));
|
||||
if (it == sets.cend()) {
|
||||
it = sets.insert(set.vid.v, StickerSet(set.vid.v, set.vaccess_hash.v, title, qs(set.vshort_name), set.vcount.v, set.vhash.v, set.vflags.v | MTPDstickerSet_flag_NOT_LOADED));
|
||||
} else {
|
||||
i->access = set.vaccess_hash.v;
|
||||
i->title = title;
|
||||
i->shortName = qs(set.vshort_name);
|
||||
i->flags = set.vflags.v;
|
||||
if (i->count != set.vcount.v || i->hash != set.vhash.v) {
|
||||
i->count = set.vcount.v;
|
||||
i->hash = set.vhash.v;
|
||||
i->flags |= MTPDstickerSet_flag_NOT_LOADED; // need to request this set
|
||||
it->access = set.vaccess_hash.v;
|
||||
it->title = title;
|
||||
it->shortName = qs(set.vshort_name);
|
||||
it->flags = set.vflags.v;
|
||||
if (it->count != set.vcount.v || it->hash != set.vhash.v || it->emoji.isEmpty()) {
|
||||
it->count = set.vcount.v;
|
||||
it->hash = set.vhash.v;
|
||||
it->flags |= MTPDstickerSet_flag_NOT_LOADED; // need to request this set
|
||||
}
|
||||
}
|
||||
if (!(i->flags & MTPDstickerSet::flag_disabled) || (i->flags & MTPDstickerSet::flag_official)) {
|
||||
if (!(it->flags & MTPDstickerSet::flag_disabled) || (it->flags & MTPDstickerSet::flag_official)) {
|
||||
setsOrder.push_back(set.vid.v);
|
||||
if (i->stickers.isEmpty() || (i->flags & MTPDstickerSet_flag_NOT_LOADED)) {
|
||||
if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_flag_NOT_LOADED)) {
|
||||
setsToRequest.insert(set.vid.v, set.vaccess_hash.v);
|
||||
}
|
||||
}
|
||||
|
@ -3201,7 +3201,6 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) {
|
|||
++i;
|
||||
}
|
||||
}
|
||||
Global::StickersByEmoji_RemovePack(it->stickers);
|
||||
it = sets.erase(it);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -209,6 +209,8 @@ DeclareRefSetting(RecentStickerPack, RecentStickers);
|
|||
|
||||
RecentStickerPack &cGetRecentStickers();
|
||||
|
||||
typedef QMap<EmojiPtr, StickerPack> StickersByEmojiMap;
|
||||
|
||||
static const uint64 DefaultStickerSetId = 0; // for backward compatibility
|
||||
static const uint64 CustomStickerSetId = 0xFFFFFFFFFFFFFFFFULL, RecentStickerSetId = 0xFFFFFFFFFFFFFFFEULL;
|
||||
static const uint64 NoneStickerSetId = 0xFFFFFFFFFFFFFFFDULL; // for emoji/stickers panel
|
||||
|
@ -219,6 +221,7 @@ struct StickerSet {
|
|||
QString title, shortName;
|
||||
int32 count, hash, flags;
|
||||
StickerPack stickers;
|
||||
StickersByEmojiMap emoji;
|
||||
};
|
||||
typedef QMap<uint64, StickerSet> StickerSets;
|
||||
DeclareRefSetting(StickerSets, StickerSets);
|
||||
|
|
|
@ -1513,8 +1513,6 @@ void DocumentData::setattributes(const QVector<MTPDocumentAttribute> &attributes
|
|||
_additional = 0;
|
||||
} break;
|
||||
case mtpc_documentAttributeSticker: {
|
||||
bool wasByEmoji = Global::StickersByEmoji_Remove(this);
|
||||
|
||||
const MTPDdocumentAttributeSticker &d(attributes[i].c_documentAttributeSticker());
|
||||
if (type == FileDocument) {
|
||||
type = StickerDocument;
|
||||
|
@ -1524,7 +1522,6 @@ void DocumentData::setattributes(const QVector<MTPDocumentAttribute> &attributes
|
|||
if (sticker()) {
|
||||
sticker()->alt = qs(d.valt);
|
||||
sticker()->set = d.vstickerset;
|
||||
if (wasByEmoji) Global::StickersByEmoji_Add(this);
|
||||
}
|
||||
} break;
|
||||
case mtpc_documentAttributeVideo: {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.9.18</string>
|
||||
<string>0.9.19</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
|
|
@ -34,8 +34,8 @@ IDI_ICON1 ICON "SourceFiles\\art\\icon256.ico"
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,9,18,0
|
||||
PRODUCTVERSION 0,9,18,0
|
||||
FILEVERSION 0,9,19,0
|
||||
PRODUCTVERSION 0,9,19,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -51,10 +51,10 @@ BEGIN
|
|||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram Messenger LLP"
|
||||
VALUE "FileVersion", "0.9.18.0"
|
||||
VALUE "FileVersion", "0.9.19.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2013"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "0.9.18.0"
|
||||
VALUE "ProductVersion", "0.9.19.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -1701,7 +1701,7 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.9.18;
|
||||
CURRENT_PROJECT_VERSION = 0.9.19;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
|
@ -1720,7 +1720,7 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 0.9.18;
|
||||
CURRENT_PROJECT_VERSION = 0.9.19;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
|
||||
|
@ -1747,10 +1747,10 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.9.18;
|
||||
CURRENT_PROJECT_VERSION = 0.9.19;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.9;
|
||||
DYLIB_CURRENT_VERSION = 0.9.18;
|
||||
DYLIB_CURRENT_VERSION = 0.9.19;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
|
@ -1882,10 +1882,10 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.9.18;
|
||||
CURRENT_PROJECT_VERSION = 0.9.19;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.9;
|
||||
DYLIB_CURRENT_VERSION = 0.9.18;
|
||||
DYLIB_CURRENT_VERSION = 0.9.19;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
AppVersion 9018
|
||||
AppVersion 9019
|
||||
AppVersionStrMajor 0.9
|
||||
AppVersionStrSmall 0.9.18
|
||||
AppVersionStr 0.9.18
|
||||
DevChannel 0
|
||||
AppVersionStrSmall 0.9.19
|
||||
AppVersionStr 0.9.19
|
||||
DevChannel 1
|
||||
BetaVersion 0 9015008
|
||||
|
|
Loading…
Reference in New Issue