mirror of https://github.com/procxx/kepka.git
				
				
				
			gifs and pdfs attached by link, prepare for 0.8.54 stable version
This commit is contained in:
		
							parent
							
								
									5226bb485b
								
							
						
					
					
						commit
						84436a34b0
					
				|  | @ -526,26 +526,6 @@ namespace App { | ||||||
| 				data->left = false; | 				data->left = false; | ||||||
| 				data->forbidden = true; | 				data->forbidden = true; | ||||||
| 			} break; | 			} break; | ||||||
| 			case mtpc_geoChat: { |  | ||||||
| 				const MTPDgeoChat &d(chat.c_geoChat()); |  | ||||||
| 				data = 0; |  | ||||||
| /*				title = qs(d.vtitle);
 |  | ||||||
| 
 |  | ||||||
| 				PeerId peer(peerFromChat(d.vid.v)); |  | ||||||
| 				data = App::chat(peer); |  | ||||||
| 				data->input = MTP_inputPeerChat(d.vid); |  | ||||||
| 				data->setPhoto(d.vphoto); |  | ||||||
| 				data->date = d.vdate.v; |  | ||||||
| 				data->count = d.vparticipants_count.v; |  | ||||||
| 				data->left = false; |  | ||||||
| 				data->forbidden = false; |  | ||||||
| 				data->access = d.vaccess_hash.v; |  | ||||||
| 				if (data->version < d.vversion.v) { |  | ||||||
| 					data->version = d.vversion.v; |  | ||||||
| 					data->participants = ChatData::Participants(); |  | ||||||
| 					data->botStatus = 0; |  | ||||||
| 				}/**/ |  | ||||||
| 			} break; |  | ||||||
| 			} | 			} | ||||||
| 			if (!data) continue; | 			if (!data) continue; | ||||||
| 
 | 
 | ||||||
|  | @ -1075,11 +1055,11 @@ namespace App { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	WebPageData *feedWebPage(const MTPDwebPage &webpage, WebPageData *convert) { | 	WebPageData *feedWebPage(const MTPDwebPage &webpage, WebPageData *convert) { | ||||||
| 		return App::webPageSet(webpage.vid.v, convert, webpage.has_type() ? qs(webpage.vtype) : qsl("article"), qs(webpage.vurl), qs(webpage.vdisplay_url), webpage.has_site_name() ? qs(webpage.vsite_name) : QString(), webpage.has_title() ? qs(webpage.vtitle) : QString(), webpage.has_description() ? qs(webpage.vdescription) : QString(), webpage.has_photo() ? App::feedPhoto(webpage.vphoto) : 0, webpage.has_duration() ? webpage.vduration.v : 0, webpage.has_author() ? qs(webpage.vauthor) : QString(), 0); | 		return App::webPageSet(webpage.vid.v, convert, webpage.has_type() ? qs(webpage.vtype) : qsl("article"), qs(webpage.vurl), qs(webpage.vdisplay_url), webpage.has_site_name() ? qs(webpage.vsite_name) : QString(), webpage.has_title() ? qs(webpage.vtitle) : QString(), webpage.has_description() ? qs(webpage.vdescription) : QString(), webpage.has_photo() ? App::feedPhoto(webpage.vphoto) : 0, webpage.has_document() ? App::feedDocument(webpage.vdocument) : 0, webpage.has_duration() ? webpage.vduration.v : 0, webpage.has_author() ? qs(webpage.vauthor) : QString(), 0); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	WebPageData *feedWebPage(const MTPDwebPagePending &webpage, WebPageData *convert) { | 	WebPageData *feedWebPage(const MTPDwebPagePending &webpage, WebPageData *convert) { | ||||||
| 		return App::webPageSet(webpage.vid.v, convert, QString(), QString(), QString(), QString(), QString(), QString(), 0, 0, QString(), webpage.vdate.v); | 		return App::webPageSet(webpage.vid.v, convert, QString(), QString(), QString(), QString(), QString(), QString(), 0, 0, 0, QString(), webpage.vdate.v); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	WebPageData *feedWebPage(const MTPWebPage &webpage) { | 	WebPageData *feedWebPage(const MTPWebPage &webpage) { | ||||||
|  | @ -1433,7 +1413,7 @@ namespace App { | ||||||
| 		return i.value(); | 		return i.value(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, int32 duration, const QString &author, int32 pendingTill) { | 	WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc, int32 duration, const QString &author, int32 pendingTill) { | ||||||
| 		if (convert) { | 		if (convert) { | ||||||
| 			if (convert->id != webPage) { | 			if (convert->id != webPage) { | ||||||
| 				WebPagesData::iterator i = webPagesData.find(convert->id); | 				WebPagesData::iterator i = webPagesData.find(convert->id); | ||||||
|  | @ -1450,6 +1430,7 @@ namespace App { | ||||||
| 				convert->title = title; | 				convert->title = title; | ||||||
| 				convert->description = description; | 				convert->description = description; | ||||||
| 				convert->photo = photo; | 				convert->photo = photo; | ||||||
|  | 				convert->doc = doc; | ||||||
| 				convert->duration = duration; | 				convert->duration = duration; | ||||||
| 				convert->author = author; | 				convert->author = author; | ||||||
| 				if (convert->pendingTill > 0 && pendingTill <= 0 && api()) api()->clearWebPageRequest(convert); | 				if (convert->pendingTill > 0 && pendingTill <= 0 && api()) api()->clearWebPageRequest(convert); | ||||||
|  | @ -1463,7 +1444,7 @@ namespace App { | ||||||
| 			if (convert) { | 			if (convert) { | ||||||
| 				result = convert; | 				result = convert; | ||||||
| 			} else { | 			} else { | ||||||
| 				result = new WebPageData(webPage, toWebPageType(type), url, displayUrl, siteName, title, description, photo, duration, author, (pendingTill >= -1) ? pendingTill : -1); | 				result = new WebPageData(webPage, toWebPageType(type), url, displayUrl, siteName, title, description, photo, doc, duration, author, (pendingTill >= -1) ? pendingTill : -1); | ||||||
| 				if (pendingTill > 0 && api()) { | 				if (pendingTill > 0 && api()) { | ||||||
| 					api()->requestWebPageDelayed(result); | 					api()->requestWebPageDelayed(result); | ||||||
| 				} | 				} | ||||||
|  | @ -1480,6 +1461,7 @@ namespace App { | ||||||
| 					result->title = title; | 					result->title = title; | ||||||
| 					result->description = description; | 					result->description = description; | ||||||
| 					result->photo = photo; | 					result->photo = photo; | ||||||
|  | 					result->doc = doc; | ||||||
| 					result->duration = duration; | 					result->duration = duration; | ||||||
| 					result->author = author; | 					result->author = author; | ||||||
| 					if (result->pendingTill > 0 && pendingTill <= 0 && api()) api()->clearWebPageRequest(result); | 					if (result->pendingTill > 0 && pendingTill <= 0 && api()) api()->clearWebPageRequest(result); | ||||||
|  |  | ||||||
|  | @ -172,7 +172,7 @@ namespace App { | ||||||
| 	DocumentData *document(const DocumentId &document); | 	DocumentData *document(const DocumentId &document); | ||||||
| 	DocumentData *documentSet(const DocumentId &document, DocumentData *convert, const uint64 &access, int32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size, const StorageImageLocation &thumbLocation); | 	DocumentData *documentSet(const DocumentId &document, DocumentData *convert, const uint64 &access, int32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size, const StorageImageLocation &thumbLocation); | ||||||
| 	WebPageData *webPage(const WebPageId &webPage); | 	WebPageData *webPage(const WebPageId &webPage); | ||||||
| 	WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, int32 duration, const QString &author, int32 pendingTill); | 	WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc, int32 duration, const QString &author, int32 pendingTill); | ||||||
| 	ImageLinkData *imageLink(const QString &imageLink); | 	ImageLinkData *imageLink(const QString &imageLink); | ||||||
| 	ImageLinkData *imageLinkSet(const QString &imageLink, ImageLinkType type, const QString &url); | 	ImageLinkData *imageLinkSet(const QString &imageLink, ImageLinkType type, const QString &url); | ||||||
| 	void forgetMedia(); | 	void forgetMedia(); | ||||||
|  |  | ||||||
|  | @ -1271,6 +1271,8 @@ void CreateGroupBox::created(const MTPUpdates &updates) { | ||||||
| 	} break; | 	} break; | ||||||
| 	case mtpc_updateShortChatMessage: { | 	case mtpc_updateShortChatMessage: { | ||||||
| 	} break; | 	} break; | ||||||
|  | 	case mtpc_updateShortSentMessage: { | ||||||
|  | 	} break; | ||||||
| 	case mtpc_updatesTooLong: { | 	case mtpc_updatesTooLong: { | ||||||
| 	} break; | 	} break; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org | ||||||
| FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(v, parent), | FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(v, parent), | ||||||
| 	_ph(pholder), _oldtext(v), _phVisible(!v.length()), | 	_ph(pholder), _oldtext(v), _phVisible(!v.length()), | ||||||
|     a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c), |     a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c), | ||||||
|     _st(st), _undoAvailable(false), _redoAvailable(false), _fakeMargin(0), | 	_st(st), _undoAvailable(false), _redoAvailable(false), _inDrop(false), _fakeMargin(0), | ||||||
|     _touchPress(false), _touchRightButton(false), _touchMove(false), _replacingEmojis(false) { |     _touchPress(false), _touchRightButton(false), _touchMove(false), _replacingEmojis(false) { | ||||||
| 	setAcceptRichText(false); | 	setAcceptRichText(false); | ||||||
| 	resize(_st.width, _st.font->height); | 	resize(_st.width, _st.font->height); | ||||||
|  | @ -530,7 +530,7 @@ QStringList FlatTextarea::linksList() const { | ||||||
| 
 | 
 | ||||||
| void FlatTextarea::insertFromMimeData(const QMimeData *source) { | void FlatTextarea::insertFromMimeData(const QMimeData *source) { | ||||||
| 	QTextEdit::insertFromMimeData(source); | 	QTextEdit::insertFromMimeData(source); | ||||||
| 	emit spacedReturnedPasted(); | 	if (!_inDrop) emit spacedReturnedPasted(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void FlatTextarea::insertEmoji(EmojiPtr emoji, QTextCursor c) { | void FlatTextarea::insertEmoji(EmojiPtr emoji, QTextCursor c) { | ||||||
|  | @ -818,3 +818,10 @@ void FlatTextarea::resizeEvent(QResizeEvent *e) { | ||||||
| void FlatTextarea::mousePressEvent(QMouseEvent *e) { | void FlatTextarea::mousePressEvent(QMouseEvent *e) { | ||||||
| 	QTextEdit::mousePressEvent(e); | 	QTextEdit::mousePressEvent(e); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | void FlatTextarea::dropEvent(QDropEvent *e) { | ||||||
|  | 	_inDrop = true; | ||||||
|  | 	QTextEdit::dropEvent(e); | ||||||
|  | 	_inDrop = false; | ||||||
|  | 	emit spacedReturnedPasted(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -36,6 +36,7 @@ public: | ||||||
| 	void keyPressEvent(QKeyEvent *e); | 	void keyPressEvent(QKeyEvent *e); | ||||||
| 	void resizeEvent(QResizeEvent *e); | 	void resizeEvent(QResizeEvent *e); | ||||||
| 	void mousePressEvent(QMouseEvent *e); | 	void mousePressEvent(QMouseEvent *e); | ||||||
|  | 	void dropEvent(QDropEvent *e); | ||||||
| 
 | 
 | ||||||
| 	const QString &getLastText() const; | 	const QString &getLastText() const; | ||||||
| 	void updatePlaceholder(); | 	void updatePlaceholder(); | ||||||
|  | @ -119,7 +120,7 @@ private: | ||||||
| 	anim::cvalue a_phColor; | 	anim::cvalue a_phColor; | ||||||
| 	style::flatTextarea _st; | 	style::flatTextarea _st; | ||||||
| 
 | 
 | ||||||
| 	bool _undoAvailable, _redoAvailable; | 	bool _undoAvailable, _redoAvailable, _inDrop; | ||||||
| 
 | 
 | ||||||
| 	int32 _fakeMargin; | 	int32 _fakeMargin; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -636,7 +636,7 @@ inline bool chIsSpace(QChar ch, bool rich = false) { | ||||||
| 	return ch.isSpace() || (ch < 32 && !(rich && ch == TextCommand)) || (ch == QChar::ParagraphSeparator) || (ch == QChar::LineSeparator) || (ch == QChar::ObjectReplacementCharacter) || (ch == QChar::SoftHyphen) || (ch == QChar::CarriageReturn) || (ch == QChar::Tabulation); | 	return ch.isSpace() || (ch < 32 && !(rich && ch == TextCommand)) || (ch == QChar::ParagraphSeparator) || (ch == QChar::LineSeparator) || (ch == QChar::ObjectReplacementCharacter) || (ch == QChar::SoftHyphen) || (ch == QChar::CarriageReturn) || (ch == QChar::Tabulation); | ||||||
| } | } | ||||||
| inline bool chIsBad(QChar ch) { | inline bool chIsBad(QChar ch) { | ||||||
| 	return (ch == 0) || (ch >= 8232 && ch < 8239) || (ch >= 65024 && ch < 65040 && ch != 65039) || (ch >= 127 && ch < 160 && ch != 156); | 	return (ch == 0) || (ch >= 8232 && ch < 8237) || (ch >= 65024 && ch < 65040 && ch != 65039) || (ch >= 127 && ch < 160 && ch != 156); | ||||||
| } | } | ||||||
| inline bool chIsTrimmed(QChar ch, bool rich = false) { | inline bool chIsTrimmed(QChar ch, bool rich = false) { | ||||||
| 	return (!rich || ch != TextCommand) && (chIsSpace(ch) || chIsBad(ch)); | 	return (!rich || ch != TextCommand) && (chIsSpace(ch) || chIsBad(ch)); | ||||||
|  |  | ||||||
|  | @ -647,7 +647,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo | ||||||
| 		const QVector<MTPMessageEntity> *entities = 0; | 		const QVector<MTPMessageEntity> *entities = 0; | ||||||
| 		switch (msg.type()) { | 		switch (msg.type()) { | ||||||
| 		case mtpc_message: | 		case mtpc_message: | ||||||
| 			media = &msg.c_message().vmedia; | 			media = msg.c_message().has_media() ? (&msg.c_message().vmedia) : 0; | ||||||
| 			entities = msg.c_message().has_entities() ? (&msg.c_message().ventities.c_vector().v) : 0; | 			entities = msg.c_message().has_entities() ? (&msg.c_message().ventities.c_vector().v) : 0; | ||||||
| 		break; | 		break; | ||||||
| 		} | 		} | ||||||
|  | @ -673,7 +673,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo | ||||||
| 	case mtpc_message: { | 	case mtpc_message: { | ||||||
| 		const MTPDmessage m(msg.c_message()); | 		const MTPDmessage m(msg.c_message()); | ||||||
| 		int badMedia = 0; // 1 - unsupported, 2 - empty
 | 		int badMedia = 0; // 1 - unsupported, 2 - empty
 | ||||||
| 		switch (m.vmedia.type()) { | 		if (m.has_media()) switch (m.vmedia.type()) { | ||||||
| 		case mtpc_messageMediaEmpty: | 		case mtpc_messageMediaEmpty: | ||||||
| 		case mtpc_messageMediaContact: break; | 		case mtpc_messageMediaContact: break; | ||||||
| 		case mtpc_messageMediaGeo: | 		case mtpc_messageMediaGeo: | ||||||
|  | @ -2269,15 +2269,11 @@ HistoryVideo::HistoryVideo(const MTPDvideo &video, const QString &caption, Histo | ||||||
| 
 | 
 | ||||||
| 	int32 tw = data->thumb->width(), th = data->thumb->height(); | 	int32 tw = data->thumb->width(), th = data->thumb->height(); | ||||||
| 	if (data->thumb->isNull() || !tw || !th) { | 	if (data->thumb->isNull() || !tw || !th) { | ||||||
| 		_thumbw = _thumbx = _thumby = 0; | 		_thumbw = 0; | ||||||
| 	} else if (tw > th) { | 	} else if (tw > th) { | ||||||
| 		_thumbw = (tw * st::mediaThumbSize) / th; | 		_thumbw = (tw * st::mediaThumbSize) / th; | ||||||
| 		_thumbx = (_thumbw - st::mediaThumbSize) / 2; |  | ||||||
| 		_thumby = 0; |  | ||||||
| 	} else { | 	} else { | ||||||
| 		_thumbw = st::mediaThumbSize; | 		_thumbw = st::mediaThumbSize; | ||||||
| 		_thumbx = 0; |  | ||||||
| 		_thumby = ((th * _thumbw) / tw - st::mediaThumbSize) / 2; |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -2964,15 +2960,11 @@ HistoryDocument::HistoryDocument(DocumentData *document) : HistoryMedia() | ||||||
| 
 | 
 | ||||||
| 	int32 tw = data->thumb->width(), th = data->thumb->height(); | 	int32 tw = data->thumb->width(), th = data->thumb->height(); | ||||||
| 	if (data->thumb->isNull() || !tw || !th) { | 	if (data->thumb->isNull() || !tw || !th) { | ||||||
| 		_thumbw = _thumbx = _thumby = 0; | 		_thumbw = 0; | ||||||
| 	} else if (tw > th) { | 	} else if (tw > th) { | ||||||
| 		_thumbw = (tw * st::mediaThumbSize) / th; | 		_thumbw = (tw * st::mediaThumbSize) / th; | ||||||
| 		_thumbx = (_thumbw - st::mediaThumbSize) / 2; |  | ||||||
| 		_thumby = 0; |  | ||||||
| 	} else { | 	} else { | ||||||
| 		_thumbw = st::mediaThumbSize; | 		_thumbw = st::mediaThumbSize; | ||||||
| 		_thumbx = 0; |  | ||||||
| 		_thumby = ((th * _thumbw) / tw - st::mediaThumbSize) / 2; |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -3447,17 +3439,7 @@ HistoryMedia *HistoryDocument::clone() const { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ImagePtr HistoryDocument::replyPreview() { | ImagePtr HistoryDocument::replyPreview() { | ||||||
| 	if (data->replyPreview->isNull() && !data->thumb->isNull()) { | 	return data->makeReplyPreview(); | ||||||
| 		if (data->thumb->loaded()) { |  | ||||||
| 			int w = data->thumb->width(), h = data->thumb->height(); |  | ||||||
| 			if (w <= 0) w = 1; |  | ||||||
| 			if (h <= 0) h = 1; |  | ||||||
| 			data->replyPreview = ImagePtr(w > h ? data->thumb->pix(w * st::msgReplyBarSize.height() / h, st::msgReplyBarSize.height()) : data->thumb->pix(st::msgReplyBarSize.height()), "PNG"); |  | ||||||
| 		} else { |  | ||||||
| 			data->thumb->load(); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	return data->replyPreview; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistorySticker::HistorySticker(DocumentData *document) : HistoryMedia() | HistorySticker::HistorySticker(DocumentData *document) : HistoryMedia() | ||||||
|  | @ -3851,14 +3833,30 @@ void HistoryContact::updateFrom(const MTPMessageMedia &media) { | ||||||
| HistoryWebPage::HistoryWebPage(WebPageData *data) : HistoryMedia() | HistoryWebPage::HistoryWebPage(WebPageData *data) : HistoryMedia() | ||||||
| , data(data) | , data(data) | ||||||
| , _openl(data->url.isEmpty() ? 0 : new TextLink(data->url)) | , _openl(data->url.isEmpty() ? 0 : new TextLink(data->url)) | ||||||
| , _photol((data->photo && data->type != WebPageVideo) ? new PhotoLink(data->photo) : 0) | , _attachl((data->photo && data->type != WebPageVideo) ? static_cast<ITextLink*>(new PhotoLink(data->photo)) : static_cast<ITextLink*>(data->doc ? new DocumentOpenLink(data->doc) : 0)) | ||||||
| , _asArticle(false) | , _asArticle(false) | ||||||
| , _title(st::msgMinWidth - st::webPageLeft) | , _title(st::msgMinWidth - st::webPageLeft) | ||||||
| , _description(st::msgMinWidth - st::webPageLeft) | , _description(st::msgMinWidth - st::webPageLeft) | ||||||
| , _siteNameWidth(0) | , _siteNameWidth(0) | ||||||
|  | , _docSize(data->doc ? (data->doc->song() ? formatDurationAndSizeText(data->doc->song()->duration, data->doc->size) : formatSizeText(data->doc->size)) : QString()) | ||||||
|  | , _docName(data->doc ? documentName(data->doc) : QString()) | ||||||
| , _durationWidth(0) | , _durationWidth(0) | ||||||
|  | , _docNameWidth(data->doc ? (st::mediaFont->m.width(_docName.isEmpty() ? qsl("Document") : _docName)) : 0) | ||||||
|  | , _docDownloadDone(0) | ||||||
| , _pixw(0), _pixh(0) | , _pixw(0), _pixh(0) | ||||||
| { | { | ||||||
|  | 	if (data->doc) { | ||||||
|  | 		data->doc->thumb->load(); | ||||||
|  | 
 | ||||||
|  | 		int32 tw = data->doc->thumb->width(), th = data->doc->thumb->height(); | ||||||
|  | 		if (data->doc->thumb->isNull() || !tw || !th) { | ||||||
|  | 			_docThumbWidth = 0; | ||||||
|  | 		} else if (tw > th) { | ||||||
|  | 			_docThumbWidth = (tw * st::mediaThumbSize) / th; | ||||||
|  | 		} else { | ||||||
|  | 			_docThumbWidth = st::mediaThumbSize; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HistoryWebPage::initDimensions(const HistoryItem *parent) { | void HistoryWebPage::initDimensions(const HistoryItem *parent) { | ||||||
|  | @ -3870,7 +3868,8 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	if (!_openl && !data->url.isEmpty()) _openl = TextLinkPtr(new TextLink(data->url)); | 	if (!_openl && !data->url.isEmpty()) _openl = TextLinkPtr(new TextLink(data->url)); | ||||||
| 	if (!_photol && data->photo && data->type != WebPageVideo) _photol = TextLinkPtr(new PhotoLink(data->photo)); | 	if (!_attachl && data->photo && data->type != WebPageVideo) _attachl = TextLinkPtr(new PhotoLink(data->photo)); | ||||||
|  | 	if (!_attachl && data->doc) _attachl = TextLinkPtr(new DocumentOpenLink(data->doc)); | ||||||
| 	if (data->photo && data->type != WebPagePhoto && data->type != WebPageVideo) { | 	if (data->photo && data->type != WebPagePhoto && data->type != WebPageVideo) { | ||||||
| 		if (data->type == WebPageProfile) { | 		if (data->type == WebPageProfile) { | ||||||
| 			_asArticle = true; | 			_asArticle = true; | ||||||
|  | @ -3908,6 +3907,15 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { | ||||||
| 		_maxw = st::webPageLeft + qMax(thumbh, qMax(w, int32(st::minPhotoSize))) + parent->timeWidth(true); | 		_maxw = st::webPageLeft + qMax(thumbh, qMax(w, int32(st::minPhotoSize))) + parent->timeWidth(true); | ||||||
| 		_minh = qMax(thumbh, int32(st::minPhotoSize)); | 		_minh = qMax(thumbh, int32(st::minPhotoSize)); | ||||||
| 		_minh += st::webPagePhotoSkip; | 		_minh += st::webPagePhotoSkip; | ||||||
|  | 	} else if (data->doc) { | ||||||
|  | 		if (parent == animated.msg) { | ||||||
|  | 			_maxw = st::webPageLeft + (animated.w / cIntRetinaFactor()) + parent->timeWidth(true); | ||||||
|  | 			_minh = animated.h / cIntRetinaFactor(); | ||||||
|  | 			_minh += st::webPagePhotoSkip; | ||||||
|  | 		} else { | ||||||
|  | 			_maxw = qMax(st::webPageLeft + st::mediaThumbSize + st::mediaPadding.right() + _docNameWidth + st::mediaPadding.right(), st::mediaMaxWidth); | ||||||
|  | 			_minh = st::mediaThumbSize; | ||||||
|  | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		_maxw = st::webPageLeft; | 		_maxw = st::webPageLeft; | ||||||
| 		_minh = 0; | 		_minh = 0; | ||||||
|  | @ -3951,7 +3959,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { | ||||||
| 			_minh += qMin(_description.minHeight(), 3 * st::webPageTitleFont->height); | 			_minh += qMin(_description.minHeight(), 3 * st::webPageTitleFont->height); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if (!_asArticle && data->photo && (_siteNameWidth || !_title.isEmpty() || !_description.isEmpty())) { | 	if (!_asArticle && (data->photo || data->doc) && (_siteNameWidth || !_title.isEmpty() || !_description.isEmpty())) { | ||||||
| 		_minh += st::webPagePhotoSkip; | 		_minh += st::webPagePhotoSkip; | ||||||
| 	} | 	} | ||||||
| 	if (data->type == WebPageVideo && data->duration) { | 	if (data->type == WebPageVideo && data->duration) { | ||||||
|  | @ -3965,15 +3973,29 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected, | ||||||
| 	if (width < 0) width = w; | 	if (width < 0) width = w; | ||||||
| 	if (width < 1 || data->pendingTill) return; | 	if (width < 1 || data->pendingTill) return; | ||||||
| 
 | 
 | ||||||
| 	int32 bottomSkip = 0; | 	int16 animw = 0, animh = 0; | ||||||
| 	//if (!data->pendingTill) {
 | 	if (data->doc && animated.msg == parent) { | ||||||
| 		if (data->photo) { | 		animw = animated.w / cIntRetinaFactor(); | ||||||
| 			bottomSkip += st::webPagePhotoSkip; | 		animh = animated.h / cIntRetinaFactor(); | ||||||
| 			if (_asArticle || (st::webPageLeft + qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth(true) > width)) { | 		if (width - st::webPageLeft < animw) { | ||||||
| 				bottomSkip += (st::msgDateFont->height - st::msgDateDelta.y()); | 			animw = width - st::webPageLeft; | ||||||
| 			} | 			animh = (animw * animated.h / animated.w); | ||||||
|  | 			if (animh < 1) animh = 1; | ||||||
| 		} | 		} | ||||||
| 	//}
 | 	} | ||||||
|  | 
 | ||||||
|  | 	int32 bottomSkip = 0; | ||||||
|  | 	if (data->photo) { | ||||||
|  | 		bottomSkip += st::webPagePhotoSkip; | ||||||
|  | 		if (_asArticle || (st::webPageLeft + qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth(true) > width)) { | ||||||
|  | 			bottomSkip += (st::msgDateFont->height - st::msgDateDelta.y()); | ||||||
|  | 		} | ||||||
|  | 	} else if (data->doc && animated.msg == parent) { | ||||||
|  | 		bottomSkip += st::webPagePhotoSkip; | ||||||
|  | 		if (st::webPageLeft + qMax(animw, int16(st::minPhotoSize)) + parent->timeWidth(true) > width) { | ||||||
|  | 			bottomSkip += (st::msgDateFont->height - st::msgDateDelta.y()); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	style::color bar = (selected ? (parent->out() ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (parent->out() ? st::msgOutReplyBarColor : st::msgInReplyBarColor)); | 	style::color bar = (selected ? (parent->out() ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (parent->out() ? st::msgOutReplyBarColor : st::msgInReplyBarColor)); | ||||||
| 	style::color semibold = (selected ? (parent->out() ? st::msgOutServiceSelColor : st::msgInServiceSelColor) : (parent->out() ? st::msgOutServiceColor : st::msgInServiceColor)); | 	style::color semibold = (selected ? (parent->out() ? st::msgOutServiceSelColor : st::msgInServiceSelColor) : (parent->out() ? st::msgOutServiceColor : st::msgInServiceColor)); | ||||||
|  | @ -4115,6 +4137,100 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected, | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		p.translate(0, pixheight); | 		p.translate(0, pixheight); | ||||||
|  | 	} else if (!_asArticle && data->doc) { | ||||||
|  | 		if (_siteNameWidth || !_title.isEmpty() || !_description.isEmpty()) { | ||||||
|  | 			p.translate(0, st::webPagePhotoSkip); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		if (parent == animated.msg) { | ||||||
|  | 			p.drawPixmap(0, 0, animated.current(animw * cIntRetinaFactor(), animh * cIntRetinaFactor(), true)); | ||||||
|  | 			if (selected) { | ||||||
|  | 				App::roundRect(p, 0, 0, animw, animh, textstyleCurrent()->selectOverlay, SelectedOverlayCorners); | ||||||
|  | 			} | ||||||
|  | 		} else { | ||||||
|  | 			QString statusText; | ||||||
|  | 			if (data->doc->song()) { | ||||||
|  | 				SongMsgId playing; | ||||||
|  | 				AudioPlayerState playingState = AudioPlayerStopped; | ||||||
|  | 				int64 playingPosition = 0, playingDuration = 0; | ||||||
|  | 				int32 playingFrequency = 0; | ||||||
|  | 				if (audioPlayer()) { | ||||||
|  | 					audioPlayer()->currentState(&playing, &playingState, &playingPosition, &playingDuration, &playingFrequency); | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				bool already = !data->doc->already().isEmpty(), hasdata = !data->doc->data.isEmpty(); | ||||||
|  | 				QRect img; | ||||||
|  | 				if (data->doc->status == FileFailed) { | ||||||
|  | 					statusText = lang(lng_attach_failed); | ||||||
|  | 					img = parent->out() ? st::mediaMusicOutImg : st::mediaMusicInImg; | ||||||
|  | 				} else if (already || hasdata) { | ||||||
|  | 					bool showPause = false; | ||||||
|  | 					if (playing.msgId == parent->id && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { | ||||||
|  | 						statusText = formatDurationText(playingPosition / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)) + qsl(" / ") + formatDurationText(playingDuration / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)); | ||||||
|  | 						showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting); | ||||||
|  | 					} else { | ||||||
|  | 						statusText = formatDurationText(data->doc->song()->duration); | ||||||
|  | 					} | ||||||
|  | 					if (!showPause && playing.msgId == parent->id && App::main() && App::main()->player()->seekingSong(playing)) showPause = true; | ||||||
|  | 					img = parent->out() ? (showPause ? st::mediaPauseOutImg : st::mediaPlayOutImg) : (showPause ? st::mediaPauseInImg : st::mediaPlayInImg); | ||||||
|  | 				} else { | ||||||
|  | 					if (data->doc->loader) { | ||||||
|  | 						int32 offset = data->doc->loader->currentOffset(); | ||||||
|  | 						if (_docDownloadTextCache.isEmpty() || _docDownloadDone != offset) { | ||||||
|  | 							_docDownloadDone = offset; | ||||||
|  | 							_docDownloadTextCache = formatDownloadText(_docDownloadDone, data->doc->size); | ||||||
|  | 						} | ||||||
|  | 						statusText = _docDownloadTextCache; | ||||||
|  | 					} else { | ||||||
|  | 						statusText = _docSize; | ||||||
|  | 					} | ||||||
|  | 					img = parent->out() ? st::mediaMusicOutImg : st::mediaMusicInImg; | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				p.drawPixmap(QPoint(0, 0), App::sprite(), img); | ||||||
|  | 			} else { | ||||||
|  | 				if (data->doc->status == FileFailed) { | ||||||
|  | 					statusText = lang(lng_attach_failed); | ||||||
|  | 				} else if (data->doc->loader) { | ||||||
|  | 					int32 offset = data->doc->loader->currentOffset(); | ||||||
|  | 					if (_docDownloadTextCache.isEmpty() || _docDownloadDone != offset) { | ||||||
|  | 						_docDownloadDone = offset; | ||||||
|  | 						_docDownloadTextCache = formatDownloadText(_docDownloadDone, data->doc->size); | ||||||
|  | 					} | ||||||
|  | 					statusText = _docDownloadTextCache; | ||||||
|  | 				} else { | ||||||
|  | 					statusText = _docSize; | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				if (_docThumbWidth) { | ||||||
|  | 					data->doc->thumb->checkload(); | ||||||
|  | 					p.drawPixmap(QPoint(0, 0), data->doc->thumb->pixSingle(_docThumbWidth, 0, st::mediaThumbSize, st::mediaThumbSize)); | ||||||
|  | 				} else { | ||||||
|  | 					p.drawPixmap(QPoint(0, 0), App::sprite(), (parent->out() ? st::mediaDocOutImg : st::mediaDocInImg)); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			if (selected) { | ||||||
|  | 				App::roundRect(p, 0, 0, st::mediaThumbSize, st::mediaThumbSize, textstyleCurrent()->selectOverlay, SelectedOverlayCorners); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); | ||||||
|  | 			int32 twidth = width - tleft - st::mediaPadding.right(); | ||||||
|  | 			int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right(); | ||||||
|  | 			int32 secondwidth = width - tleft - fullTimeWidth; | ||||||
|  | 
 | ||||||
|  | 			p.setFont(st::mediaFont->f); | ||||||
|  | 			p.setPen(st::black->c); | ||||||
|  | 			if (twidth < _docNameWidth) { | ||||||
|  | 				p.drawText(tleft, st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->m.elidedText(_docName, Qt::ElideRight, twidth)); | ||||||
|  | 			} else { | ||||||
|  | 				p.drawText(tleft, st::mediaNameTop + st::mediaFont->ascent, _docName); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			style::color status(selected ? (parent->out() ? st::mediaOutSelectColor : st::mediaInSelectColor) : (parent->out() ? st::mediaOutColor : st::mediaInColor)); | ||||||
|  | 			p.setPen(status->p); | ||||||
|  | 
 | ||||||
|  | 			p.drawText(tleft, st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->descent, statusText); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	p.restore(); | 	p.restore(); | ||||||
|  | @ -4147,7 +4263,7 @@ int32 HistoryWebPage::resize(int32 width, bool dontRecountText, const HistoryIte | ||||||
| 		_height = st::webPagePhotoSize; | 		_height = st::webPagePhotoSize; | ||||||
| 		_height += st::webPagePhotoSkip + (st::msgDateFont->height - st::msgDateDelta.y()); | 		_height += st::webPagePhotoSkip + (st::msgDateFont->height - st::msgDateDelta.y()); | ||||||
| 	} else if (data->photo) { | 	} else if (data->photo) { | ||||||
| 		_pixw = qMin(width, int32(_maxw - st::webPageLeft)); | 		_pixw = qMin(width, int32(_maxw - st::webPageLeft - parent->timeWidth(true))); | ||||||
| 
 | 
 | ||||||
| 		int32 tw = convertScale(data->photo->full->width()), th = convertScale(data->photo->full->height()); | 		int32 tw = convertScale(data->photo->full->width()), th = convertScale(data->photo->full->height()); | ||||||
| 		if (tw > st::maxMediaSize) { | 		if (tw > st::maxMediaSize) { | ||||||
|  | @ -4175,6 +4291,24 @@ int32 HistoryWebPage::resize(int32 width, bool dontRecountText, const HistoryIte | ||||||
| 		if (qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth(true) > width) { | 		if (qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth(true) > width) { | ||||||
| 			_height += (st::msgDateFont->height - st::msgDateDelta.y()); | 			_height += (st::msgDateFont->height - st::msgDateDelta.y()); | ||||||
| 		} | 		} | ||||||
|  | 	} else if (data->doc) { | ||||||
|  | 		if (parent == animated.msg) { | ||||||
|  | 			int32 w = qMin(width, int32(animated.w / cIntRetinaFactor())); | ||||||
|  | 			if (w > st::maxMediaSize) { | ||||||
|  | 				w = st::maxMediaSize; | ||||||
|  | 			} | ||||||
|  | 			_height = animated.h / cIntRetinaFactor(); | ||||||
|  | 			if (animated.w / cIntRetinaFactor() > w) { | ||||||
|  | 				_height = (w * _height / (animated.w / cIntRetinaFactor())); | ||||||
|  | 				if (_height <= 0) _height = 1; | ||||||
|  | 			} | ||||||
|  | 			_height += st::webPagePhotoSkip; | ||||||
|  | 			if (w + parent->timeWidth(true) > width) { | ||||||
|  | 				_height += (st::msgDateFont->height - st::msgDateDelta.y()); | ||||||
|  | 			} | ||||||
|  | 		} else { | ||||||
|  | 			_height = st::mediaThumbSize; | ||||||
|  | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		_height = 0; | 		_height = 0; | ||||||
| 	} | 	} | ||||||
|  | @ -4189,7 +4323,7 @@ int32 HistoryWebPage::resize(int32 width, bool dontRecountText, const HistoryIte | ||||||
| 		if (!_description.isEmpty()) { | 		if (!_description.isEmpty()) { | ||||||
| 			_height += qMin(_description.countHeight(width), st::webPageDescriptionFont->height * 3); | 			_height += qMin(_description.countHeight(width), st::webPageDescriptionFont->height * 3); | ||||||
| 		} | 		} | ||||||
| 		if (data->photo && (_siteNameWidth || !_title.isEmpty() || !_description.isEmpty())) { | 		if ((data->photo || data->doc) && (_siteNameWidth || !_title.isEmpty() || !_description.isEmpty())) { | ||||||
| 			_height += st::webPagePhotoSkip; | 			_height += st::webPagePhotoSkip; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | @ -4199,10 +4333,12 @@ int32 HistoryWebPage::resize(int32 width, bool dontRecountText, const HistoryIte | ||||||
| 
 | 
 | ||||||
| void HistoryWebPage::regItem(HistoryItem *item) { | void HistoryWebPage::regItem(HistoryItem *item) { | ||||||
| 	App::regWebPageItem(data, item); | 	App::regWebPageItem(data, item); | ||||||
|  | 	if (data->doc) App::regDocumentItem(data->doc, item); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HistoryWebPage::unregItem(HistoryItem *item) { | void HistoryWebPage::unregItem(HistoryItem *item) { | ||||||
| 	App::unregWebPageItem(data, item); | 	App::unregWebPageItem(data, item); | ||||||
|  | 	if (data->doc) App::unregDocumentItem(data->doc, item); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const QString HistoryWebPage::inDialogsText() const { | const QString HistoryWebPage::inDialogsText() const { | ||||||
|  | @ -4274,10 +4410,20 @@ void HistoryWebPage::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 | ||||||
| 		y -= st::webPagePhotoSkip; | 		y -= st::webPagePhotoSkip; | ||||||
| 	} | 	} | ||||||
| 	if (!_asArticle) { | 	if (!_asArticle) { | ||||||
| 		int32 pixwidth = qMax(_pixw, int16(st::minPhotoSize)), pixheight = qMax(_pixh, int16(st::minPhotoSize)); | 		if (data->doc && parent == animated.msg) { | ||||||
| 		if (x >= 0 && y >= 0 && x < pixwidth && y < pixheight) { | 			int32 h = (width == w) ? _height : (width * animated.h / animated.w); | ||||||
| 			lnk = _photol ? _photol : _openl; | 			if (h < 1) h = 1; | ||||||
| 			return; | 			if (x >= 0 && y >= 0 && x < width && y < h) { | ||||||
|  | 				lnk = _attachl; | ||||||
|  | 				return; | ||||||
|  | 			} | ||||||
|  | 		} else { | ||||||
|  | 			int32 attachwidth = data->doc ? (width - st::mediaPadding.right()) : qMax(_pixw, int16(st::minPhotoSize)); | ||||||
|  | 			int32 attachheight = data->doc ? st::mediaThumbSize : qMax(_pixh, int16(st::minPhotoSize)); | ||||||
|  | 			if (x >= 0 && y >= 0 && x < attachwidth && y < attachheight) { | ||||||
|  | 				lnk = _attachl ? _attachl : _openl; | ||||||
|  | 				return; | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -4287,7 +4433,7 @@ HistoryMedia *HistoryWebPage::clone() const { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ImagePtr HistoryWebPage::replyPreview() { | ImagePtr HistoryWebPage::replyPreview() { | ||||||
| 	return data->photo ? data->photo->makeReplyPreview() : ImagePtr(); | 	return data->photo ? data->photo->makeReplyPreview() : (data->doc ? data->doc->makeReplyPreview() : ImagePtr()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| namespace { | namespace { | ||||||
|  | @ -5036,11 +5182,11 @@ HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, const MTPD | ||||||
| 	//if (msg.has_entities()) msg.ventities.c_vector().v.size()
 | 	//if (msg.has_entities()) msg.ventities.c_vector().v.size()
 | ||||||
| 	QString text(textClean(qs(msg.vmessage))); | 	QString text(textClean(qs(msg.vmessage))); | ||||||
| 	initTime(); | 	initTime(); | ||||||
| 	initMedia(msg.vmedia, text); | 	initMedia(msg.has_media() ? (&msg.vmedia) : 0, text); | ||||||
| 	setText(text, msg.has_entities() ? linksFromMTP(msg.ventities.c_vector().v) : LinksInText()); | 	setText(text, msg.has_entities() ? linksFromMTP(msg.ventities.c_vector().v) : LinksInText()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, const LinksInText &links, const MTPMessageMedia &media) : | HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, const LinksInText &links, const MTPMessageMedia *media) : | ||||||
| HistoryItem(history, block, msgId, flags, date, from) | HistoryItem(history, block, msgId, flags, date, from) | ||||||
| , _text(st::msgMinWidth) | , _text(st::msgMinWidth) | ||||||
| , _textWidth(0) | , _textWidth(0) | ||||||
|  | @ -5085,53 +5231,53 @@ void HistoryMessage::initTime() { | ||||||
| 	_timeWidth = st::msgDateFont->m.width(_time); | 	_timeWidth = st::msgDateFont->m.width(_time); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HistoryMessage::initMedia(const MTPMessageMedia &media, QString ¤tText) { | void HistoryMessage::initMedia(const MTPMessageMedia *media, QString ¤tText) { | ||||||
| 	switch (media.type()) { | 	switch (media ? media->type() : mtpc_messageMediaEmpty) { | ||||||
| 	case mtpc_messageMediaContact: { | 	case mtpc_messageMediaContact: { | ||||||
| 		const MTPDmessageMediaContact &d(media.c_messageMediaContact()); | 		const MTPDmessageMediaContact &d(media->c_messageMediaContact()); | ||||||
| 		_media = new HistoryContact(d.vuser_id.v, qs(d.vfirst_name), qs(d.vlast_name), qs(d.vphone_number)); | 		_media = new HistoryContact(d.vuser_id.v, qs(d.vfirst_name), qs(d.vlast_name), qs(d.vphone_number)); | ||||||
| 	} break; | 	} break; | ||||||
| 	case mtpc_messageMediaGeo: { | 	case mtpc_messageMediaGeo: { | ||||||
| 		const MTPGeoPoint &point(media.c_messageMediaGeo().vgeo); | 		const MTPGeoPoint &point(media->c_messageMediaGeo().vgeo); | ||||||
| 		if (point.type() == mtpc_geoPoint) { | 		if (point.type() == mtpc_geoPoint) { | ||||||
| 			const MTPDgeoPoint &d(point.c_geoPoint()); | 			const MTPDgeoPoint &d(point.c_geoPoint()); | ||||||
| 			_media = new HistoryImageLink(qsl("location:%1,%2").arg(d.vlat.v).arg(d.vlong.v)); | 			_media = new HistoryImageLink(qsl("location:%1,%2").arg(d.vlat.v).arg(d.vlong.v)); | ||||||
| 		} | 		} | ||||||
| 	} break; | 	} break; | ||||||
| 	case mtpc_messageMediaVenue: { | 	case mtpc_messageMediaVenue: { | ||||||
| 		const MTPDmessageMediaVenue &d(media.c_messageMediaVenue()); | 		const MTPDmessageMediaVenue &d(media->c_messageMediaVenue()); | ||||||
| 		if (d.vgeo.type() == mtpc_geoPoint) { | 		if (d.vgeo.type() == mtpc_geoPoint) { | ||||||
| 			const MTPDgeoPoint &g(d.vgeo.c_geoPoint()); | 			const MTPDgeoPoint &g(d.vgeo.c_geoPoint()); | ||||||
| 			_media = new HistoryImageLink(qsl("location:%1,%2").arg(g.vlat.v).arg(g.vlong.v), qs(d.vtitle), qs(d.vaddress)); | 			_media = new HistoryImageLink(qsl("location:%1,%2").arg(g.vlat.v).arg(g.vlong.v), qs(d.vtitle), qs(d.vaddress)); | ||||||
| 		} | 		} | ||||||
| 	} break; | 	} break; | ||||||
| 	case mtpc_messageMediaPhoto: { | 	case mtpc_messageMediaPhoto: { | ||||||
| 		const MTPDmessageMediaPhoto &photo(media.c_messageMediaPhoto()); | 		const MTPDmessageMediaPhoto &photo(media->c_messageMediaPhoto()); | ||||||
| 		if (photo.vphoto.type() == mtpc_photo) { | 		if (photo.vphoto.type() == mtpc_photo) { | ||||||
| 			_media = new HistoryPhoto(photo.vphoto.c_photo(), qs(photo.vcaption), this); | 			_media = new HistoryPhoto(photo.vphoto.c_photo(), qs(photo.vcaption), this); | ||||||
| 		} | 		} | ||||||
| 	} break; | 	} break; | ||||||
| 	case mtpc_messageMediaVideo: { | 	case mtpc_messageMediaVideo: { | ||||||
| 		const MTPDmessageMediaVideo &video(media.c_messageMediaVideo()); | 		const MTPDmessageMediaVideo &video(media->c_messageMediaVideo()); | ||||||
| 		if (video.vvideo.type() == mtpc_video) { | 		if (video.vvideo.type() == mtpc_video) { | ||||||
| 			_media = new HistoryVideo(video.vvideo.c_video(), qs(video.vcaption), this); | 			_media = new HistoryVideo(video.vvideo.c_video(), qs(video.vcaption), this); | ||||||
| 		} | 		} | ||||||
| 	} break; | 	} break; | ||||||
| 	case mtpc_messageMediaAudio: { | 	case mtpc_messageMediaAudio: { | ||||||
| 		const MTPAudio &audio(media.c_messageMediaAudio().vaudio); | 		const MTPAudio &audio(media->c_messageMediaAudio().vaudio); | ||||||
| 		if (audio.type() == mtpc_audio) { | 		if (audio.type() == mtpc_audio) { | ||||||
| 			_media = new HistoryAudio(audio.c_audio()); | 			_media = new HistoryAudio(audio.c_audio()); | ||||||
| 		} | 		} | ||||||
| 	} break; | 	} break; | ||||||
| 	case mtpc_messageMediaDocument: { | 	case mtpc_messageMediaDocument: { | ||||||
| 		const MTPDocument &document(media.c_messageMediaDocument().vdocument); | 		const MTPDocument &document(media->c_messageMediaDocument().vdocument); | ||||||
| 		if (document.type() == mtpc_document) { | 		if (document.type() == mtpc_document) { | ||||||
| 			DocumentData *doc = App::feedDocument(document); | 			DocumentData *doc = App::feedDocument(document); | ||||||
| 			return initMediaFromDocument(doc); | 			return initMediaFromDocument(doc); | ||||||
| 		} | 		} | ||||||
| 	} break; | 	} break; | ||||||
| 	case mtpc_messageMediaWebPage: { | 	case mtpc_messageMediaWebPage: { | ||||||
| 		const MTPWebPage &d(media.c_messageMediaWebPage().vwebpage); | 		const MTPWebPage &d(media->c_messageMediaWebPage().vwebpage); | ||||||
| 		switch (d.type()) { | 		switch (d.type()) { | ||||||
| 		case mtpc_webPageEmpty: initMediaFromText(currentText); break; | 		case mtpc_webPageEmpty: initMediaFromText(currentText); break; | ||||||
| 		case mtpc_webPagePending: { | 		case mtpc_webPagePending: { | ||||||
|  | @ -5228,8 +5374,8 @@ HistoryMedia *HistoryMessage::getMedia(bool inOverview) const { | ||||||
| 	return _media; | 	return _media; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HistoryMessage::setMedia(const MTPmessageMedia &media) { | void HistoryMessage::setMedia(const MTPMessageMedia *media) { | ||||||
| 	if ((!_media || _media->isImageLink()) && media.type() == mtpc_messageMediaEmpty) return; | 	if ((!_media || _media->isImageLink()) && (!media || media->type() == mtpc_messageMediaEmpty)) return; | ||||||
| 
 | 
 | ||||||
| 	bool mediaWasDisplayed = false; | 	bool mediaWasDisplayed = false; | ||||||
| 	if (_media) { | 	if (_media) { | ||||||
|  | @ -5589,7 +5735,7 @@ HistoryMessage::~HistoryMessage() { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessage &msg) : HistoryMessage(history, block, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.has_entities() ? linksFromMTP(msg.ventities.c_vector().v) : LinksInText(), msg.vmedia) | HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessage &msg) : HistoryMessage(history, block, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.has_entities() ? linksFromMTP(msg.ventities.c_vector().v) : LinksInText(), msg.has_media() ? (&msg.vmedia) : 0) | ||||||
| , fwdDate(::date(msg.vfwd_date)) | , fwdDate(::date(msg.vfwd_date)) | ||||||
| , fwdFrom(App::user(msg.vfwd_from_id.v)) | , fwdFrom(App::user(msg.vfwd_from_id.v)) | ||||||
| , fwdFromVersion(fwdFrom->nameVersion) | , fwdFromVersion(fwdFrom->nameVersion) | ||||||
|  | @ -5785,7 +5931,7 @@ void HistoryForwarded::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 | ||||||
| 	return HistoryMessage::getSymbol(symbol, after, upon, x, y); | 	return HistoryMessage::getSymbol(symbol, after, upon, x, y); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryReply::HistoryReply(History *history, HistoryBlock *block, const MTPDmessage &msg) : HistoryMessage(history, block, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.has_entities() ? linksFromMTP(msg.ventities.c_vector().v) : LinksInText(), msg.vmedia) | HistoryReply::HistoryReply(History *history, HistoryBlock *block, const MTPDmessage &msg) : HistoryMessage(history, block, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.has_entities() ? linksFromMTP(msg.ventities.c_vector().v) : LinksInText(), msg.has_media() ? (&msg.vmedia) : 0) | ||||||
| , replyToMsgId(msg.vreply_to_msg_id.v) | , replyToMsgId(msg.vreply_to_msg_id.v) | ||||||
| , replyToMsg(0) | , replyToMsg(0) | ||||||
| , replyToVersion(0) | , replyToVersion(0) | ||||||
|  |  | ||||||
|  | @ -780,7 +780,7 @@ public: | ||||||
| 	virtual HistoryMedia *getMedia(bool inOverview = false) const { | 	virtual HistoryMedia *getMedia(bool inOverview = false) const { | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 	virtual void setMedia(const MTPmessageMedia &media) { | 	virtual void setMedia(const MTPMessageMedia *media) { | ||||||
| 	} | 	} | ||||||
| 	virtual void setText(const QString &text, const LinksInText &links) { | 	virtual void setText(const QString &text, const LinksInText &links) { | ||||||
| 	} | 	} | ||||||
|  | @ -1000,7 +1000,7 @@ private: | ||||||
| 	Text _caption; | 	Text _caption; | ||||||
| 
 | 
 | ||||||
| 	QString _size; | 	QString _size; | ||||||
| 	int32 _thumbw, _thumbx, _thumby; | 	int32 _thumbw; | ||||||
| 
 | 
 | ||||||
| 	mutable QString _dldTextCache, _uplTextCache; | 	mutable QString _dldTextCache, _uplTextCache; | ||||||
| 	mutable int32 _dldDone, _uplDone; | 	mutable int32 _dldDone, _uplDone; | ||||||
|  | @ -1191,14 +1191,16 @@ public: | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
| 	WebPageData *data; | 	WebPageData *data; | ||||||
| 	TextLinkPtr _openl, _photol; | 	TextLinkPtr _openl, _attachl; | ||||||
| 	bool _asArticle; | 	bool _asArticle; | ||||||
| 
 | 
 | ||||||
| 	Text _title, _description; | 	Text _title, _description; | ||||||
| 	int32 _siteNameWidth; | 	int32 _siteNameWidth; | ||||||
| 
 | 
 | ||||||
| 	QString _duration; | 	QString _duration, _docName, _docSize; | ||||||
| 	int32 _durationWidth; | 	int32 _durationWidth, _docNameWidth, _docThumbWidth; | ||||||
|  | 	mutable QString _docDownloadTextCache; | ||||||
|  | 	mutable int32 _docDownloadDone; | ||||||
| 
 | 
 | ||||||
| 	int16 _pixw, _pixh; | 	int16 _pixw, _pixh; | ||||||
| }; | }; | ||||||
|  | @ -1289,12 +1291,12 @@ class HistoryMessage : public HistoryItem { | ||||||
| public: | public: | ||||||
| 
 | 
 | ||||||
| 	HistoryMessage(History *history, HistoryBlock *block, const MTPDmessage &msg); | 	HistoryMessage(History *history, HistoryBlock *block, const MTPDmessage &msg); | ||||||
| 	HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, const LinksInText &links, const MTPMessageMedia &media); | 	HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, const LinksInText &links, const MTPMessageMedia *media); | ||||||
| 	HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, const LinksInText &links, HistoryMedia *media); | 	HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, const LinksInText &links, HistoryMedia *media); | ||||||
| 	HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, DocumentData *doc); | 	HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, DocumentData *doc); | ||||||
| 
 | 
 | ||||||
| 	void initTime(); | 	void initTime(); | ||||||
| 	void initMedia(const MTPMessageMedia &media, QString ¤tText); | 	void initMedia(const MTPMessageMedia *media, QString ¤tText); | ||||||
| 	void initMediaFromText(QString ¤tText); | 	void initMediaFromText(QString ¤tText); | ||||||
| 	void initMediaFromDocument(DocumentData *doc); | 	void initMediaFromDocument(DocumentData *doc); | ||||||
| 	void initDimensions(const HistoryItem *parent = 0); | 	void initDimensions(const HistoryItem *parent = 0); | ||||||
|  | @ -1334,7 +1336,7 @@ public: | ||||||
| 	LinksInText textLinks() const; | 	LinksInText textLinks() const; | ||||||
| 	QString inDialogsText() const; | 	QString inDialogsText() const; | ||||||
| 	HistoryMedia *getMedia(bool inOverview = false) const; | 	HistoryMedia *getMedia(bool inOverview = false) const; | ||||||
| 	void setMedia(const MTPmessageMedia &media); | 	void setMedia(const MTPMessageMedia *media); | ||||||
| 	void setText(const QString &text, const LinksInText &links); | 	void setText(const QString &text, const LinksInText &links); | ||||||
| 	void getTextWithLinks(QString &text, LinksInText &links); | 	void getTextWithLinks(QString &text, LinksInText &links); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5114,18 +5114,25 @@ void HistoryWidget::updatePreview() { | ||||||
| 				if (_previewData->title.isEmpty()) { | 				if (_previewData->title.isEmpty()) { | ||||||
| 					if (_previewData->description.isEmpty()) { | 					if (_previewData->description.isEmpty()) { | ||||||
| 						title = _previewData->author; | 						title = _previewData->author; | ||||||
| 						desc = _previewData->url; | 						desc = ((_previewData->doc && !_previewData->doc->name.isEmpty()) ? _previewData->doc->name : _previewData->url); | ||||||
| 					} else { | 					} else { | ||||||
| 						title = _previewData->description; | 						title = _previewData->description; | ||||||
| 						desc = _previewData->author.isEmpty() ? _previewData->url : _previewData->author; | 						desc = _previewData->author.isEmpty() ? ((_previewData->doc && !_previewData->doc->name.isEmpty()) ? _previewData->doc->name : _previewData->url) : _previewData->author; | ||||||
| 					} | 					} | ||||||
| 				} else { | 				} else { | ||||||
| 					title = _previewData->title; | 					title = _previewData->title; | ||||||
| 					desc = _previewData->description.isEmpty() ? (_previewData->author.isEmpty() ? _previewData->url : _previewData->author) : _previewData->description; | 					desc = _previewData->description.isEmpty() ? (_previewData->author.isEmpty() ? ((_previewData->doc && !_previewData->doc->name.isEmpty()) ? _previewData->doc->name : _previewData->url) : _previewData->author) : _previewData->description; | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				title = _previewData->siteName; | 				title = _previewData->siteName; | ||||||
| 				desc = _previewData->title.isEmpty() ? (_previewData->description.isEmpty() ? (_previewData->author.isEmpty() ? _previewData->url : _previewData->author) : _previewData->description) : _previewData->title; | 				desc = _previewData->title.isEmpty() ? (_previewData->description.isEmpty() ? (_previewData->author.isEmpty() ? ((_previewData->doc && !_previewData->doc->name.isEmpty()) ? _previewData->doc->name : _previewData->url) : _previewData->author) : _previewData->description) : _previewData->title; | ||||||
|  | 			} | ||||||
|  | 			if (title.isEmpty()) { | ||||||
|  | 				if (_previewData->photo) { | ||||||
|  | 					title = lang(lng_attach_photo); | ||||||
|  | 				} else if (_previewData->doc) { | ||||||
|  | 					title = lang(lng_attach_file); | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 			_previewTitle.setText(st::msgServiceNameFont, title, _textNameOptions); | 			_previewTitle.setText(st::msgServiceNameFont, title, _textNameOptions); | ||||||
| 			_previewDescription.setText(st::msgFont, desc, _textDlgOptions); | 			_previewDescription.setText(st::msgFont, desc, _textDlgOptions); | ||||||
|  | @ -5407,8 +5414,8 @@ void HistoryWidget::drawField(Painter &p) { | ||||||
| 	if (drawPreview) { | 	if (drawPreview) { | ||||||
| 		int32 previewLeft = st::replySkip + st::webPageLeft; | 		int32 previewLeft = st::replySkip + st::webPageLeft; | ||||||
| 		p.fillRect(st::replySkip, backy + st::msgReplyPadding.top(), st::webPageBar, st::msgReplyBarSize.height(), st::msgInReplyBarColor->b); | 		p.fillRect(st::replySkip, backy + st::msgReplyPadding.top(), st::webPageBar, st::msgReplyBarSize.height(), st::msgInReplyBarColor->b); | ||||||
| 		if (_previewData->photo && !_previewData->photo->thumb->isNull()) { | 		if ((_previewData->photo && !_previewData->photo->thumb->isNull()) || (_previewData->doc && !_previewData->doc->thumb->isNull())) { | ||||||
| 			ImagePtr replyPreview = _previewData->photo->makeReplyPreview(); | 			ImagePtr replyPreview = _previewData->photo ? _previewData->photo->makeReplyPreview() : _previewData->doc->makeReplyPreview(); | ||||||
| 			if (!replyPreview->isNull()) { | 			if (!replyPreview->isNull()) { | ||||||
| 				QRect to(previewLeft, backy + st::msgReplyPadding.top(), st::msgReplyBarSize.height(), st::msgReplyBarSize.height()); | 				QRect to(previewLeft, backy + st::msgReplyPadding.top(), st::msgReplyBarSize.height(), st::msgReplyBarSize.height()); | ||||||
| 				if (replyPreview->width() == replyPreview->height()) { | 				if (replyPreview->width() == replyPreview->height()) { | ||||||
|  |  | ||||||
|  | @ -982,9 +982,59 @@ DialogsIndexed &MainWidget::dialogsList() { | ||||||
| 	return dialogs.dialogsList(); | 	return dialogs.dialogsList(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | inline bool replaceCharBySpace(ushort code) { | ||||||
|  | 	// \xe2\x80[\xa8 - \xac\xad] // 8232 - 8237
 | ||||||
|  | 	// QString from1 = QString::fromUtf8("\xe2\x80\xa8"), to1 = QString::fromUtf8("\xe2\x80\xad");
 | ||||||
|  | 	// \xcc[\xb3\xbf\x8a] // 819, 831, 778
 | ||||||
|  | 	// QString bad1 = QString::fromUtf8("\xcc\xb3"), bad2 = QString::fromUtf8("\xcc\xbf"), bad3 = QString::fromUtf8("\xcc\x8a");
 | ||||||
|  | 	// [\x00\x01\x02\x07\x08\x0b-\x1f] // '\t' = 0x09
 | ||||||
|  | 	return (code >= 0x00 && code <= 0x02) || (code >= 0x07 && code <= 0x09) || (code >= 0x0b && code <= 0x1f) || | ||||||
|  | 		(code == 819) || (code == 831) || (code == 778) || (code >= 8232 && code <= 8237); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| QString cleanMessage(const QString &text) { | QString cleanMessage(const QString &text) { | ||||||
| 	QString result = text.trimmed(); | 	QString result = text; | ||||||
| 	// clean bad symbols
 | 	QChar *_start = result.data(), *_end = _start + result.size(), *start = _start, *end = _end, *ch = start, *copy = 0; | ||||||
|  | 	for (; ch != end; ++ch) { | ||||||
|  | 		if (ch->unicode() == '\r') { | ||||||
|  | 			copy = ch + 1; | ||||||
|  | 			break; | ||||||
|  | 		} else if (replaceCharBySpace(ch->unicode())) { | ||||||
|  | 			*ch = ' '; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	if (copy) { | ||||||
|  | 		for (; copy != end; ++copy) { | ||||||
|  | 			if (copy->unicode() == '\r') { | ||||||
|  | 				continue; | ||||||
|  | 			} else if (replaceCharBySpace(copy->unicode())) { | ||||||
|  | 				*ch++ = ' '; | ||||||
|  | 			} else { | ||||||
|  | 				*ch++ = *copy; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		end = ch; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	// PHP trim() removes [ \t\n\r\x00\x0b], we have removed [\t\r\x00\x0b] before, so
 | ||||||
|  | 	for (; start != end; ++start) { | ||||||
|  | 		if (start->unicode() != ' ' && start->unicode() != '\n') { | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	for (QChar *e = end - 1; start != end; end = e) { | ||||||
|  | 		if (e->unicode() != ' ' && e->unicode() != '\n') { | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 		--e; | ||||||
|  | 	} | ||||||
|  | 	if (start == end) { | ||||||
|  | 		return QString(); | ||||||
|  | 	} else if (start > _start) { | ||||||
|  | 		return QString(start, end - start); | ||||||
|  | 	} else if (end < _end) { | ||||||
|  | 		result.resize(end - start); | ||||||
|  | 	} | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1017,7 +1067,7 @@ void MainWidget::sendPreparedText(History *hist, const QString &text, MsgId repl | ||||||
| 		} | 		} | ||||||
| 		MTPVector<MTPMessageEntity> localEntities = linksToMTP(textParseLinks(sendingText, itemTextParseOptions(hist, App::self()).flags)); | 		MTPVector<MTPMessageEntity> localEntities = linksToMTP(textParseLinks(sendingText, itemTextParseOptions(hist, App::self()).flags)); | ||||||
| 		hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(hist->peer->id), MTPint(), MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities)); | 		hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(hist->peer->id), MTPint(), MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities)); | ||||||
| 		hist->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_int(sendFlags), hist->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, localEntities), App::main()->rpcDone(&MainWidget::sentDataReceived, randomId), RPCFailHandlerPtr(), 0, 0, hist->sendRequestId); | 		hist->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_int(sendFlags), hist->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, localEntities), App::main()->rpcDone(&MainWidget::sentUpdatesReceived, randomId), RPCFailHandlerPtr(), 0, 0, hist->sendRequestId); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	finishForwarding(hist); | 	finishForwarding(hist); | ||||||
|  | @ -2232,87 +2282,8 @@ void MainWidget::windowShown() { | ||||||
| 	history.windowShown(); | 	history.windowShown(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWidget::sentDataReceived(uint64 randomId, const MTPmessages_SentMessage &result) { | void MainWidget::sentUpdatesReceived(uint64 randomId, const MTPUpdates &result) { | ||||||
| 	switch (result.type()) { | 	handleUpdates(result, randomId); | ||||||
| 	case mtpc_messages_sentMessage: { |  | ||||||
| 		const MTPDmessages_sentMessage &d(result.c_messages_sentMessage()); |  | ||||||
| 		 |  | ||||||
| 		HistoryItem *item = 0; |  | ||||||
| 		if (randomId) { |  | ||||||
| 			QString text = App::histSentTextByItem(randomId); |  | ||||||
| 			feedUpdate(MTP_updateMessageID(d.vid, MTP_long(randomId))); // ignore real date
 |  | ||||||
| 			LinksInText links(linksFromMTP(d.ventities.c_vector().v));			 |  | ||||||
| 			if (!text.isEmpty() && !links.isEmpty()) { |  | ||||||
| 				item = App::histItemById(d.vid.v); |  | ||||||
| 				if (item) { |  | ||||||
| 					bool was = item->hasTextLinks(); |  | ||||||
| 					item->setText(text, links); |  | ||||||
| 					item->initDimensions(0); |  | ||||||
| 					itemResized(item); |  | ||||||
| 					if (!was && item->hasTextLinks()) { |  | ||||||
| 						item->history()->addToOverview(item, OverviewLinks); |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (updInited) { |  | ||||||
| 			if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { |  | ||||||
| 				_byPtsSentMessage.insert(ptsKey(SkippedSentMessage), result); |  | ||||||
| 				return; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (!item) { |  | ||||||
| 			item = App::histItemById(d.vid.v); |  | ||||||
| 		} |  | ||||||
| 		if (item) { |  | ||||||
| 			item->setMedia(d.vmedia); |  | ||||||
| 		} |  | ||||||
| 	} break; |  | ||||||
| 
 |  | ||||||
| 	case mtpc_messages_sentMessageLink: { |  | ||||||
| 		const MTPDmessages_sentMessageLink &d(result.c_messages_sentMessageLink()); |  | ||||||
| 
 |  | ||||||
| 		HistoryItem *item = 0; |  | ||||||
| 		if (randomId) { |  | ||||||
| 			//QString text = App::histSentTextByItem(randomId);
 |  | ||||||
| 			feedUpdate(MTP_updateMessageID(d.vid, MTP_long(randomId))); // ignore real date
 |  | ||||||
| 			//LinksInText links(linksFromMTP(d.ventities.c_vector().v));
 |  | ||||||
| 			//if (!text.isEmpty() && !links.isEmpty()) {
 |  | ||||||
| 			//	item = App::histItemById(d.vid.v);
 |  | ||||||
| 			//	if (item) {
 |  | ||||||
| 			//		bool was = item->hasTextLinks();
 |  | ||||||
| 			//		item->setText(text, links);
 |  | ||||||
| 			//		item->initDimensions(0);
 |  | ||||||
| 			//		itemResized(item);
 |  | ||||||
| 			//		if (!was && item->hasTextLinks()) {
 |  | ||||||
| 			//			item->history()->addToOverview(item, OverviewLinks);
 |  | ||||||
| 			//		}
 |  | ||||||
| 			//	}
 |  | ||||||
| 			//}
 |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (updInited) { |  | ||||||
| 			if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { |  | ||||||
| 				_byPtsSentMessage.insert(ptsKey(SkippedSentMessage), result); |  | ||||||
| 				return; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		App::feedUserLinks(d.vlinks); |  | ||||||
| 
 |  | ||||||
| 		if (!item) { |  | ||||||
| 			item = App::histItemById(d.vid.v); |  | ||||||
| 		} |  | ||||||
| 		if (item) { |  | ||||||
| 			item->setMedia(d.vmedia); |  | ||||||
| 		} |  | ||||||
| 	} break; |  | ||||||
| 	}; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void MainWidget::sentUpdatesReceived(const MTPUpdates &result) { |  | ||||||
| 	handleUpdates(result); |  | ||||||
| 	App::emitPeerUpdated(); | 	App::emitPeerUpdated(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -2728,7 +2699,7 @@ void MainWidget::applySkippedPtsUpdates() { | ||||||
| 		switch (i.value()) { | 		switch (i.value()) { | ||||||
| 		case SkippedUpdate: feedUpdate(_byPtsUpdate.value(i.key())); break; | 		case SkippedUpdate: feedUpdate(_byPtsUpdate.value(i.key())); break; | ||||||
| 		case SkippedUpdates: handleUpdates(_byPtsUpdates.value(i.key())); break; | 		case SkippedUpdates: handleUpdates(_byPtsUpdates.value(i.key())); break; | ||||||
| 		case SkippedSentMessage: sentDataReceived(0, _byPtsSentMessage.value(i.key())); break; | //		case SkippedSentMessage: sentDataReceived(0, _byPtsSentMessage.value(i.key())); break;
 | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	--updSkipPtsUpdateLevel; | 	--updSkipPtsUpdateLevel; | ||||||
|  | @ -2740,7 +2711,7 @@ void MainWidget::clearSkippedPtsUpdates() { | ||||||
| 	_byPtsQueue.clear(); | 	_byPtsQueue.clear(); | ||||||
| 	_byPtsUpdate.clear(); | 	_byPtsUpdate.clear(); | ||||||
| 	_byPtsUpdates.clear(); | 	_byPtsUpdates.clear(); | ||||||
| 	_byPtsSentMessage.clear(); | //	_byPtsSentMessage.clear();
 | ||||||
| 	updSkipPtsUpdateLevel = 0; | 	updSkipPtsUpdateLevel = 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -2999,6 +2970,8 @@ void MainWidget::inviteImportDone(const MTPUpdates &updates) { | ||||||
| 	} break; | 	} break; | ||||||
| 	case mtpc_updateShortChatMessage: { | 	case mtpc_updateShortChatMessage: { | ||||||
| 	} break; | 	} break; | ||||||
|  | 	case mtpc_updateShortSentMessage: { | ||||||
|  | 	} break; | ||||||
| 	case mtpc_updatesTooLong: { | 	case mtpc_updatesTooLong: { | ||||||
| 	} break; | 	} break; | ||||||
| 	} | 	} | ||||||
|  | @ -3093,7 +3066,6 @@ void MainWidget::gotNotifySetting(MTPInputNotifyPeer peer, const MTPPeerNotifySe | ||||||
| 	case mtpc_inputNotifyAll: applyNotifySetting(MTP_notifyAll(), settings); break; | 	case mtpc_inputNotifyAll: applyNotifySetting(MTP_notifyAll(), settings); break; | ||||||
| 	case mtpc_inputNotifyUsers: applyNotifySetting(MTP_notifyUsers(), settings); break; | 	case mtpc_inputNotifyUsers: applyNotifySetting(MTP_notifyUsers(), settings); break; | ||||||
| 	case mtpc_inputNotifyChats: applyNotifySetting(MTP_notifyChats(), settings); break; | 	case mtpc_inputNotifyChats: applyNotifySetting(MTP_notifyChats(), settings); break; | ||||||
| 	case mtpc_inputNotifyGeoChatPeer: break; // no MTP_peerGeoChat
 |  | ||||||
| 	case mtpc_inputNotifyPeer: | 	case mtpc_inputNotifyPeer: | ||||||
| 		switch (peer.c_inputNotifyPeer().vpeer.type()) { | 		switch (peer.c_inputNotifyPeer().vpeer.type()) { | ||||||
| 		case mtpc_inputPeerEmpty: applyNotifySetting(MTP_notifyPeer(MTP_peerUser(MTP_int(0))), settings); break; | 		case mtpc_inputPeerEmpty: applyNotifySetting(MTP_notifyPeer(MTP_peerUser(MTP_int(0))), settings); break; | ||||||
|  | @ -3352,7 +3324,7 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) { | ||||||
| 	update(); | 	update(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWidget::handleUpdates(const MTPUpdates &updates) { | void MainWidget::handleUpdates(const MTPUpdates &updates, uint64 randomId) { | ||||||
| 	switch (updates.type()) { | 	switch (updates.type()) { | ||||||
| 	case mtpc_updates: { | 	case mtpc_updates: { | ||||||
| 		const MTPDupdates &d(updates.c_updates()); | 		const MTPDupdates &d(updates.c_updates()); | ||||||
|  | @ -3435,6 +3407,41 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) { | ||||||
| 		updSetState(0, d.vdate.v, updQts, updSeq); | 		updSetState(0, d.vdate.v, updQts, updSeq); | ||||||
| 	} break; | 	} break; | ||||||
| 
 | 
 | ||||||
|  | 	case mtpc_updateShortSentMessage: { | ||||||
|  | 		const MTPDupdateShortSentMessage &d(updates.c_updateShortSentMessage()); | ||||||
|  | 		HistoryItem *item = 0; | ||||||
|  | 		if (randomId) { | ||||||
|  | 			QString text = d.has_entities() ? App::histSentTextByItem(randomId) : QString(); | ||||||
|  | 			feedUpdate(MTP_updateMessageID(d.vid, MTP_long(randomId))); // ignore real date
 | ||||||
|  | 			if (!text.isEmpty()) { | ||||||
|  | 				LinksInText links(linksFromMTP(d.ventities.c_vector().v)); | ||||||
|  | 				item = App::histItemById(d.vid.v); | ||||||
|  | 				if (item && !links.isEmpty()) { | ||||||
|  | 					bool was = item->hasTextLinks(); | ||||||
|  | 					item->setText(text, links); | ||||||
|  | 					item->initDimensions(0); | ||||||
|  | 					itemResized(item); | ||||||
|  | 					if (!was && item->hasTextLinks()) { | ||||||
|  | 						item->history()->addToOverview(item, OverviewLinks); | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { | ||||||
|  | 			_byPtsUpdates.insert(ptsKey(SkippedUpdates), updates); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		if (!item) { | ||||||
|  | 			item = App::histItemById(d.vid.v); | ||||||
|  | 		} | ||||||
|  | 		if (item) { | ||||||
|  | 			item->setMedia(d.has_media() ? (&d.vmedia) : 0); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		updSetState(0, d.vdate.v, updQts, updSeq); | ||||||
|  | 	} break; | ||||||
|  | 
 | ||||||
| 	case mtpc_updatesTooLong: { | 	case mtpc_updatesTooLong: { | ||||||
| 		MTP_LOG(0, ("getDifference { good - updatesTooLong received }%1").arg(cTestMode() ? " TESTMODE" : "")); | 		MTP_LOG(0, ("getDifference { good - updatesTooLong received }%1").arg(cTestMode() ? " TESTMODE" : "")); | ||||||
| 		return getDifference(); | 		return getDifference(); | ||||||
|  | @ -3686,10 +3693,6 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { | ||||||
| 		} | 		} | ||||||
| 	} break; | 	} break; | ||||||
| 
 | 
 | ||||||
| 	case mtpc_updateNewGeoChatMessage: { |  | ||||||
| 		const MTPDupdateNewGeoChatMessage &d(update.c_updateNewGeoChatMessage()); |  | ||||||
| 	} break; |  | ||||||
| 
 |  | ||||||
| 	case mtpc_updateNewEncryptedMessage: { | 	case mtpc_updateNewEncryptedMessage: { | ||||||
| 		const MTPDupdateNewEncryptedMessage &d(update.c_updateNewEncryptedMessage()); | 		const MTPDupdateNewEncryptedMessage &d(update.c_updateNewEncryptedMessage()); | ||||||
| 	} break; | 	} break; | ||||||
|  |  | ||||||
|  | @ -222,8 +222,10 @@ public: | ||||||
| 
 | 
 | ||||||
| 	void windowShown(); | 	void windowShown(); | ||||||
| 
 | 
 | ||||||
| 	void sentDataReceived(uint64 randomId, const MTPmessages_SentMessage &data); | 	void sentUpdatesReceived(uint64 randomId, const MTPUpdates &updates); | ||||||
| 	void sentUpdatesReceived(const MTPUpdates &updates); | 	void sentUpdatesReceived(const MTPUpdates &updates) { | ||||||
|  | 		return sentUpdatesReceived(0, updates); | ||||||
|  | 	} | ||||||
| 	void msgUpdated(PeerId peer, const HistoryItem *msg); | 	void msgUpdated(PeerId peer, const HistoryItem *msg); | ||||||
| 	void historyToDown(History *hist); | 	void historyToDown(History *hist); | ||||||
| 	void dialogsToUp(); | 	void dialogsToUp(); | ||||||
|  | @ -478,7 +480,7 @@ private: | ||||||
| 	void feedUpdate(const MTPUpdate &update); | 	void feedUpdate(const MTPUpdate &update); | ||||||
| 
 | 
 | ||||||
| 	void updateReceived(const mtpPrime *from, const mtpPrime *end); | 	void updateReceived(const mtpPrime *from, const mtpPrime *end); | ||||||
| 	void handleUpdates(const MTPUpdates &updates); | 	void handleUpdates(const MTPUpdates &updates, uint64 randomId = 0); | ||||||
| 	bool updateFail(const RPCError &e); | 	bool updateFail(const RPCError &e); | ||||||
| 
 | 
 | ||||||
| 	void usernameResolveDone(QPair<bool, QString> toProfileStartToken, const MTPUser &result); | 	void usernameResolveDone(QPair<bool, QString> toProfileStartToken, const MTPUser &result); | ||||||
|  | @ -544,7 +546,7 @@ private: | ||||||
| 	enum PtsSkippedQueue { | 	enum PtsSkippedQueue { | ||||||
| 		SkippedUpdate, | 		SkippedUpdate, | ||||||
| 		SkippedUpdates, | 		SkippedUpdates, | ||||||
| 		SkippedSentMessage, | //		SkippedSentMessage,
 | ||||||
| 		SkippedStatedMessage, | 		SkippedStatedMessage, | ||||||
| 		SkippedStatedMessages | 		SkippedStatedMessages | ||||||
| 	}; | 	}; | ||||||
|  | @ -555,7 +557,7 @@ private: | ||||||
| 	QMap<uint64, PtsSkippedQueue> _byPtsQueue; | 	QMap<uint64, PtsSkippedQueue> _byPtsQueue; | ||||||
| 	QMap<uint64, MTPUpdate> _byPtsUpdate; | 	QMap<uint64, MTPUpdate> _byPtsUpdate; | ||||||
| 	QMap<uint64, MTPUpdates> _byPtsUpdates; | 	QMap<uint64, MTPUpdates> _byPtsUpdates; | ||||||
| 	QMap<uint64, MTPmessages_SentMessage> _byPtsSentMessage; | //	QMap<uint64, MTPmessages_SentMessage> _byPtsSentMessage;
 | ||||||
| 	SingleTimer _byPtsTimer; | 	SingleTimer _byPtsTimer; | ||||||
| 
 | 
 | ||||||
| 	QMap<int32, MTPUpdates> _bySeqUpdates; | 	QMap<int32, MTPUpdates> _bySeqUpdates; | ||||||
|  |  | ||||||
|  | @ -2812,7 +2812,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt | ||||||
| 	mtpRequestId fakeRequestId = sessionData->nextFakeRequestId(); | 	mtpRequestId fakeRequestId = sessionData->nextFakeRequestId(); | ||||||
| 	haveReceived.insert(fakeRequestId, mtpResponse(update)); // notify main process about new updates
 | 	haveReceived.insert(fakeRequestId, mtpResponse(update)); // notify main process about new updates
 | ||||||
| 
 | 
 | ||||||
| 	if (cons != mtpc_updatesTooLong && cons != mtpc_updateShortMessage && cons != mtpc_updateShortChatMessage && cons != mtpc_updateShort && cons != mtpc_updatesCombined && cons != mtpc_updates) { | 	if (cons != mtpc_updatesTooLong && cons != mtpc_updateShortMessage && cons != mtpc_updateShortChatMessage && cons != mtpc_updateShortSentMessage && cons != mtpc_updateShort && cons != mtpc_updatesCombined && cons != mtpc_updates) { | ||||||
| 		LOG(("Message Error: unknown constructor %1").arg(cons)); // maybe new api?..
 | 		LOG(("Message Error: unknown constructor %1").arg(cons)); // maybe new api?..
 | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -366,7 +366,7 @@ static const mtpTypeId mtpLayers[] = { | ||||||
| 	mtpc_invokeWithLayer17, | 	mtpc_invokeWithLayer17, | ||||||
| 	mtpc_invokeWithLayer18, | 	mtpc_invokeWithLayer18, | ||||||
| }, mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]); | }, mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]); | ||||||
| static const mtpPrime mtpCurrentLayer = 34; | static const mtpPrime mtpCurrentLayer = 36; | ||||||
| 
 | 
 | ||||||
| template <typename bareT> | template <typename bareT> | ||||||
| class MTPBoxed : public bareT { | class MTPBoxed : public bareT { | ||||||
|  |  | ||||||
|  | @ -655,7 +655,8 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				case 1: to.add("  duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 1: to.add("  duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
| 				case 2: to.add("  w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 2: to.add("  w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
| 				case 3: to.add("  h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 3: to.add("  h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
| 				case 4: to.add("  caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 4: to.add("  mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
|  | 				case 5: to.add("  caption: "); ++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; | 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
|  | @ -673,7 +674,8 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				case 2: to.add("  duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 2: to.add("  duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
| 				case 3: to.add("  w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 3: to.add("  w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
| 				case 4: to.add("  h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 4: to.add("  h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
| 				case 5: to.add("  caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 5: to.add("  mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
|  | 				case 6: to.add("  caption: "); ++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; | 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
|  | @ -1213,29 +1215,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_geoChat: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geoChat"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  id: "); ++stages.back(); types.push_back(mtpc_int); 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("  address: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 4: to.add("  venue: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 5: to.add("  geo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 6: to.add("  photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 7: to.add("  participants_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 8: to.add("  date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 9: to.add("  checked_in: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 10: to.add("  version: "); ++stages.back(); types.push_back(mtpc_int); 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_chatFull: | 			case mtpc_chatFull: | ||||||
| 				if (stage) { | 				if (stage) { | ||||||
| 					to.add(",\n").addSpaces(lev); | 					to.add(",\n").addSpaces(lev); | ||||||
|  | @ -1346,7 +1325,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				case 6: to.add("  reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessage::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; | 				case 6: to.add("  reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessage::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; | ||||||
| 				case 7: to.add("  date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 7: to.add("  date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
| 				case 8: to.add("  message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 8: to.add("  message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
| 				case 9: to.add("  media: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | 				case 9: to.add("  media: "); ++stages.back(); if (flag & MTPDmessage::flag_media) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; | ||||||
| 				case 10: to.add("  reply_markup: "); ++stages.back(); if (flag & MTPDmessage::flag_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; | 				case 10: to.add("  reply_markup: "); ++stages.back(); if (flag & MTPDmessage::flag_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; | ||||||
| 				case 11: to.add("  entities: "); ++stages.back(); if (flag & MTPDmessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; | 				case 11: to.add("  entities: "); ++stages.back(); if (flag & MTPDmessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; | ||||||
| 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||||
|  | @ -1566,24 +1545,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_messageActionGeoChatCreate: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ messageActionGeoChatCreate"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  address: "); ++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_messageActionGeoChatCheckin: |  | ||||||
| 				to.add("{ messageActionGeoChatCheckin }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 			case mtpc_messageActionChatJoinedByLink: | 			case mtpc_messageActionChatJoinedByLink: | ||||||
| 				if (stage) { | 				if (stage) { | ||||||
| 					to.add(",\n").addSpaces(lev); | 					to.add(",\n").addSpaces(lev); | ||||||
|  | @ -1840,19 +1801,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				to.add("{ inputNotifyAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | 				to.add("{ inputNotifyAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_inputNotifyGeoChatPeer: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ inputNotifyGeoChatPeer"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++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_inputPeerNotifyEventsEmpty: | 			case mtpc_inputPeerNotifyEventsEmpty: | ||||||
| 				to.add("{ inputPeerNotifyEventsEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | 				to.add("{ inputPeerNotifyEventsEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||||
| 			break; | 			break; | ||||||
|  | @ -2025,20 +1973,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_chatLocated: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ chatLocated"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  distance: "); ++stages.back(); types.push_back(mtpc_int); 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_contacts_link: | 			case mtpc_contacts_link: | ||||||
| 				if (stage) { | 				if (stage) { | ||||||
| 					to.add(",\n").addSpaces(lev); | 					to.add(",\n").addSpaces(lev); | ||||||
|  | @ -2194,43 +2128,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_messages_sentMessage: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ messages_sentMessage"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  media: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  entities: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 4: to.add("  pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 5: to.add("  pts_count: "); ++stages.back(); types.push_back(mtpc_int); 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_sentMessageLink: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ messages_sentMessageLink"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  media: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 4: to.add("  pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 5: to.add("  links: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 6: to.add("  seq: "); ++stages.back(); types.push_back(mtpc_int); 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_chats: | 			case mtpc_messages_chats: | ||||||
| 				if (stage) { | 				if (stage) { | ||||||
| 					to.add(",\n").addSpaces(lev); | 					to.add(",\n").addSpaces(lev); | ||||||
|  | @ -2487,19 +2384,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_updateNewGeoChatMessage: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ updateNewGeoChatMessage"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  message: "); ++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_updateNewEncryptedMessage: | 			case mtpc_updateNewEncryptedMessage: | ||||||
| 				if (stage) { | 				if (stage) { | ||||||
| 					to.add(",\n").addSpaces(lev); | 					to.add(",\n").addSpaces(lev); | ||||||
|  | @ -2899,6 +2783,25 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
|  | 			case mtpc_updateShortSentMessage: | ||||||
|  | 				if (stage) { | ||||||
|  | 					to.add(",\n").addSpaces(lev); | ||||||
|  | 				} else { | ||||||
|  | 					to.add("{ updateShortSentMessage"); | ||||||
|  | 					to.add("\n").addSpaces(lev); | ||||||
|  | 				} | ||||||
|  | 				switch (stage) { | ||||||
|  | 				case 0: to.add("  flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
|  | 				case 1: to.add("  id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
|  | 				case 2: to.add("  pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
|  | 				case 3: to.add("  pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
|  | 				case 4: to.add("  date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||||
|  | 				case 5: to.add("  media: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::flag_media) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; | ||||||
|  | 				case 6: to.add("  entities: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; | ||||||
|  | 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||||
|  | 				} | ||||||
|  | 			break; | ||||||
|  | 
 | ||||||
| 			case mtpc_photos_photos: | 			case mtpc_photos_photos: | ||||||
| 				if (stage) { | 				if (stage) { | ||||||
| 					to.add(",\n").addSpaces(lev); | 					to.add(",\n").addSpaces(lev); | ||||||
|  | @ -3051,132 +2954,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_inputGeoChat: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ inputGeoChat"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(mtpc_int); 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_geoChatMessageEmpty: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geoChatMessageEmpty"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  id: "); ++stages.back(); types.push_back(mtpc_int); 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_geoChatMessage: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geoChatMessage"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  from_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 4: to.add("  message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 5: to.add("  media: "); ++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_geoChatMessageService: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geoChatMessageService"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  from_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 4: to.add("  action: "); ++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_geochats_statedMessage: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_statedMessage"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  seq: "); ++stages.back(); types.push_back(mtpc_int); 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_geochats_located: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_located"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  results: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  users: "); ++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_geochats_messages: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_messages"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  users: "); ++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_geochats_messagesSlice: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_messagesSlice"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  users: "); ++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_encryptedChatEmpty: | 			case mtpc_encryptedChatEmpty: | ||||||
| 				if (stage) { | 				if (stage) { | ||||||
| 					to.add(",\n").addSpaces(lev); | 					to.add(",\n").addSpaces(lev); | ||||||
|  | @ -4025,6 +3802,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				case 12: to.add("  embed_height: "); ++stages.back(); if (flag & MTPDwebPage::flag_embed_height) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; | 				case 12: to.add("  embed_height: "); ++stages.back(); if (flag & MTPDwebPage::flag_embed_height) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; | ||||||
| 				case 13: to.add("  duration: "); ++stages.back(); if (flag & MTPDwebPage::flag_duration) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; | 				case 13: to.add("  duration: "); ++stages.back(); if (flag & MTPDwebPage::flag_duration) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; | ||||||
| 				case 14: to.add("  author: "); ++stages.back(); if (flag & MTPDwebPage::flag_author) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; | 				case 14: to.add("  author: "); ++stages.back(); if (flag & MTPDwebPage::flag_author) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; | ||||||
|  | 				case 15: to.add("  document: "); ++stages.back(); if (flag & MTPDwebPage::flag_document) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; | ||||||
| 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
|  | @ -4863,20 +4641,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_geochats_setTyping: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_setTyping"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  typing: "); ++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_discardEncryption: | 			case mtpc_messages_discardEncryption: | ||||||
| 				if (stage) { | 				if (stage) { | ||||||
| 					to.add(",\n").addSpaces(lev); | 					to.add(",\n").addSpaces(lev); | ||||||
|  | @ -5785,19 +5549,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_geochats_getFullChat: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_getFullChat"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++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_updates_getState: | 			case mtpc_updates_getState: | ||||||
| 				to.add("{ updates_getState }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | 				to.add("{ updates_getState }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||||
| 			break; | 			break; | ||||||
|  | @ -5941,159 +5692,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | ||||||
| 				} | 				} | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 			case mtpc_geochats_getLocated: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_getLocated"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  geo_point: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  radius: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  limit: "); ++stages.back(); types.push_back(mtpc_int); 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_geochats_getRecents: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_getRecents"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  limit: "); ++stages.back(); types.push_back(mtpc_int); 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_geochats_search: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_search"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  filter: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  min_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 4: to.add("  max_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 5: to.add("  offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 6: to.add("  max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 7: to.add("  limit: "); ++stages.back(); types.push_back(mtpc_int); 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_geochats_getHistory: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_getHistory"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  limit: "); ++stages.back(); types.push_back(mtpc_int); 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_geochats_checkin: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_checkin"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++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_geochats_editChatTitle: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_editChatTitle"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  address: "); ++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_geochats_editChatPhoto: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_editChatPhoto"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  photo: "); ++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_geochats_sendMessage: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_sendMessage"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  random_id: "); ++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_geochats_sendMedia: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_sendMedia"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  media: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  random_id: "); ++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_geochats_createGeoChat: |  | ||||||
| 				if (stage) { |  | ||||||
| 					to.add(",\n").addSpaces(lev); |  | ||||||
| 				} else { |  | ||||||
| 					to.add("{ geochats_createGeoChat"); |  | ||||||
| 					to.add("\n").addSpaces(lev); |  | ||||||
| 				} |  | ||||||
| 				switch (stage) { |  | ||||||
| 				case 0: to.add("  title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 1: to.add("  geo_point: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 2: to.add("  address: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; |  | ||||||
| 				case 3: to.add("  venue: "); ++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_getDhConfig: | 			case mtpc_messages_getDhConfig: | ||||||
| 				if (stage) { | 				if (stage) { | ||||||
| 					to.add(",\n").addSpaces(lev); | 					to.add(",\n").addSpaces(lev); | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -146,8 +146,8 @@ inputMediaUploadedPhoto#f7aff1c0 file:InputFile caption:string = InputMedia; | ||||||
| inputMediaPhoto#e9bfb4f3 id:InputPhoto caption:string = InputMedia; | inputMediaPhoto#e9bfb4f3 id:InputPhoto caption:string = InputMedia; | ||||||
| inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; | inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; | ||||||
| inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; | inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; | ||||||
| inputMediaUploadedVideo#e13fd4bc file:InputFile duration:int w:int h:int caption:string = InputMedia; | inputMediaUploadedVideo#82713fdf file:InputFile duration:int w:int h:int mime_type:string caption:string = InputMedia; | ||||||
| inputMediaUploadedThumbVideo#96fb97dc file:InputFile thumb:InputFile duration:int w:int h:int caption:string = InputMedia; | inputMediaUploadedThumbVideo#7780ddf9 file:InputFile thumb:InputFile duration:int w:int h:int mime_type:string caption:string = InputMedia; | ||||||
| inputMediaVideo#936a4ebd id:InputVideo caption:string = InputMedia; | inputMediaVideo#936a4ebd id:InputVideo caption:string = InputMedia; | ||||||
| 
 | 
 | ||||||
| inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; | inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; | ||||||
|  | @ -212,7 +212,7 @@ chatPhotoEmpty#37c1011c = ChatPhoto; | ||||||
| chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; | chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; | ||||||
| 
 | 
 | ||||||
| messageEmpty#83e5de54 id:int = Message; | messageEmpty#83e5de54 id:int = Message; | ||||||
| message#f07814c8 flags:# id:int from_id:int to_id:Peer fwd_from_id:flags.2?int fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> = Message; | message#2bebfa86 flags:# id:int from_id:int to_id:Peer fwd_from_id:flags.2?int fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> = Message; | ||||||
| messageService#1d86f70e flags:int id:int from_id:int to_id:Peer date:int action:MessageAction = Message; | messageService#1d86f70e flags:int id:int from_id:int to_id:Peer date:int action:MessageAction = Message; | ||||||
| 
 | 
 | ||||||
| messageMediaEmpty#3ded6320 = MessageMedia; | messageMediaEmpty#3ded6320 = MessageMedia; | ||||||
|  | @ -283,8 +283,6 @@ contactSuggested#3de191a1 user_id:int mutual_contacts:int = ContactSuggested; | ||||||
| 
 | 
 | ||||||
| contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; | contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; | ||||||
| 
 | 
 | ||||||
| chatLocated#3631cf4c chat_id:int distance:int = ChatLocated; |  | ||||||
| 
 |  | ||||||
| contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; | contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; | ||||||
| 
 | 
 | ||||||
| contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; | contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; | ||||||
|  | @ -303,8 +301,6 @@ messages.dialogsSlice#71e094f3 count:int dialogs:Vector<Dialog> messages:Vector< | ||||||
| messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; | messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; | ||||||
| messages.messagesSlice#b446ae3 count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; | messages.messagesSlice#b446ae3 count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages; | ||||||
| 
 | 
 | ||||||
| messages.sentMessage#8a99d8e0 id:int date:int media:MessageMedia entities:Vector<MessageEntity> pts:int pts_count:int = messages.SentMessage; |  | ||||||
| 
 |  | ||||||
| messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats; | messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats; | ||||||
| 
 | 
 | ||||||
| messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; | messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector<Chat> users:Vector<User> = messages.ChatFull; | ||||||
|  | @ -365,30 +361,6 @@ help.noAppUpdate#c45a6536 = help.AppUpdate; | ||||||
| 
 | 
 | ||||||
| help.inviteText#18cb9f78 message:string = help.InviteText; | help.inviteText#18cb9f78 message:string = help.InviteText; | ||||||
| 
 | 
 | ||||||
| messages.sentMessageLink#35a1a663 id:int date:int media:MessageMedia pts:int pts_count:int links:Vector<contacts.Link> seq:int = messages.SentMessage; |  | ||||||
| 
 |  | ||||||
| inputGeoChat#74d456fa chat_id:int access_hash:long = InputGeoChat; |  | ||||||
| 
 |  | ||||||
| inputNotifyGeoChatPeer#4d8ddec8 peer:InputGeoChat = InputNotifyPeer; |  | ||||||
| 
 |  | ||||||
| geoChat#75eaea5a id:int access_hash:long title:string address:string venue:string geo:GeoPoint photo:ChatPhoto participants_count:int date:int checked_in:Bool version:int = Chat; |  | ||||||
| 
 |  | ||||||
| geoChatMessageEmpty#60311a9b chat_id:int id:int = GeoChatMessage; |  | ||||||
| geoChatMessage#4505f8e1 chat_id:int id:int from_id:int date:int message:string media:MessageMedia = GeoChatMessage; |  | ||||||
| geoChatMessageService#d34fa24e chat_id:int id:int from_id:int date:int action:MessageAction = GeoChatMessage; |  | ||||||
| 
 |  | ||||||
| geochats.statedMessage#17b1578b message:GeoChatMessage chats:Vector<Chat> users:Vector<User> seq:int = geochats.StatedMessage; |  | ||||||
| 
 |  | ||||||
| geochats.located#48feb267 results:Vector<ChatLocated> messages:Vector<GeoChatMessage> chats:Vector<Chat> users:Vector<User> = geochats.Located; |  | ||||||
| 
 |  | ||||||
| geochats.messages#d1526db1 messages:Vector<GeoChatMessage> chats:Vector<Chat> users:Vector<User> = geochats.Messages; |  | ||||||
| geochats.messagesSlice#bc5863e8 count:int messages:Vector<GeoChatMessage> chats:Vector<Chat> users:Vector<User> = geochats.Messages; |  | ||||||
| 
 |  | ||||||
| messageActionGeoChatCreate#6f038ebc title:string address:string = MessageAction; |  | ||||||
| messageActionGeoChatCheckin#c7d53de = MessageAction; |  | ||||||
| 
 |  | ||||||
| updateNewGeoChatMessage#5a68e3f7 message:GeoChatMessage = Update; |  | ||||||
| 
 |  | ||||||
| wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; | wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; | ||||||
| 
 | 
 | ||||||
| updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; | updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; | ||||||
|  | @ -546,7 +518,7 @@ updateWebPage#2cc36971 webpage:WebPage = Update; | ||||||
| 
 | 
 | ||||||
| webPageEmpty#eb1477e8 id:long = WebPage; | webPageEmpty#eb1477e8 id:long = WebPage; | ||||||
| webPagePending#c586da1c id:long date:int = WebPage; | webPagePending#c586da1c id:long date:int = WebPage; | ||||||
| webPage#a31ea0b5 flags:# id:long url:string display_url:string type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string = WebPage; | webPage#ca820ed7 flags:# id:long url:string display_url:string type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document = WebPage; | ||||||
| 
 | 
 | ||||||
| messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; | messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; | ||||||
| 
 | 
 | ||||||
|  | @ -621,6 +593,8 @@ messageEntityCode#28a20571 offset:int length:int = MessageEntity; | ||||||
| messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; | messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; | ||||||
| messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; | messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; | ||||||
| 
 | 
 | ||||||
|  | updateShortSentMessage#11f1331c flags:# id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> = Updates; | ||||||
|  | 
 | ||||||
| ---functions--- | ---functions--- | ||||||
| 
 | 
 | ||||||
| invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; | invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; | ||||||
|  | @ -672,7 +646,7 @@ messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHis | ||||||
| messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages; | messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages; | ||||||
| messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>; | messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>; | ||||||
| messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; | messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; | ||||||
| messages.sendMessage#df12390 flags:# peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = messages.SentMessage; | messages.sendMessage#fa88427a flags:# peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates; | ||||||
| messages.sendMedia#c8f16791 flags:# peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; | messages.sendMedia#c8f16791 flags:# peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; | ||||||
| messages.forwardMessages#55e1728d peer:InputPeer id:Vector<int> random_id:Vector<long> = Updates; | messages.forwardMessages#55e1728d peer:InputPeer id:Vector<int> random_id:Vector<long> = Updates; | ||||||
| messages.getChats#3c6aa187 id:Vector<int> = messages.Chats; | messages.getChats#3c6aa187 id:Vector<int> = messages.Chats; | ||||||
|  | @ -703,20 +677,6 @@ photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int | ||||||
| 
 | 
 | ||||||
| messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; | messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; | ||||||
| messages.sendBroadcast#bf73f4da contacts:Vector<InputUser> random_id:Vector<long> message:string media:InputMedia = Updates; | messages.sendBroadcast#bf73f4da contacts:Vector<InputUser> random_id:Vector<long> message:string media:InputMedia = Updates; | ||||||
| 
 |  | ||||||
| geochats.getLocated#7f192d8f geo_point:InputGeoPoint radius:int limit:int = geochats.Located; |  | ||||||
| geochats.getRecents#e1427e6f offset:int limit:int = geochats.Messages; |  | ||||||
| geochats.checkin#55b3e8fb peer:InputGeoChat = geochats.StatedMessage; |  | ||||||
| geochats.getFullChat#6722dd6f peer:InputGeoChat = messages.ChatFull; |  | ||||||
| geochats.editChatTitle#4c8e2273 peer:InputGeoChat title:string address:string = geochats.StatedMessage; |  | ||||||
| geochats.editChatPhoto#35d81a95 peer:InputGeoChat photo:InputChatPhoto = geochats.StatedMessage; |  | ||||||
| geochats.search#cfcdc44d peer:InputGeoChat q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = geochats.Messages; |  | ||||||
| geochats.getHistory#b53f7a68 peer:InputGeoChat offset:int max_id:int limit:int = geochats.Messages; |  | ||||||
| geochats.setTyping#8b8a729 peer:InputGeoChat typing:Bool = Bool; |  | ||||||
| geochats.sendMessage#61b0044 peer:InputGeoChat message:string random_id:long = geochats.StatedMessage; |  | ||||||
| geochats.sendMedia#b8f0deff peer:InputGeoChat media:InputMedia random_id:long = geochats.StatedMessage; |  | ||||||
| geochats.createGeoChat#e092e16 title:string geo_point:InputGeoPoint address:string venue:string = geochats.StatedMessage; |  | ||||||
| 
 |  | ||||||
| messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; | messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; | ||||||
| messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; | messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; | ||||||
| messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; | messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; | ||||||
|  |  | ||||||
|  | @ -1105,6 +1105,8 @@ void OverviewInner::paintEvent(QPaintEvent *e) { | ||||||
| 							pix = page->photo->thumb->pixBlurredSingle(lnk->pixw, lnk->pixh, st::dlgPhotoSize, st::dlgPhotoSize); | 							pix = page->photo->thumb->pixBlurredSingle(lnk->pixw, lnk->pixh, st::dlgPhotoSize, st::dlgPhotoSize); | ||||||
| 						} | 						} | ||||||
| 						p.drawPixmap(0, top, pix); | 						p.drawPixmap(0, top, pix); | ||||||
|  | 					} else if (page && page->doc && !page->doc->thumb->isNull()) { | ||||||
|  | 						p.drawPixmap(0, top, page->doc->thumb->pixSingle(lnk->pixw, lnk->pixh, st::dlgPhotoSize, st::dlgPhotoSize)); | ||||||
| 					} else { | 					} else { | ||||||
| 						int32 index = lnk->letter.isEmpty() ? 0 : (lnk->letter.at(0).unicode() % 4); | 						int32 index = lnk->letter.isEmpty() ? 0 : (lnk->letter.at(0).unicode() % 4); | ||||||
| 						switch (index) { | 						switch (index) { | ||||||
|  |  | ||||||
|  | @ -774,8 +774,8 @@ QString DocumentData::already(bool check) { | ||||||
| 	return location.name; | 	return location.name; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| WebPageData::WebPageData(const WebPageId &id, WebPageType type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, int32 duration, const QString &author, int32 pendingTill) : | WebPageData::WebPageData(const WebPageId &id, WebPageType type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc, int32 duration, const QString &author, int32 pendingTill) : | ||||||
| id(id), type(type), url(url), displayUrl(displayUrl), siteName(siteName), title(title), description(description), duration(duration), author(author), photo(photo), pendingTill(pendingTill) { | id(id), type(type), url(url), displayUrl(displayUrl), siteName(siteName), title(title), description(description), duration(duration), author(author), photo(photo), doc(doc), pendingTill(pendingTill) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void PeerLink::onClick(Qt::MouseButton button) const { | void PeerLink::onClick(Qt::MouseButton button) const { | ||||||
|  |  | ||||||
|  | @ -548,6 +548,19 @@ struct DocumentData { | ||||||
| 		if (sticker()) sticker()->img->forget(); | 		if (sticker()) sticker()->img->forget(); | ||||||
| 		replyPreview->forget(); | 		replyPreview->forget(); | ||||||
| 	} | 	} | ||||||
|  | 	ImagePtr makeReplyPreview() { | ||||||
|  | 		if (replyPreview->isNull() && !thumb->isNull()) { | ||||||
|  | 			if (thumb->loaded()) { | ||||||
|  | 				int w = thumb->width(), h = thumb->height(); | ||||||
|  | 				if (w <= 0) w = 1; | ||||||
|  | 				if (h <= 0) h = 1; | ||||||
|  | 				replyPreview = ImagePtr(w > h ? thumb->pix(w * st::msgReplyBarSize.height() / h, st::msgReplyBarSize.height()) : thumb->pix(st::msgReplyBarSize.height()), "PNG"); | ||||||
|  | 			} else { | ||||||
|  | 				thumb->load(); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		return replyPreview; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	void save(const QString &toFile); | 	void save(const QString &toFile); | ||||||
| 
 | 
 | ||||||
|  | @ -687,7 +700,7 @@ inline WebPageType toWebPageType(const QString &type) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| struct WebPageData { | struct WebPageData { | ||||||
| 	WebPageData(const WebPageId &id, WebPageType type = WebPageArticle, const QString &url = QString(), const QString &displayUrl = QString(), const QString &siteName = QString(), const QString &title = QString(), const QString &description = QString(), PhotoData *photo = 0, int32 duration = 0, const QString &author = QString(), int32 pendingTill = -1); | 	WebPageData(const WebPageId &id, WebPageType type = WebPageArticle, const QString &url = QString(), const QString &displayUrl = QString(), const QString &siteName = QString(), const QString &title = QString(), const QString &description = QString(), PhotoData *photo = 0, DocumentData *doc = 0, int32 duration = 0, const QString &author = QString(), int32 pendingTill = -1); | ||||||
| 	 | 	 | ||||||
| 	void forget() { | 	void forget() { | ||||||
| 		if (photo) photo->forget(); | 		if (photo) photo->forget(); | ||||||
|  | @ -699,6 +712,7 @@ struct WebPageData { | ||||||
| 	int32 duration; | 	int32 duration; | ||||||
| 	QString author; | 	QString author; | ||||||
| 	PhotoData *photo; | 	PhotoData *photo; | ||||||
|  | 	DocumentData *doc; | ||||||
| 	int32 pendingTill; | 	int32 pendingTill; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue