next layer, stickerdata moved from documentdata

This commit is contained in:
John Preston 2015-05-11 15:44:27 +03:00
parent 9761c5bb56
commit cfb0de69f0
15 changed files with 668 additions and 91 deletions

View File

@ -1178,12 +1178,12 @@ namespace App {
if (result->thumb->isNull() && !thumb->isNull()) {
result->thumb = thumb;
}
if (result->alt.isEmpty()) {
if (result->sticker && result->sticker->alt.isEmpty()) {
for (QVector<MTPDocumentAttribute>::const_iterator i = attributes.cbegin(), e = attributes.cend(); i != e; ++i) {
if (i->type() == mtpc_documentAttributeSticker) {
const MTPDdocumentAttributeSticker &d(i->c_documentAttributeSticker());
if (d.valt.c_string().v.length() > 0) {
result->alt = qs(d.valt);
result->sticker->alt = qs(d.valt);
}
}
}

View File

@ -759,15 +759,17 @@ void EmojiPanInner::paintEvent(QPaintEvent *e) {
}
for (int index = downfrom; index < uptill; ++index) { // preload stickers
DocumentData *sticker = _stickers[index];
if (!sticker->sticker) continue;
bool already = !sticker->already().isEmpty(), hasdata = !sticker->data.isEmpty();
if (!sticker->loader && sticker->status != FileFailed && !already && !hasdata) {
sticker->save(QString());
}
if (sticker->sticker->isNull() && (already || hasdata)) {
if (sticker->sticker->img->isNull() && (already || hasdata)) {
if (already) {
sticker->sticker = ImagePtr(sticker->already());
sticker->sticker->img = ImagePtr(sticker->already());
} else {
sticker->sticker = ImagePtr(sticker->data);
sticker->sticker->img = ImagePtr(sticker->data);
}
}
@ -776,7 +778,7 @@ void EmojiPanInner::paintEvent(QPaintEvent *e) {
int32 w = qRound(coef * sticker->dimensions.width()), h = qRound(coef * sticker->dimensions.height());
if (w < 1) w = 1;
if (h < 1) h = 1;
if (!sticker->sticker->isNull()) sticker->sticker->pix(w, h);
if (!sticker->sticker->img->isNull()) sticker->sticker->img->pix(w, h);
}
int32 y, tilly = 0;
@ -879,15 +881,16 @@ void EmojiPanInner::paintEvent(QPaintEvent *e) {
}
DocumentData *sticker = _stickers[index];
if (!sticker->sticker) continue;
bool already = !sticker->already().isEmpty(), hasdata = !sticker->data.isEmpty();
if (!sticker->loader && sticker->status != FileFailed && !already && !hasdata) {
sticker->save(QString());
}
if (sticker->sticker->isNull() && (already || hasdata)) {
if (sticker->sticker->img->isNull() && (already || hasdata)) {
if (already) {
sticker->sticker = ImagePtr(sticker->already());
sticker->sticker->img = ImagePtr(sticker->already());
} else {
sticker->sticker = ImagePtr(sticker->data);
sticker->sticker->img = ImagePtr(sticker->data);
}
}
@ -897,10 +900,10 @@ void EmojiPanInner::paintEvent(QPaintEvent *e) {
if (w < 1) w = 1;
if (h < 1) h = 1;
QPoint ppos = pos + QPoint((stickerSize - w) / 2, (stickerSize - h) / 2);
if (sticker->sticker->isNull()) {
if (sticker->sticker->img->isNull()) {
p.drawPixmapLeft(ppos, width(), sticker->thumb->pix(w, h));
} else {
p.drawPixmapLeft(ppos, width(), sticker->sticker->pix(w, h));
p.drawPixmapLeft(ppos, width(), sticker->sticker->img->pix(w, h));
}
if (hover > 0 && _isUserGen[index]) {

View File

@ -2894,8 +2894,8 @@ HistorySticker::HistorySticker(DocumentData *document) : HistoryMedia()
}
bool HistorySticker::updateStickerEmoji() {
if (!data->alt.isEmpty()) {
_emoji = data->alt;
if (!data->sticker->alt.isEmpty()) {
_emoji = data->sticker->alt;
return true;
}
const EmojiStickersMap &stickers(cEmojiStickers());
@ -2948,24 +2948,24 @@ void HistorySticker::draw(QPainter &p, const HistoryItem *parent, bool selected,
if (!data->loader && data->status != FileFailed && !already && !hasdata) {
data->save(QString());
}
if (data->sticker->isNull() && (already || hasdata)) {
if (data->sticker->img->isNull() && (already || hasdata)) {
if (already) {
data->sticker = ImagePtr(data->already());
data->sticker->img = ImagePtr(data->already());
} else {
data->sticker = ImagePtr(data->data);
data->sticker->img = ImagePtr(data->data);
}
}
if (selected) {
if (data->sticker->isNull()) {
if (data->sticker->img->isNull()) {
p.drawPixmap(QPoint(usex + (usew - pixw) / 2, (_minh - pixh) / 2), data->thumb->pixBlurredColored(st::msgStickerOverlay, pixw, pixh));
} else {
p.drawPixmap(QPoint(usex + (usew - pixw) / 2, (_minh - pixh) / 2), data->sticker->pixColored(st::msgStickerOverlay, pixw, pixh));
p.drawPixmap(QPoint(usex + (usew - pixw) / 2, (_minh - pixh) / 2), data->sticker->img->pixColored(st::msgStickerOverlay, pixw, pixh));
}
} else {
if (data->sticker->isNull()) {
if (data->sticker->img->isNull()) {
p.drawPixmap(QPoint(usex + (usew - pixw) / 2, (_minh - pixh) / 2), data->thumb->pixBlurred(pixw, pixh));
} else {
p.drawPixmap(QPoint(usex + (usew - pixw) / 2, (_minh - pixh) / 2), data->sticker->pix(pixw, pixh));
p.drawPixmap(QPoint(usex + (usew - pixw) / 2, (_minh - pixh) / 2), data->sticker->img->pix(pixw, pixh));
}
}
@ -4606,7 +4606,7 @@ void HistoryMessage::initMediaFromText(QString &currentText) {
}
void HistoryMessage::initMediaFromDocument(DocumentData *doc) {
if (doc->type == StickerDocument && doc->dimensions.width() > 0 && doc->dimensions.height() > 0 && doc->dimensions.width() <= StickerMaxSize && doc->dimensions.height() <= StickerMaxSize && doc->size < StickerInMemory) {
if (doc->type == StickerDocument && doc->sticker && doc->dimensions.width() > 0 && doc->dimensions.height() > 0 && doc->dimensions.width() <= StickerMaxSize && doc->dimensions.height() <= StickerMaxSize && doc->size < StickerInMemory) {
_media = new HistorySticker(doc);
} else {
_media = new HistoryDocument(doc);

View File

@ -3256,8 +3256,8 @@ namespace {
}
if (document->type == AnimatedDocument) {
attributes.push_back(MTP_documentAttributeAnimated());
} else if (document->type == StickerDocument) {
attributes.push_back(MTP_documentAttributeSticker(MTP_string(document->alt)));
} else if (document->type == StickerDocument && document->sticker) {
attributes.push_back(MTP_documentAttributeSticker(MTP_string(document->sticker->alt), document->sticker->set));
}
return MTP_vector<MTPDocumentAttribute>(attributes);
}

View File

@ -188,7 +188,7 @@ void LocalImageLoaderPrivate::prepareImages() {
if (animated) {
attributes.push_back(MTP_documentAttributeAnimated());
} else if (mime == stickerMime && w > 0 && h > 0 && w <= StickerMaxSize && h <= StickerMaxSize && filesize < StickerInMemory) {
attributes.push_back(MTP_documentAttributeSticker(MTP_string("")));
attributes.push_back(MTP_documentAttributeSticker(MTP_string(""), MTP_inputStickerSetEmpty()));
thumbFormat = "webp";
thumbExt = qsl("webp");
}

View File

@ -2163,14 +2163,14 @@ namespace Local {
if (doc->status == FileFailed) continue;
// id + value + access + date + namelen + name + mimelen + mime + dc + size + width + height + type + alt
size += sizeof(quint64) + sizeof(qint16) + sizeof(quint64) + sizeof(qint32) + _stringSize(doc->name) + _stringSize(doc->mime) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + _stringSize(doc->alt);
size += sizeof(quint64) + sizeof(qint16) + sizeof(quint64) + sizeof(qint32) + _stringSize(doc->name) + _stringSize(doc->mime) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + _stringSize(doc->sticker ? doc->sticker->alt : QString());
}
EncryptedDescriptor data(size);
for (RecentStickerPack::const_iterator i = recent.cbegin(); i != recent.cend(); ++i) {
DocumentData *doc = i->first;
if (doc->status == FileFailed) continue;
data.stream << quint64(doc->id) << qint16(i->second) << quint64(doc->access) << qint32(doc->date) << doc->name << doc->mime << qint32(doc->dc) << qint32(doc->size) << qint32(doc->dimensions.width()) << qint32(doc->dimensions.height()) << qint32(doc->type) << doc->alt;
data.stream << quint64(doc->id) << qint16(i->second) << quint64(doc->access) << qint32(doc->date) << doc->name << doc->mime << qint32(doc->dc) << qint32(doc->size) << qint32(doc->dimensions.width()) << qint32(doc->dimensions.height()) << qint32(doc->type) << (doc->sticker ? doc->sticker->alt : QString());
}
FileWriteDescriptor file(_recentStickersKey);
file.writeEncrypted(data);
@ -2207,7 +2207,7 @@ namespace Local {
if (type == AnimatedDocument) {
attributes.push_back(MTP_documentAttributeAnimated());
} else if (type == StickerDocument) {
attributes.push_back(MTP_documentAttributeSticker(MTP_string(alt)));
attributes.push_back(MTP_documentAttributeSticker(MTP_string(alt), MTP_inputStickerSetEmpty()));
}
if (width > 0 && height > 0) {
attributes.push_back(MTP_documentAttributeImageSize(MTP_int(width), MTP_int(height)));

View File

@ -775,9 +775,9 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) {
_doc = doc;
QString already = _doc->already(true);
if (!_doc->sticker->isNull() && _doc->sticker->loaded()) {
if (_doc->sticker && !_doc->sticker->img->isNull() && _doc->sticker->img->loaded()) {
_currentGif.stop();
_current = _doc->sticker->pix();
_current = _doc->sticker->img->pix();
} else if (!already.isEmpty()) {
QImageReader reader(already);
if (reader.canRead()) {
@ -980,7 +980,7 @@ void MediaView::paintEvent(QPaintEvent *e) {
QRect imgRect(_x, _y, _w, _h);
const QPixmap *toDraw = _currentGif.isNull() ? &_current : &_currentGif.frames[_currentGif.frame];
if (imgRect.intersects(r)) {
if (toDraw->hasAlpha() && (!_doc || _doc->sticker->isNull())) {
if (toDraw->hasAlpha() && (!_doc || !_doc->sticker || _doc->sticker->img->isNull())) {
p.fillRect(imgRect, _transparentBrush);
}
if (_zoom) {
@ -1368,7 +1368,7 @@ void MediaView::preloadData(int32 delta) {
switch (media->type()) {
case MediaTypePhoto: static_cast<HistoryPhoto*>(media)->photo()->full->load(); break;
case MediaTypeDocument: static_cast<HistoryDocument*>(media)->document()->thumb->load(); break;
case MediaTypeSticker: static_cast<HistorySticker*>(media)->document()->sticker->load(); break;
case MediaTypeSticker: static_cast<HistorySticker*>(media)->document()->sticker->img->load(); break;
}
}
}

View File

@ -117,6 +117,7 @@ with open('scheme.tl') as f:
prms = {};
conditions = {};
prmsList = [];
conditionsList = [];
isTemplate = hasFlags = hasTemplate = '';
for param in paramsList:
if (re.match(r'^\s*$', param)):
@ -149,7 +150,9 @@ with open('scheme.tl') as f:
print('Bad param found: "' + param + '" in line: ' + line);
continue;
ptype = pmasktype.group(3);
conditions[pname] = pmasktype.group(2);
if (not pname in conditions):
conditionsList.append(pname);
conditions[pname] = pmasktype.group(2);
elif (ptype.find('<') >= 0):
templ = re.match(r'^([vV]ector<)([A-Za-z0-9\._]+)>$', ptype);
if (templ):
@ -198,11 +201,11 @@ with open('scheme.tl') as f:
if (len(conditions)):
funcsText += '\n';
funcsText += '\tenum {\n';
for paramName in conditions.keys():
for paramName in conditionsList:
funcsText += '\t\tflag_' + paramName + ' = (1 << ' + conditions[paramName] + '),\n';
funcsText += '\t};\n';
funcsText += '\n';
for paramName in conditions.keys():
for paramName in conditionsList:
funcsText += '\tbool has_' + paramName + '() const { return v' + hasFlags + '.v & flag_' + paramName + '; }\n';
funcsText += '\n';
@ -210,7 +213,7 @@ with open('scheme.tl') as f:
size = [];
for k in prmsList:
v = prms[k];
if (k in conditions.keys()):
if (k in conditionsList):
size.append('(has_' + k + '() ? v' + k + '.innerLength() : 0)');
else:
size.append('v' + k + '.innerLength()');
@ -224,7 +227,7 @@ with open('scheme.tl') as f:
funcsText += '\tvoid read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_' + name + ') {\n'; # read method
for k in prmsList:
v = prms[k];
if (k in conditions.keys()):
if (k in conditionsList):
funcsText += '\t\tif (has_' + k + '()) { v' + k + '.read(from, end); } else { v' + k + ' = MTP' + v + '(); }\n';
else:
funcsText += '\t\tv' + k + '.read(from, end);\n';
@ -233,7 +236,7 @@ with open('scheme.tl') as f:
funcsText += '\tvoid write(mtpBuffer &to) const {\n'; # write method
for k in prmsList:
v = prms[k];
if (k in conditions.keys()):
if (k in conditionsList):
funcsText += '\t\tif (has_' + k + '()) v' + k + '.write(to);\n';
else:
funcsText += '\t\tv' + k + '.write(to);\n';
@ -269,7 +272,7 @@ with open('scheme.tl') as f:
funcsList.append(restype);
funcsDict[restype] = [];
# TypesDict[restype] = resType;
funcsDict[restype].append([name, typeid, prmsList, prms, hasFlags, conditions]);
funcsDict[restype].append([name, typeid, prmsList, prms, hasFlags, conditionsList, conditions]);
else:
if (isTemplate != ''):
print('Template types not allowed: "' + resType + '" in line: ' + line);
@ -278,7 +281,7 @@ with open('scheme.tl') as f:
typesList.append(restype);
typesDict[restype] = [];
TypesDict[restype] = resType;
typesDict[restype].append([name, typeid, prmsList, prms, hasFlags, conditions]);
typesDict[restype].append([name, typeid, prmsList, prms, hasFlags, conditionsList, conditions]);
consts = consts + 1;
@ -292,7 +295,8 @@ def addTextSerialize(lst, dct, dataLetter):
prmsList = data[2];
prms = data[3];
hasFlags = data[4];
conditions = data[5];
conditionsList = data[5];
conditions = data[6];
if len(result):
result += '\n';
@ -311,7 +315,7 @@ def addTextSerialize(lst, dct, dataLetter):
result += '\t\t\t\tcase ' + str(stage) + ': to.add(" ' + k + ': "); ++stages.back(); ';
if (k == hasFlags):
result += 'if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; ';
if (k in conditions.keys()):
if (k in conditionsList):
result += 'if (flag & MTP' + dataLetter + name + '::flag_' + k + ') { ';
result += 'types.push_back(';
vtypeget = re.match(r'^[Vv]ector<MTP([A-Za-z0-9\._]+)>', v);
@ -355,7 +359,7 @@ def addTextSerialize(lst, dct, dataLetter):
else:
result += '0); vtypes.push_back(0';
result += '); stages.push_back(0); flags.push_back(0); ';
if (k in conditions.keys()):
if (k in conditionsList):
result += '} else { to.add("[ SKIPPED BY BIT ' + conditions[k] + ' IN FIELD ' + hasFlags + ' ]"); } ';
result += 'break;\n';
stage = stage + 1;
@ -396,7 +400,8 @@ for restype in typesList:
prmsList = data[2];
prms = data[3];
hasFlags = data[4];
conditions = data[5];
conditionsList = data[5];
conditions = data[6];
dataText = '';
dataText += '\nclass MTPD' + name + ' : public mtpDataImpl<MTPD' + name + '> {\n'; # data class
@ -451,7 +456,7 @@ for restype in typesList:
if (withType):
readText += '\t\t';
writeText += '\t\t';
if (paramName in conditions.keys()):
if (paramName in conditionsList):
readText += '\tif (v.has_' + paramName + '()) { v.v' + paramName + '.read(from, end); } else { v.v' + paramName + ' = MTP' + paramType + '(); }\n';
writeText += '\tif (v.has_' + paramName + '()) v.v' + paramName + '.write(to);\n';
sizeList.append('(v.has_' + paramName + '() ? v.v' + paramName + '.innerLength() : 0)');
@ -482,11 +487,11 @@ for restype in typesList:
if (len(conditions)):
dataText += '\n';
dataText += '\tenum {\n';
for paramName in conditions.keys():
for paramName in conditionsList:
dataText += '\t\tflag_' + paramName + ' = (1 << ' + conditions[paramName] + '),\n';
dataText += '\t};\n';
dataText += '\n';
for paramName in conditions.keys():
for paramName in conditionsList:
dataText += '\tbool has_' + paramName + '() const { return v' + hasFlags + '.v & flag_' + paramName + '; }\n';
dataText += '};\n'; # class ending

View File

@ -366,7 +366,7 @@ static const mtpTypeId mtpLayers[] = {
mtpc_invokeWithLayer17,
mtpc_invokeWithLayer18,
}, mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]);
static const mtpPrime mtpCurrentLayer = 28;
static const mtpPrime mtpCurrentLayer = 29;
template <typename bareT>
class MTPBoxed : public bareT {

View File

@ -3926,6 +3926,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
}
switch (stage) {
case 0: to.add(" alt: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" stickerset: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
@ -4017,7 +4018,8 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
switch (stage) {
case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" packs: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 2: to.add(" documents: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 2: to.add(" sets: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 3: to.add(" documents: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
@ -4289,6 +4291,68 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
}
break;
case mtpc_inputStickerSetEmpty:
to.add("{ inputStickerSetEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
break;
case mtpc_inputStickerSetID:
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ inputStickerSetID");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
case mtpc_inputStickerSetShortName:
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ inputStickerSetShortName");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
case mtpc_stickerSet:
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ stickerSet");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 2: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 3: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
case mtpc_messages_stickerSet:
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ messages_stickerSet");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" set: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" packs: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 2: to.add(" documents: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
case mtpc_req_pq:
if (stage) {
to.add(",\n").addSpaces(lev);
@ -4779,6 +4843,32 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
}
break;
case mtpc_messages_installStickerSet:
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ messages_installStickerSet");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" stickerset: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
case mtpc_messages_uninstallStickerSet:
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ messages_uninstallStickerSet");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" stickerset: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
case mtpc_invokeAfterMsg:
if (stage) {
to.add(",\n").addSpaces(lev);
@ -6027,6 +6117,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
}
break;
case mtpc_messages_getStickerSet:
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ messages_getStickerSet");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" stickerset: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
case mtpc_rpc_result:
if (stage) {
to.add(",\n").addSpaces(lev);

View File

@ -340,7 +340,7 @@ enum {
mtpc_updateUserPhone = 0x12b9417b,
mtpc_documentAttributeImageSize = 0x6c37c15c,
mtpc_documentAttributeAnimated = 0x11b58939,
mtpc_documentAttributeSticker = 0x994c9882,
mtpc_documentAttributeSticker = 0x3a556302,
mtpc_documentAttributeVideo = 0x5910cccb,
mtpc_documentAttributeAudio = 0x51448e5,
mtpc_documentAttributeFilename = 0x15590068,
@ -348,7 +348,7 @@ enum {
mtpc_messages_stickers = 0x8a8ecd32,
mtpc_stickerPack = 0x12b299d4,
mtpc_messages_allStickersNotModified = 0xe86602c3,
mtpc_messages_allStickers = 0xdcef3102,
mtpc_messages_allStickers = 0x5ce352ec,
mtpc_disabledFeature = 0xae636f24,
mtpc_updateReadHistoryInbox = 0x9961fd5c,
mtpc_updateReadHistoryOutbox = 0x2f2f21bf,
@ -378,6 +378,11 @@ enum {
mtpc_chatInvite = 0xce917dcd,
mtpc_messageActionChatJoinedByLink = 0xf89cf5e8,
mtpc_updateReadMessagesContents = 0x68c13933,
mtpc_inputStickerSetEmpty = 0xffb62b95,
mtpc_inputStickerSetID = 0x9de7a269,
mtpc_inputStickerSetShortName = 0x861cc8a0,
mtpc_stickerSet = 0xa7a43b17,
mtpc_messages_stickerSet = 0xb60a24a6,
mtpc_invokeAfterMsg = 0xcb9f372d,
mtpc_invokeAfterMsgs = 0x3dc4b4f0,
mtpc_auth_checkPhone = 0x6fe51dfb,
@ -500,7 +505,10 @@ enum {
mtpc_invokeWithoutUpdates = 0xbf9459b7,
mtpc_messages_exportChatInvite = 0x7d885289,
mtpc_messages_checkChatInvite = 0x3eadb1bb,
mtpc_messages_importChatInvite = 0x6c50051c
mtpc_messages_importChatInvite = 0x6c50051c,
mtpc_messages_getStickerSet = 0x2619a90e,
mtpc_messages_installStickerSet = 0xefbbfae9,
mtpc_messages_uninstallStickerSet = 0xf96e55de
};
// Type forward declarations
@ -1045,6 +1053,16 @@ class MTPchatInvite;
class MTPDchatInviteAlready;
class MTPDchatInvite;
class MTPinputStickerSet;
class MTPDinputStickerSetID;
class MTPDinputStickerSetShortName;
class MTPstickerSet;
class MTPDstickerSet;
class MTPmessages_stickerSet;
class MTPDmessages_stickerSet;
// Boxed types definitions
typedef MTPBoxed<MTPresPQ> MTPResPQ;
@ -1188,6 +1206,9 @@ typedef MTPBoxed<MTPauth_passwordRecovery> MTPauth_PasswordRecovery;
typedef MTPBoxed<MTPreceivedNotifyMessage> MTPReceivedNotifyMessage;
typedef MTPBoxed<MTPexportedChatInvite> MTPExportedChatInvite;
typedef MTPBoxed<MTPchatInvite> MTPChatInvite;
typedef MTPBoxed<MTPinputStickerSet> MTPInputStickerSet;
typedef MTPBoxed<MTPstickerSet> MTPStickerSet;
typedef MTPBoxed<MTPmessages_stickerSet> MTPmessages_StickerSet;
// Type classes definitions
@ -7153,7 +7174,7 @@ private:
friend MTPdocumentAttribute MTP_documentAttributeImageSize(MTPint _w, MTPint _h);
friend MTPdocumentAttribute MTP_documentAttributeAnimated();
friend MTPdocumentAttribute MTP_documentAttributeSticker(const MTPstring &_alt);
friend MTPdocumentAttribute MTP_documentAttributeSticker(const MTPstring &_alt, const MTPInputStickerSet &_stickerset);
friend MTPdocumentAttribute MTP_documentAttributeVideo(MTPint _duration, MTPint _w, MTPint _h);
friend MTPdocumentAttribute MTP_documentAttributeAudio(MTPint _duration);
friend MTPdocumentAttribute MTP_documentAttributeFilename(const MTPstring &_file_name);
@ -7263,7 +7284,7 @@ private:
explicit MTPmessages_allStickers(MTPDmessages_allStickers *_data);
friend MTPmessages_allStickers MTP_messages_allStickersNotModified();
friend MTPmessages_allStickers MTP_messages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPDocument> &_documents);
friend MTPmessages_allStickers MTP_messages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPStickerSet> &_sets, const MTPVector<MTPDocument> &_documents);
mtpTypeId _type;
};
@ -7749,6 +7770,120 @@ private:
};
typedef MTPBoxed<MTPchatInvite> MTPChatInvite;
class MTPinputStickerSet : private mtpDataOwner {
public:
MTPinputStickerSet() : mtpDataOwner(0), _type(0) {
}
MTPinputStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) {
read(from, end, cons);
}
MTPDinputStickerSetID &_inputStickerSetID() {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_inputStickerSetID) throw mtpErrorWrongTypeId(_type, mtpc_inputStickerSetID);
split();
return *(MTPDinputStickerSetID*)data;
}
const MTPDinputStickerSetID &c_inputStickerSetID() const {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_inputStickerSetID) throw mtpErrorWrongTypeId(_type, mtpc_inputStickerSetID);
return *(const MTPDinputStickerSetID*)data;
}
MTPDinputStickerSetShortName &_inputStickerSetShortName() {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_inputStickerSetShortName) throw mtpErrorWrongTypeId(_type, mtpc_inputStickerSetShortName);
split();
return *(MTPDinputStickerSetShortName*)data;
}
const MTPDinputStickerSetShortName &c_inputStickerSetShortName() const {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_inputStickerSetShortName) throw mtpErrorWrongTypeId(_type, mtpc_inputStickerSetShortName);
return *(const MTPDinputStickerSetShortName*)data;
}
uint32 innerLength() const;
mtpTypeId type() const;
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons);
void write(mtpBuffer &to) const;
typedef void ResponseType;
private:
explicit MTPinputStickerSet(mtpTypeId type);
explicit MTPinputStickerSet(MTPDinputStickerSetID *_data);
explicit MTPinputStickerSet(MTPDinputStickerSetShortName *_data);
friend MTPinputStickerSet MTP_inputStickerSetEmpty();
friend MTPinputStickerSet MTP_inputStickerSetID(const MTPlong &_id, const MTPlong &_access_hash);
friend MTPinputStickerSet MTP_inputStickerSetShortName(const MTPstring &_short_name);
mtpTypeId _type;
};
typedef MTPBoxed<MTPinputStickerSet> MTPInputStickerSet;
class MTPstickerSet : private mtpDataOwner {
public:
MTPstickerSet();
MTPstickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_stickerSet) : mtpDataOwner(0) {
read(from, end, cons);
}
MTPDstickerSet &_stickerSet() {
if (!data) throw mtpErrorUninitialized();
split();
return *(MTPDstickerSet*)data;
}
const MTPDstickerSet &c_stickerSet() const {
if (!data) throw mtpErrorUninitialized();
return *(const MTPDstickerSet*)data;
}
uint32 innerLength() const;
mtpTypeId type() const;
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_stickerSet);
void write(mtpBuffer &to) const;
typedef void ResponseType;
private:
explicit MTPstickerSet(MTPDstickerSet *_data);
friend MTPstickerSet MTP_stickerSet(const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name);
};
typedef MTPBoxed<MTPstickerSet> MTPStickerSet;
class MTPmessages_stickerSet : private mtpDataOwner {
public:
MTPmessages_stickerSet();
MTPmessages_stickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_stickerSet) : mtpDataOwner(0) {
read(from, end, cons);
}
MTPDmessages_stickerSet &_messages_stickerSet() {
if (!data) throw mtpErrorUninitialized();
split();
return *(MTPDmessages_stickerSet*)data;
}
const MTPDmessages_stickerSet &c_messages_stickerSet() const {
if (!data) throw mtpErrorUninitialized();
return *(const MTPDmessages_stickerSet*)data;
}
uint32 innerLength() const;
mtpTypeId type() const;
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_stickerSet);
void write(mtpBuffer &to) const;
typedef void ResponseType;
private:
explicit MTPmessages_stickerSet(MTPDmessages_stickerSet *_data);
friend MTPmessages_stickerSet MTP_messages_stickerSet(const MTPStickerSet &_set, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPDocument> &_documents);
};
typedef MTPBoxed<MTPmessages_stickerSet> MTPmessages_StickerSet;
// Type constructors with data
class MTPDresPQ : public mtpDataImpl<MTPDresPQ> {
@ -8777,13 +8912,13 @@ public:
enum {
flag_fwd_from_id = (1 << 2),
flag_reply_to_msg_id = (1 << 3),
flag_fwd_date = (1 << 2),
flag_reply_to_msg_id = (1 << 3),
};
bool has_fwd_from_id() const { return vflags.v & flag_fwd_from_id; }
bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; }
bool has_fwd_date() const { return vflags.v & flag_fwd_date; }
bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; }
};
class MTPDmessageService : public mtpDataImpl<MTPDmessageService> {
@ -9886,13 +10021,13 @@ public:
enum {
flag_fwd_from_id = (1 << 2),
flag_reply_to_msg_id = (1 << 3),
flag_fwd_date = (1 << 2),
flag_reply_to_msg_id = (1 << 3),
};
bool has_fwd_from_id() const { return vflags.v & flag_fwd_from_id; }
bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; }
bool has_fwd_date() const { return vflags.v & flag_fwd_date; }
bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; }
};
class MTPDupdateShortChatMessage : public mtpDataImpl<MTPDupdateShortChatMessage> {
@ -9916,13 +10051,13 @@ public:
enum {
flag_fwd_from_id = (1 << 2),
flag_reply_to_msg_id = (1 << 3),
flag_fwd_date = (1 << 2),
flag_reply_to_msg_id = (1 << 3),
};
bool has_fwd_from_id() const { return vflags.v & flag_fwd_from_id; }
bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; }
bool has_fwd_date() const { return vflags.v & flag_fwd_date; }
bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; }
};
class MTPDupdateShort : public mtpDataImpl<MTPDupdateShort> {
@ -10630,10 +10765,11 @@ class MTPDdocumentAttributeSticker : public mtpDataImpl<MTPDdocumentAttributeSti
public:
MTPDdocumentAttributeSticker() {
}
MTPDdocumentAttributeSticker(const MTPstring &_alt) : valt(_alt) {
MTPDdocumentAttributeSticker(const MTPstring &_alt, const MTPInputStickerSet &_stickerset) : valt(_alt), vstickerset(_stickerset) {
}
MTPstring valt;
MTPInputStickerSet vstickerset;
};
class MTPDdocumentAttributeVideo : public mtpDataImpl<MTPDdocumentAttributeVideo> {
@ -10694,11 +10830,12 @@ class MTPDmessages_allStickers : public mtpDataImpl<MTPDmessages_allStickers> {
public:
MTPDmessages_allStickers() {
}
MTPDmessages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPDocument> &_documents) : vhash(_hash), vpacks(_packs), vdocuments(_documents) {
MTPDmessages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPStickerSet> &_sets, const MTPVector<MTPDocument> &_documents) : vhash(_hash), vpacks(_packs), vsets(_sets), vdocuments(_documents) {
}
MTPstring vhash;
MTPVector<MTPStickerPack> vpacks;
MTPVector<MTPStickerSet> vsets;
MTPVector<MTPDocument> vdocuments;
};
@ -10769,30 +10906,30 @@ public:
MTPstring vauthor;
enum {
flag_photo = (1 << 4),
flag_embed_type = (1 << 5),
flag_author = (1 << 8),
flag_embed_width = (1 << 6),
flag_type = (1 << 0),
flag_duration = (1 << 7),
flag_embed_height = (1 << 6),
flag_description = (1 << 3),
flag_site_name = (1 << 1),
flag_title = (1 << 2),
flag_description = (1 << 3),
flag_photo = (1 << 4),
flag_embed_url = (1 << 5),
flag_embed_type = (1 << 5),
flag_embed_width = (1 << 6),
flag_embed_height = (1 << 6),
flag_duration = (1 << 7),
flag_author = (1 << 8),
};
bool has_photo() const { return vflags.v & flag_photo; }
bool has_embed_type() const { return vflags.v & flag_embed_type; }
bool has_author() const { return vflags.v & flag_author; }
bool has_embed_width() const { return vflags.v & flag_embed_width; }
bool has_type() const { return vflags.v & flag_type; }
bool has_duration() const { return vflags.v & flag_duration; }
bool has_embed_height() const { return vflags.v & flag_embed_height; }
bool has_description() const { return vflags.v & flag_description; }
bool has_site_name() const { return vflags.v & flag_site_name; }
bool has_title() const { return vflags.v & flag_title; }
bool has_description() const { return vflags.v & flag_description; }
bool has_photo() const { return vflags.v & flag_photo; }
bool has_embed_url() const { return vflags.v & flag_embed_url; }
bool has_embed_type() const { return vflags.v & flag_embed_type; }
bool has_embed_width() const { return vflags.v & flag_embed_width; }
bool has_embed_height() const { return vflags.v & flag_embed_height; }
bool has_duration() const { return vflags.v & flag_duration; }
bool has_author() const { return vflags.v & flag_author; }
};
class MTPDauthorization : public mtpDataImpl<MTPDauthorization> {
@ -10877,15 +11014,15 @@ public:
enum {
flag_new_salt = (1 << 0),
flag_email = (1 << 1),
flag_new_password_hash = (1 << 0),
flag_hint = (1 << 0),
flag_email = (1 << 1),
};
bool has_new_salt() const { return vflags.v & flag_new_salt; }
bool has_email() const { return vflags.v & flag_email; }
bool has_new_password_hash() const { return vflags.v & flag_new_password_hash; }
bool has_hint() const { return vflags.v & flag_hint; }
bool has_email() const { return vflags.v & flag_email; }
};
class MTPDauth_passwordRecovery : public mtpDataImpl<MTPDauth_passwordRecovery> {
@ -10939,6 +11076,52 @@ public:
MTPstring vtitle;
};
class MTPDinputStickerSetID : public mtpDataImpl<MTPDinputStickerSetID> {
public:
MTPDinputStickerSetID() {
}
MTPDinputStickerSetID(const MTPlong &_id, const MTPlong &_access_hash) : vid(_id), vaccess_hash(_access_hash) {
}
MTPlong vid;
MTPlong vaccess_hash;
};
class MTPDinputStickerSetShortName : public mtpDataImpl<MTPDinputStickerSetShortName> {
public:
MTPDinputStickerSetShortName() {
}
MTPDinputStickerSetShortName(const MTPstring &_short_name) : vshort_name(_short_name) {
}
MTPstring vshort_name;
};
class MTPDstickerSet : public mtpDataImpl<MTPDstickerSet> {
public:
MTPDstickerSet() {
}
MTPDstickerSet(const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name) : vid(_id), vaccess_hash(_access_hash), vtitle(_title), vshort_name(_short_name) {
}
MTPlong vid;
MTPlong vaccess_hash;
MTPstring vtitle;
MTPstring vshort_name;
};
class MTPDmessages_stickerSet : public mtpDataImpl<MTPDmessages_stickerSet> {
public:
MTPDmessages_stickerSet() {
}
MTPDmessages_stickerSet(const MTPStickerSet &_set, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPDocument> &_documents) : vset(_set), vpacks(_packs), vdocuments(_documents) {
}
MTPStickerSet vset;
MTPVector<MTPStickerPack> vpacks;
MTPVector<MTPDocument> vdocuments;
};
// RPC methods
class MTPreq_pq { // RPC method 'req_pq'
@ -16433,6 +16616,123 @@ public:
}
};
class MTPmessages_getStickerSet { // RPC method 'messages.getStickerSet'
public:
MTPInputStickerSet vstickerset;
MTPmessages_getStickerSet() {
}
MTPmessages_getStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getStickerSet) {
read(from, end, cons);
}
MTPmessages_getStickerSet(const MTPInputStickerSet &_stickerset) : vstickerset(_stickerset) {
}
uint32 innerLength() const {
return vstickerset.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_getStickerSet;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getStickerSet) {
vstickerset.read(from, end);
}
void write(mtpBuffer &to) const {
vstickerset.write(to);
}
typedef MTPmessages_StickerSet ResponseType;
};
class MTPmessages_GetStickerSet : public MTPBoxed<MTPmessages_getStickerSet> {
public:
MTPmessages_GetStickerSet() {
}
MTPmessages_GetStickerSet(const MTPmessages_getStickerSet &v) : MTPBoxed<MTPmessages_getStickerSet>(v) {
}
MTPmessages_GetStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_getStickerSet>(from, end, cons) {
}
MTPmessages_GetStickerSet(const MTPInputStickerSet &_stickerset) : MTPBoxed<MTPmessages_getStickerSet>(MTPmessages_getStickerSet(_stickerset)) {
}
};
class MTPmessages_installStickerSet { // RPC method 'messages.installStickerSet'
public:
MTPInputStickerSet vstickerset;
MTPmessages_installStickerSet() {
}
MTPmessages_installStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_installStickerSet) {
read(from, end, cons);
}
MTPmessages_installStickerSet(const MTPInputStickerSet &_stickerset) : vstickerset(_stickerset) {
}
uint32 innerLength() const {
return vstickerset.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_installStickerSet;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_installStickerSet) {
vstickerset.read(from, end);
}
void write(mtpBuffer &to) const {
vstickerset.write(to);
}
typedef MTPBool ResponseType;
};
class MTPmessages_InstallStickerSet : public MTPBoxed<MTPmessages_installStickerSet> {
public:
MTPmessages_InstallStickerSet() {
}
MTPmessages_InstallStickerSet(const MTPmessages_installStickerSet &v) : MTPBoxed<MTPmessages_installStickerSet>(v) {
}
MTPmessages_InstallStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_installStickerSet>(from, end, cons) {
}
MTPmessages_InstallStickerSet(const MTPInputStickerSet &_stickerset) : MTPBoxed<MTPmessages_installStickerSet>(MTPmessages_installStickerSet(_stickerset)) {
}
};
class MTPmessages_uninstallStickerSet { // RPC method 'messages.uninstallStickerSet'
public:
MTPInputStickerSet vstickerset;
MTPmessages_uninstallStickerSet() {
}
MTPmessages_uninstallStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_uninstallStickerSet) {
read(from, end, cons);
}
MTPmessages_uninstallStickerSet(const MTPInputStickerSet &_stickerset) : vstickerset(_stickerset) {
}
uint32 innerLength() const {
return vstickerset.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_uninstallStickerSet;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_uninstallStickerSet) {
vstickerset.read(from, end);
}
void write(mtpBuffer &to) const {
vstickerset.write(to);
}
typedef MTPBool ResponseType;
};
class MTPmessages_UninstallStickerSet : public MTPBoxed<MTPmessages_uninstallStickerSet> {
public:
MTPmessages_UninstallStickerSet() {
}
MTPmessages_UninstallStickerSet(const MTPmessages_uninstallStickerSet &v) : MTPBoxed<MTPmessages_uninstallStickerSet>(v) {
}
MTPmessages_UninstallStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_uninstallStickerSet>(from, end, cons) {
}
MTPmessages_UninstallStickerSet(const MTPInputStickerSet &_stickerset) : MTPBoxed<MTPmessages_uninstallStickerSet>(MTPmessages_uninstallStickerSet(_stickerset)) {
}
};
// Inline methods definition
inline MTPresPQ::MTPresPQ() : mtpDataOwner(new MTPDresPQ()) {
@ -24350,7 +24650,7 @@ inline uint32 MTPdocumentAttribute::innerLength() const {
}
case mtpc_documentAttributeSticker: {
const MTPDdocumentAttributeSticker &v(c_documentAttributeSticker());
return v.valt.innerLength();
return v.valt.innerLength() + v.vstickerset.innerLength();
}
case mtpc_documentAttributeVideo: {
const MTPDdocumentAttributeVideo &v(c_documentAttributeVideo());
@ -24385,6 +24685,7 @@ inline void MTPdocumentAttribute::read(const mtpPrime *&from, const mtpPrime *en
if (!data) setData(new MTPDdocumentAttributeSticker());
MTPDdocumentAttributeSticker &v(_documentAttributeSticker());
v.valt.read(from, end);
v.vstickerset.read(from, end);
} break;
case mtpc_documentAttributeVideo: _type = cons; {
if (!data) setData(new MTPDdocumentAttributeVideo());
@ -24416,6 +24717,7 @@ inline void MTPdocumentAttribute::write(mtpBuffer &to) const {
case mtpc_documentAttributeSticker: {
const MTPDdocumentAttributeSticker &v(c_documentAttributeSticker());
v.valt.write(to);
v.vstickerset.write(to);
} break;
case mtpc_documentAttributeVideo: {
const MTPDdocumentAttributeVideo &v(c_documentAttributeVideo());
@ -24460,8 +24762,8 @@ inline MTPdocumentAttribute MTP_documentAttributeImageSize(MTPint _w, MTPint _h)
inline MTPdocumentAttribute MTP_documentAttributeAnimated() {
return MTPdocumentAttribute(mtpc_documentAttributeAnimated);
}
inline MTPdocumentAttribute MTP_documentAttributeSticker(const MTPstring &_alt) {
return MTPdocumentAttribute(new MTPDdocumentAttributeSticker(_alt));
inline MTPdocumentAttribute MTP_documentAttributeSticker(const MTPstring &_alt, const MTPInputStickerSet &_stickerset) {
return MTPdocumentAttribute(new MTPDdocumentAttributeSticker(_alt, _stickerset));
}
inline MTPdocumentAttribute MTP_documentAttributeVideo(MTPint _duration, MTPint _w, MTPint _h) {
return MTPdocumentAttribute(new MTPDdocumentAttributeVideo(_duration, _w, _h));
@ -24557,7 +24859,7 @@ inline uint32 MTPmessages_allStickers::innerLength() const {
switch (_type) {
case mtpc_messages_allStickers: {
const MTPDmessages_allStickers &v(c_messages_allStickers());
return v.vhash.innerLength() + v.vpacks.innerLength() + v.vdocuments.innerLength();
return v.vhash.innerLength() + v.vpacks.innerLength() + v.vsets.innerLength() + v.vdocuments.innerLength();
}
}
return 0;
@ -24575,6 +24877,7 @@ inline void MTPmessages_allStickers::read(const mtpPrime *&from, const mtpPrime
MTPDmessages_allStickers &v(_messages_allStickers());
v.vhash.read(from, end);
v.vpacks.read(from, end);
v.vsets.read(from, end);
v.vdocuments.read(from, end);
} break;
default: throw mtpErrorUnexpected(cons, "MTPmessages_allStickers");
@ -24586,6 +24889,7 @@ inline void MTPmessages_allStickers::write(mtpBuffer &to) const {
const MTPDmessages_allStickers &v(c_messages_allStickers());
v.vhash.write(to);
v.vpacks.write(to);
v.vsets.write(to);
v.vdocuments.write(to);
} break;
}
@ -24602,8 +24906,8 @@ inline MTPmessages_allStickers::MTPmessages_allStickers(MTPDmessages_allStickers
inline MTPmessages_allStickers MTP_messages_allStickersNotModified() {
return MTPmessages_allStickers(mtpc_messages_allStickersNotModified);
}
inline MTPmessages_allStickers MTP_messages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPDocument> &_documents) {
return MTPmessages_allStickers(new MTPDmessages_allStickers(_hash, _packs, _documents));
inline MTPmessages_allStickers MTP_messages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPStickerSet> &_sets, const MTPVector<MTPDocument> &_documents) {
return MTPmessages_allStickers(new MTPDmessages_allStickers(_hash, _packs, _sets, _documents));
}
inline MTPdisabledFeature::MTPdisabledFeature() : mtpDataOwner(new MTPDdisabledFeature()) {
@ -25199,6 +25503,140 @@ inline MTPchatInvite MTP_chatInvite(const MTPstring &_title) {
return MTPchatInvite(new MTPDchatInvite(_title));
}
inline uint32 MTPinputStickerSet::innerLength() const {
switch (_type) {
case mtpc_inputStickerSetID: {
const MTPDinputStickerSetID &v(c_inputStickerSetID());
return v.vid.innerLength() + v.vaccess_hash.innerLength();
}
case mtpc_inputStickerSetShortName: {
const MTPDinputStickerSetShortName &v(c_inputStickerSetShortName());
return v.vshort_name.innerLength();
}
}
return 0;
}
inline mtpTypeId MTPinputStickerSet::type() const {
if (!_type) throw mtpErrorUninitialized();
return _type;
}
inline void MTPinputStickerSet::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) {
if (cons != _type) setData(0);
switch (cons) {
case mtpc_inputStickerSetEmpty: _type = cons; break;
case mtpc_inputStickerSetID: _type = cons; {
if (!data) setData(new MTPDinputStickerSetID());
MTPDinputStickerSetID &v(_inputStickerSetID());
v.vid.read(from, end);
v.vaccess_hash.read(from, end);
} break;
case mtpc_inputStickerSetShortName: _type = cons; {
if (!data) setData(new MTPDinputStickerSetShortName());
MTPDinputStickerSetShortName &v(_inputStickerSetShortName());
v.vshort_name.read(from, end);
} break;
default: throw mtpErrorUnexpected(cons, "MTPinputStickerSet");
}
}
inline void MTPinputStickerSet::write(mtpBuffer &to) const {
switch (_type) {
case mtpc_inputStickerSetID: {
const MTPDinputStickerSetID &v(c_inputStickerSetID());
v.vid.write(to);
v.vaccess_hash.write(to);
} break;
case mtpc_inputStickerSetShortName: {
const MTPDinputStickerSetShortName &v(c_inputStickerSetShortName());
v.vshort_name.write(to);
} break;
}
}
inline MTPinputStickerSet::MTPinputStickerSet(mtpTypeId type) : mtpDataOwner(0), _type(type) {
switch (type) {
case mtpc_inputStickerSetEmpty: break;
case mtpc_inputStickerSetID: setData(new MTPDinputStickerSetID()); break;
case mtpc_inputStickerSetShortName: setData(new MTPDinputStickerSetShortName()); break;
default: throw mtpErrorBadTypeId(type, "MTPinputStickerSet");
}
}
inline MTPinputStickerSet::MTPinputStickerSet(MTPDinputStickerSetID *_data) : mtpDataOwner(_data), _type(mtpc_inputStickerSetID) {
}
inline MTPinputStickerSet::MTPinputStickerSet(MTPDinputStickerSetShortName *_data) : mtpDataOwner(_data), _type(mtpc_inputStickerSetShortName) {
}
inline MTPinputStickerSet MTP_inputStickerSetEmpty() {
return MTPinputStickerSet(mtpc_inputStickerSetEmpty);
}
inline MTPinputStickerSet MTP_inputStickerSetID(const MTPlong &_id, const MTPlong &_access_hash) {
return MTPinputStickerSet(new MTPDinputStickerSetID(_id, _access_hash));
}
inline MTPinputStickerSet MTP_inputStickerSetShortName(const MTPstring &_short_name) {
return MTPinputStickerSet(new MTPDinputStickerSetShortName(_short_name));
}
inline MTPstickerSet::MTPstickerSet() : mtpDataOwner(new MTPDstickerSet()) {
}
inline uint32 MTPstickerSet::innerLength() const {
const MTPDstickerSet &v(c_stickerSet());
return v.vid.innerLength() + v.vaccess_hash.innerLength() + v.vtitle.innerLength() + v.vshort_name.innerLength();
}
inline mtpTypeId MTPstickerSet::type() const {
return mtpc_stickerSet;
}
inline void MTPstickerSet::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) {
if (cons != mtpc_stickerSet) throw mtpErrorUnexpected(cons, "MTPstickerSet");
if (!data) setData(new MTPDstickerSet());
MTPDstickerSet &v(_stickerSet());
v.vid.read(from, end);
v.vaccess_hash.read(from, end);
v.vtitle.read(from, end);
v.vshort_name.read(from, end);
}
inline void MTPstickerSet::write(mtpBuffer &to) const {
const MTPDstickerSet &v(c_stickerSet());
v.vid.write(to);
v.vaccess_hash.write(to);
v.vtitle.write(to);
v.vshort_name.write(to);
}
inline MTPstickerSet::MTPstickerSet(MTPDstickerSet *_data) : mtpDataOwner(_data) {
}
inline MTPstickerSet MTP_stickerSet(const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name) {
return MTPstickerSet(new MTPDstickerSet(_id, _access_hash, _title, _short_name));
}
inline MTPmessages_stickerSet::MTPmessages_stickerSet() : mtpDataOwner(new MTPDmessages_stickerSet()) {
}
inline uint32 MTPmessages_stickerSet::innerLength() const {
const MTPDmessages_stickerSet &v(c_messages_stickerSet());
return v.vset.innerLength() + v.vpacks.innerLength() + v.vdocuments.innerLength();
}
inline mtpTypeId MTPmessages_stickerSet::type() const {
return mtpc_messages_stickerSet;
}
inline void MTPmessages_stickerSet::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) {
if (cons != mtpc_messages_stickerSet) throw mtpErrorUnexpected(cons, "MTPmessages_stickerSet");
if (!data) setData(new MTPDmessages_stickerSet());
MTPDmessages_stickerSet &v(_messages_stickerSet());
v.vset.read(from, end);
v.vpacks.read(from, end);
v.vdocuments.read(from, end);
}
inline void MTPmessages_stickerSet::write(mtpBuffer &to) const {
const MTPDmessages_stickerSet &v(c_messages_stickerSet());
v.vset.write(to);
v.vpacks.write(to);
v.vdocuments.write(to);
}
inline MTPmessages_stickerSet::MTPmessages_stickerSet(MTPDmessages_stickerSet *_data) : mtpDataOwner(_data) {
}
inline MTPmessages_stickerSet MTP_messages_stickerSet(const MTPStickerSet &_set, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPDocument> &_documents) {
return MTPmessages_stickerSet(new MTPDmessages_stickerSet(_set, _packs, _documents));
}
// Human-readable text serialization
#if (defined _DEBUG || defined _WITH_DEBUG)

View File

@ -526,7 +526,7 @@ updateUserPhone#12b9417b user_id:int phone:string = Update;
documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
documentAttributeAnimated#11b58939 = DocumentAttribute;
documentAttributeSticker#994c9882 alt:string = DocumentAttribute;
documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute;
documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute;
documentAttributeAudio#51448e5 duration:int = DocumentAttribute;
documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
@ -537,7 +537,7 @@ messages.stickers#8a8ecd32 hash:string stickers:Vector<Document> = messages.Stic
stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;
messages.allStickersNotModified#e86602c3 = messages.AllStickers;
messages.allStickers#dcef3102 hash:string packs:Vector<StickerPack> documents:Vector<Document> = messages.AllStickers;
messages.allStickers#5ce352ec hash:string packs:Vector<StickerPack> sets:Vector<StickerSet> documents:Vector<Document> = messages.AllStickers;
disabledFeature#ae636f24 feature:string description:string = DisabledFeature;
@ -588,6 +588,14 @@ messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction;
updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update;
inputStickerSetEmpty#ffb62b95 = InputStickerSet;
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
stickerSet#a7a43b17 id:long access_hash:long title:string short_name:string = StickerSet;
messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -744,4 +752,7 @@ invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;
messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite;
messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
messages.importChatInvite#6c50051c hash:string = Updates;
messages.importChatInvite#6c50051c hash:string = Updates;
messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
messages.installStickerSet#efbbfae9 stickerset:InputStickerSet = Bool;
messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;

View File

@ -558,7 +558,7 @@ void DocumentCancelLink::onClick(Qt::MouseButton button) const {
}
DocumentData::DocumentData(const DocumentId &id, const uint64 &access, int32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size) :
id(id), type(FileDocument), duration(0), access(access), date(date), mime(mime), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), openOnSaveMsgId(0), loader(0) {
id(id), type(FileDocument), duration(0), access(access), date(date), mime(mime), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), openOnSaveMsgId(0), loader(0), sticker(0) {
setattributes(attributes);
location = Local::readFileLocation(mediaKey(mtpc_inputDocumentFileLocation, dc, id));
}
@ -574,7 +574,11 @@ void DocumentData::setattributes(const QVector<MTPDocumentAttribute> &attributes
case mtpc_documentAttributeSticker: {
const MTPDdocumentAttributeSticker &d(attributes[i].c_documentAttributeSticker());
if (type == FileDocument) type = StickerDocument;
alt = qs(d.valt);
if (type == StickerDocument && !sticker) sticker = new StickerData();
if (sticker) {
sticker->alt = qs(d.valt);
sticker->set = d.vstickerset;
}
} break;
case mtpc_documentAttributeVideo: {
const MTPDdocumentAttributeVideo &d(attributes[i].c_documentAttributeVideo());

View File

@ -402,6 +402,15 @@ public:
void onClick(Qt::MouseButton button) const;
};
struct StickerData {
StickerData() : set(MTP_inputStickerSetEmpty()) {
}
ImagePtr img;
QString alt;
MTPInputStickerSet set;
};
enum DocumentType {
FileDocument,
VideoDocument,
@ -415,7 +424,7 @@ struct DocumentData {
void forget() {
thumb->forget();
sticker->forget();
if (sticker) sticker->img->forget();
replyPreview->forget();
}
@ -444,6 +453,9 @@ struct DocumentData {
loader->rpcInvalidate();
loader = 0;
}
~DocumentData() {
delete sticker;
}
QString already(bool check = false);
@ -453,7 +465,7 @@ struct DocumentData {
int32 duration;
uint64 access;
int32 date;
QString name, mime, alt; // alt - for stickers
QString name, mime;
ImagePtr thumb, replyPreview;
int32 dc;
int32 size;
@ -466,7 +478,7 @@ struct DocumentData {
FileLocation location;
QByteArray data;
ImagePtr sticker;
StickerData *sticker;
int32 md5[8];
};

View File

@ -74,6 +74,7 @@
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<Optimization>Disabled</Optimization>
<AdditionalOptions>/Zm110 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>