mirror of https://github.com/procxx/kepka.git
				
				
				
			channel creation done
This commit is contained in:
		
							parent
							
								
									41e7ce11a0
								
							
						
					
					
						commit
						ab7a745a49
					
				|  | @ -412,6 +412,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org | |||
| "lng_create_public_channel_about" = "Everyone will be able to join your channel"; | ||||
| "lng_create_private_channel_title" = "Private Channel"; | ||||
| "lng_create_private_channel_about" = "Only those who have the invitation link will be able to join your channel"; | ||||
| "lng_create_channel_comments" = "Enable Comments"; | ||||
| "lng_create_channel_comments_about" = "If you enable comments, members will be able to discuss your posts in the channel"; | ||||
| "lng_create_group_save" = "Save"; | ||||
| "lng_create_group_skip" = "Skip"; | ||||
| 
 | ||||
|  | @ -420,6 +422,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org | |||
| "lng_create_channel_link_too_short" = "This link is too short"; | ||||
| "lng_create_channel_link_bad_symbols" = "This link has bad symbols"; | ||||
| "lng_create_channel_link_available" = "This link is available"; | ||||
| "lng_create_channel_link_copied" = "The link was copied to clipboard"; | ||||
| 
 | ||||
| "lng_create_group_crop" = "Select square area for group photo"; | ||||
| "lng_create_channel_crop" = "Select square area for channel photo"; | ||||
|  |  | |||
|  | @ -1431,6 +1431,7 @@ newGroupDescription: flatTextarea(taDefFlat) { | |||
| 	phFocusColor: #949494; | ||||
| } | ||||
| newGroupDescriptionPadding: margins(5px, 6px, 5px, 6px); | ||||
| newGroupLinkFadeDuration: 5000; | ||||
| 
 | ||||
| connectionSkip: 20px; | ||||
| inpConnectionHost: flatInput(inpDefGray) { | ||||
|  |  | |||
|  | @ -137,7 +137,7 @@ void ApiWrap::resolveReplyTo() { | |||
| 		} | ||||
| 		MessageIds ids = collectMessageIds(j.value()); | ||||
| 		if (!ids.isEmpty()) { | ||||
| 			mtpRequestId req = MTP::send(MTPmessages_GetChannelMessages(j.key()->input, MTP_vector<MTPint>(ids)), rpcDone(&ApiWrap::gotReplyTo, j.key()), RPCFailHandlerPtr(), 0, 5); | ||||
| 			mtpRequestId req = MTP::send(MTPchannels_GetMessages(j.key()->inputChannel, MTP_vector<MTPint>(ids)), rpcDone(&ApiWrap::gotReplyTo, j.key()), RPCFailHandlerPtr(), 0, 5); | ||||
| 			for (ReplyToRequests::iterator i = j->begin(); i != j->cend(); ++i) { | ||||
| 				if (i.value().req > 0) continue; | ||||
| 				i.value().req = req; | ||||
|  | @ -207,7 +207,7 @@ void ApiWrap::requestFullPeer(PeerData *peer) { | |||
| 	} else if (peer->isChat()) { | ||||
| 		req = MTP::send(MTPmessages_GetFullChat(peer->asChat()->inputChat), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFullFailed, peer)); | ||||
| 	} else if (peer->isChannel()) { | ||||
| 		req = MTP::send(MTPmessages_GetFullChat(peer->asChannel()->inputChat), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFullFailed, peer)); | ||||
| 		req = MTP::send(MTPchannels_GetFullChannel(peer->asChannel()->inputChannel), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFullFailed, peer)); | ||||
| 	} | ||||
| 	if (req) _fullPeerRequests.insert(peer, req); | ||||
| } | ||||
|  | @ -320,17 +320,19 @@ void ApiWrap::requestPeer(PeerData *peer) { | |||
| 	if (peer->isUser()) { | ||||
| 		req = MTP::send(MTPusers_GetUsers(MTP_vector<MTPInputUser>(1, peer->asUser()->inputUser)), rpcDone(&ApiWrap::gotUser, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); | ||||
| 	} else if (peer->isChat()) { | ||||
| 		req = MTP::send(MTPmessages_GetChats(MTP_vector<MTPInputChat>(1, peer->asChat()->inputChat)), rpcDone(&ApiWrap::gotChat, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); | ||||
| 		req = MTP::send(MTPmessages_GetChats(MTP_vector<MTPint>(1, peer->asChat()->inputChat)), rpcDone(&ApiWrap::gotChat, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); | ||||
| 	} else if (peer->isChannel()) { | ||||
| 		req = MTP::send(MTPmessages_GetChats(MTP_vector<MTPInputChat>(1, peer->asChannel()->inputChat)), rpcDone(&ApiWrap::gotChat, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); | ||||
| 		req = MTP::send(MTPchannels_GetChannels(MTP_vector<MTPInputChannel>(1, peer->asChannel()->inputChannel)), rpcDone(&ApiWrap::gotChat, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); | ||||
| 	} | ||||
| 	if (req) _peerRequests.insert(peer, req); | ||||
| } | ||||
| 
 | ||||
| void ApiWrap::requestPeers(const QList<PeerData*> &peers) { | ||||
| 	QVector<MTPInputChat> chats; | ||||
| 	QVector<MTPint> chats; | ||||
| 	QVector<MTPInputChannel> channels; | ||||
| 	QVector<MTPInputUser> users; | ||||
| 	chats.reserve(peers.size()); | ||||
| 	channels.reserve(peers.size()); | ||||
| 	users.reserve(peers.size()); | ||||
| 	for (QList<PeerData*>::const_iterator i = peers.cbegin(), e = peers.cend(); i != e; ++i) { | ||||
| 		if (!*i || _fullPeerRequests.contains(*i) || _peerRequests.contains(*i)) continue; | ||||
|  | @ -339,10 +341,11 @@ void ApiWrap::requestPeers(const QList<PeerData*> &peers) { | |||
| 		} else if ((*i)->isChat()) { | ||||
| 			chats.push_back((*i)->asChat()->inputChat); | ||||
| 		} else if ((*i)->isChannel()) { | ||||
| 			chats.push_back((*i)->asChannel()->inputChat); | ||||
| 			channels.push_back((*i)->asChannel()->inputChannel); | ||||
| 		} | ||||
| 	} | ||||
| 	if (!chats.isEmpty()) MTP::send(MTPmessages_GetChats(MTP_vector<MTPInputChat>(chats)), rpcDone(&ApiWrap::gotChats)); | ||||
| 	if (!chats.isEmpty()) MTP::send(MTPmessages_GetChats(MTP_vector<MTPint>(chats)), rpcDone(&ApiWrap::gotChats)); | ||||
| 	if (!channels.isEmpty()) MTP::send(MTPchannels_GetChannels(MTP_vector<MTPInputChannel>(channels)), rpcDone(&ApiWrap::gotChats)); | ||||
| 	if (!users.isEmpty()) MTP::send(MTPusers_GetUsers(MTP_vector<MTPInputUser>(users)), rpcDone(&ApiWrap::gotUsers)); | ||||
| } | ||||
| 
 | ||||
|  | @ -576,7 +579,7 @@ void ApiWrap::resolveWebPages() { | |||
| 	typedef QVector<mtpRequestId> RequestIds; | ||||
| 	RequestIds reqsByIndex(idsByChannel.size(), 0); | ||||
| 	for (MessageIdsByChannel::const_iterator i = idsByChannel.cbegin(), e = idsByChannel.cend(); i != e; ++i) { | ||||
| 		reqsByIndex[i.value().first] = MTP::send(MTPmessages_GetChannelMessages(i.key()->input, MTP_vector<MTPint>(i.value().second)), rpcDone(&ApiWrap::gotWebPages, i.key()), RPCFailHandlerPtr(), 0, 5); | ||||
| 		reqsByIndex[i.value().first] = MTP::send(MTPchannels_GetMessages(i.key()->inputChannel, MTP_vector<MTPint>(i.value().second)), rpcDone(&ApiWrap::gotWebPages, i.key()), RPCFailHandlerPtr(), 0, 5); | ||||
| 	} | ||||
| 	if (req || !reqsByIndex.isEmpty()) { | ||||
| 		for (WebPagesPending::iterator i = _webPagesPending.begin(); i != _webPagesPending.cend(); ++i) { | ||||
|  |  | |||
|  | @ -521,7 +521,7 @@ namespace App { | |||
| 				data->input = MTP_inputPeerChannel(d.vid, d.vaccess_hash); | ||||
| 
 | ||||
| 				ChannelData *cdata = data->asChannel(); | ||||
| 				cdata->inputChat = MTP_inputChannel(d.vid, d.vaccess_hash); | ||||
| 				cdata->inputChannel = MTP_inputChannel(d.vid, d.vaccess_hash); | ||||
| 				 | ||||
| 				QString uname = d.has_username() ? textOneLine(qs(d.vusername)) : QString(); | ||||
| 				cdata->setName(qs(d.vtitle), uname); | ||||
|  | @ -529,13 +529,13 @@ namespace App { | |||
| 				cdata->access = d.vaccess_hash.v; | ||||
| 				cdata->setPhoto(d.vphoto); | ||||
| 				cdata->date = d.vdate.v; | ||||
| 				cdata->adminned = (d.vflags.v & MTPDchannel_flag_is_admin); | ||||
| 				cdata->adminned = (d.vflags.v & MTPDchannel_flag_am_admin); | ||||
| 				 | ||||
| 				cdata->isBroadcast = (d.vflags.v & MTPDchannel_flag_is_broadcast); | ||||
| 				cdata->isPublic = (d.vflags.v & MTPDchannel_flag_is_public); | ||||
| 				cdata->isPublic = d.has_username(); | ||||
| 
 | ||||
| 				cdata->left = (d.vflags.v & MTPDchannel_flag_left); | ||||
| 				cdata->forbidden = (d.vflags.v & MTPDchannel_flag_kicked); | ||||
| 				cdata->left = (d.vflags.v & MTPDchannel_flag_have_left); | ||||
| 				cdata->forbidden = (d.vflags.v & MTPDchannel_flag_was_kicked); | ||||
| 				if (cdata->version < d.vversion.v) { | ||||
| 					cdata->version = d.vversion.v; | ||||
| 				} | ||||
|  | @ -548,7 +548,7 @@ namespace App { | |||
| 				data->input = MTP_inputPeerChannel(d.vid, d.vaccess_hash); | ||||
| 
 | ||||
| 				ChannelData *cdata = data->asChannel(); | ||||
| 				cdata->inputChat = MTP_inputChannel(d.vid, d.vaccess_hash); | ||||
| 				cdata->inputChannel = MTP_inputChannel(d.vid, d.vaccess_hash); | ||||
| 
 | ||||
| 				cdata->setName(qs(d.vtitle), QString()); | ||||
| 
 | ||||
|  |  | |||
|  | @ -337,10 +337,10 @@ void Application::peerClearPhoto(PeerId id) { | |||
| 	if (MTP::authedId() && peerToUser(id) == MTP::authedId()) { | ||||
| 		MTP::send(MTPphotos_UpdateProfilePhoto(MTP_inputPhotoEmpty(), MTP_inputPhotoCropAuto()), rpcDone(&Application::selfPhotoCleared), rpcFail(&Application::peerPhotoFail, id)); | ||||
| 	} else if (peerIsChat(id)) { | ||||
| 		MTP::send(MTPmessages_EditChatPhoto(MTP_inputChat(peerToBareMTPInt(id)), MTP_inputChatPhotoEmpty()), rpcDone(&Application::chatPhotoCleared, id), rpcFail(&Application::peerPhotoFail, id)); | ||||
| 		MTP::send(MTPmessages_EditChatPhoto(peerToBareMTPInt(id), MTP_inputChatPhotoEmpty()), rpcDone(&Application::chatPhotoCleared, id), rpcFail(&Application::peerPhotoFail, id)); | ||||
| 	} else if (peerIsChannel(id)) { | ||||
| 		if (ChannelData *channel = App::channelLoaded(id)) { | ||||
| 			MTP::send(MTPmessages_EditChatPhoto(channel->inputChat, MTP_inputChatPhotoEmpty()), rpcDone(&Application::chatPhotoCleared, id), rpcFail(&Application::peerPhotoFail, id)); | ||||
| 			MTP::send(MTPchannels_EditPhoto(channel->inputChannel, MTP_inputChatPhotoEmpty()), rpcDone(&Application::chatPhotoCleared, id), rpcFail(&Application::peerPhotoFail, id)); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -398,9 +398,12 @@ void Application::photoUpdated(const FullMsgId &msgId, const MTPInputFile &file) | |||
| 		PeerId id = i.value(); | ||||
| 		if (MTP::authedId() && peerToUser(id) == MTP::authedId()) { | ||||
| 			MTP::send(MTPphotos_UploadProfilePhoto(file, MTP_string(""), MTP_inputGeoPointEmpty(), MTP_inputPhotoCrop(MTP_double(0), MTP_double(0), MTP_double(100))), rpcDone(&Application::selfPhotoDone), rpcFail(&Application::peerPhotoFail, id)); | ||||
| 		} else if (peerIsChat(id) || peerIsChannel(id)) { | ||||
| 		} else if (peerIsChat(id)) { | ||||
| 			History *hist = App::history(id); | ||||
| 			hist->sendRequestId = MTP::send(MTPmessages_EditChatPhoto(hist->peer->isChat() ? hist->peer->asChat()->inputChat : hist->peer->asChannel()->inputChat, MTP_inputChatUploadedPhoto(file, MTP_inputPhotoCrop(MTP_double(0), MTP_double(0), MTP_double(100)))), rpcDone(&Application::chatPhotoDone, id), rpcFail(&Application::peerPhotoFail, id), 0, 0, hist->sendRequestId); | ||||
| 			hist->sendRequestId = MTP::send(MTPmessages_EditChatPhoto(hist->peer->asChat()->inputChat, MTP_inputChatUploadedPhoto(file, MTP_inputPhotoCrop(MTP_double(0), MTP_double(0), MTP_double(100)))), rpcDone(&Application::chatPhotoDone, id), rpcFail(&Application::peerPhotoFail, id), 0, 0, hist->sendRequestId); | ||||
| 		} else if (peerIsChannel(id)) { | ||||
| 			History *hist = App::history(id); | ||||
| 			hist->sendRequestId = MTP::send(MTPchannels_EditPhoto(hist->peer->asChannel()->inputChannel, MTP_inputChatUploadedPhoto(file, MTP_inputPhotoCrop(MTP_double(0), MTP_double(0), MTP_double(100)))), rpcDone(&Application::chatPhotoDone, id), rpcFail(&Application::peerPhotoFail, id), 0, 0, hist->sendRequestId); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -213,7 +213,7 @@ void AddContactBox::onSend() { | |||
| 		if (_peer->isChat()) { | ||||
| 			_addRequest = MTP::send(MTPmessages_EditChatTitle(_peer->asChat()->inputChat, MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail)); | ||||
| 		} else if (_peer->isChannel()) { | ||||
| 			_addRequest = MTP::send(MTPmessages_EditChatTitle(_peer->asChannel()->inputChat, MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail)); | ||||
| 			_addRequest = MTP::send(MTPchannels_EditTitle(_peer->asChannel()->inputChannel, MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail)); | ||||
| 		} else { | ||||
| 			_contactId = MTP::nonce<uint64>(); | ||||
| 			QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_peer->asUser()->phone), MTP_string(firstName), MTP_string(lastName))); | ||||
|  |  | |||
|  | @ -1236,15 +1236,6 @@ void ContactsBox::onInvite() { | |||
| void ContactsBox::onCreate() { | ||||
| 	if (_creationRequestId) return; | ||||
| 
 | ||||
| 	//if (_inner.creating() == CreatingGroupChannel) { // tmp
 | ||||
| 	//	ChannelData *channel = App::channelLoaded(10449997);
 | ||||
| 	//	if (channel) {
 | ||||
| 	//		App::wnd()->hideLayer(true);
 | ||||
| 	//		App::wnd()->showLayer(new SetupChannelBox(channel), true);
 | ||||
| 	//	}
 | ||||
| 	//	return;
 | ||||
| 	//}
 | ||||
| 
 | ||||
| 	MTPVector<MTPInputUser> users(MTP_vector<MTPInputUser>(_inner.selectedInputs())); | ||||
| 	const QVector<MTPInputUser> &v(users.c_vector().v); | ||||
| 	if (v.isEmpty() || (v.size() == 1 && v.at(0).type() == mtpc_inputUserSelf)) { | ||||
|  | @ -1414,7 +1405,7 @@ a_description(animFunc(this, &GroupInfoBox::descriptionAnimStep)), | |||
| _name(this, st::newGroupName, lang(_creating == CreatingGroupChannel ? lng_dlg_new_channel_name : lng_dlg_new_group_name)), | ||||
| _photo(this, lang(lng_create_group_photo), st::newGroupPhoto), | ||||
| _description(this, st::newGroupDescription, lang(lng_create_group_description)), | ||||
| _next(this, lang(lng_create_group_next), st::btnSelectDone), | ||||
| _next(this, lang(_creating == CreatingGroupChannel ? lng_create_group_create : lng_create_group_next), st::btnSelectDone), | ||||
| _cancel(this, lang(lng_create_group_back), st::btnSelectCancel), | ||||
| _creationRequestId(0), _createdChannel(0) { | ||||
| 
 | ||||
|  | @ -1425,6 +1416,7 @@ _creationRequestId(0), _createdChannel(0) { | |||
| 	_description.setMaxHeight(3 * _description.height() + 2 * st::newGroupDescriptionPadding.top() + 2 * st::newGroupDescriptionPadding.bottom()); | ||||
| 
 | ||||
| 	updateMaxHeight(); | ||||
| 	_description.setMaxLength(MaxChannelDescription); | ||||
| 	connect(&_description, SIGNAL(resized()), this, SLOT(onDescriptionResized())); | ||||
| 	connect(&_description, SIGNAL(submitted(bool)), this, SLOT(onNext())); | ||||
| 	connect(&_description, SIGNAL(cancelled()), this, SLOT(onClose())); | ||||
|  | @ -1631,7 +1623,7 @@ void GroupInfoBox::onNext() { | |||
| 	if (_creating == CreatingGroupGroup) { | ||||
| 		App::wnd()->replaceLayer(new ContactsBox(name, _photoBig)); | ||||
| 	} else { | ||||
| 		_creationRequestId = MTP::send(MTPmessages_CreateChannel(MTP_int(MTPmessages_CreateChannel_flag_broadcast), MTP_string(name), MTP_string(_description.getLastText().trimmed()), MTP_vector<MTPInputUser>(0)), rpcDone(&GroupInfoBox::creationDone), rpcFail(&GroupInfoBox::creationFail)); | ||||
| 		_creationRequestId = MTP::send(MTPchannels_CreateChannel(MTP_int(MTPmessages_CreateChannel_flag_broadcast), MTP_string(name), MTP_string(_description.getLastText().trimmed()), MTP_vector<MTPInputUser>(0)), rpcDone(&GroupInfoBox::creationDone), rpcFail(&GroupInfoBox::creationFail)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -1641,7 +1633,7 @@ void GroupInfoBox::creationDone(const MTPUpdates &updates) { | |||
| 		onClose(); | ||||
| 	} else { | ||||
| 		_createdChannel = result->asChannel(); | ||||
| 		_creationRequestId = MTP::send(MTPmessages_ExportChatInvite(_createdChannel->inputChat), rpcDone(&GroupInfoBox::exportDone)); | ||||
| 		_creationRequestId = MTP::send(MTPchannels_ExportInvite(_createdChannel->inputChannel), rpcDone(&GroupInfoBox::exportDone)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -1727,18 +1719,24 @@ SetupChannelBox::SetupChannelBox(ChannelData *channel) : AbstractBox(), | |||
| _channel(channel), | ||||
| _public(this, qsl("channel_privacy"), 0, lang(lng_create_public_channel_title), true), | ||||
| _private(this, qsl("channel_privacy"), 1, lang(lng_create_private_channel_title)), | ||||
| _comments(this, lang(lng_create_channel_comments), true), | ||||
| _aboutPublicWidth(width() - st::newGroupPadding.left() - st::newGroupPadding.right() - st::rbDefFlat.textLeft), | ||||
| _aboutPublic(st::normalFont, lang(lng_create_public_channel_about), _defaultOptions, _aboutPublicWidth), | ||||
| _aboutPrivate(st::normalFont, lang(lng_create_private_channel_about), _defaultOptions, _aboutPublicWidth), | ||||
| _aboutComments(st::normalFont, lang(lng_create_channel_comments_about), _defaultOptions, _aboutPublicWidth), | ||||
| _linkPlaceholder(qsl("telegram.me/")), | ||||
| _link(this, st::newGroupLink, QString()), | ||||
| _linkOver(false), | ||||
| _save(this, lang(lng_create_group_save), st::btnSelectDone), | ||||
| _skip(this, lang(lng_create_group_skip), st::btnSelectCancel), | ||||
| _saveRequestId(0), _checkRequestId(0) { | ||||
| _saveRequestId(0), _checkRequestId(0), | ||||
| a_goodOpacity(0, 0), a_good(animFunc(this, &SetupChannelBox::goodAnimStep)) { | ||||
| 	setMouseTracking(true); | ||||
| 
 | ||||
| 	_link.setTextMargin(style::margins(st::newGroupLink.textMrg.left() + st::newGroupLink.font->m.width(_linkPlaceholder), st::newGroupLink.textMrg.top(), st::newGroupLink.textMrg.right(), st::newGroupLink.textMrg.bottom())); | ||||
| 
 | ||||
| 	_aboutPublicHeight = _aboutPublic.countHeight(_aboutPublicWidth); | ||||
| 	setMaxHeight(st::newGroupPadding.top() + _public.height() + _aboutPublicHeight + st::newGroupSkip + _private.height() + _aboutPrivate.countHeight(_aboutPublicWidth) + st::newGroupPadding.bottom() + st::newGroupLinkPadding.top() + _link.height() + st::newGroupLinkPadding.bottom() + _save.height()); | ||||
| 	setMaxHeight(st::newGroupPadding.top() + _public.height() + _aboutPublicHeight + st::newGroupSkip + _private.height() + _aboutPrivate.countHeight(_aboutPublicWidth) + st::newGroupSkip + _comments.height() + _aboutComments.countHeight(_aboutPublicWidth) + st::newGroupPadding.bottom() + st::newGroupLinkPadding.top() + _link.height() + st::newGroupLinkPadding.bottom() + _save.height()); | ||||
| 
 | ||||
| 	connect(&_save, SIGNAL(clicked()), this, SLOT(onSave())); | ||||
| 	connect(&_skip, SIGNAL(clicked()), this, SLOT(onClose())); | ||||
|  | @ -1795,19 +1793,33 @@ void SetupChannelBox::paintEvent(QPaintEvent *e) { | |||
| 
 | ||||
| 	p.setPen(st::newGroupAboutFg); | ||||
| 
 | ||||
| 	QRect aboutPublic(st::newGroupPadding.left() + st::rbDefFlat.textLeft, _public.y() + _public.height(), width() - st::newGroupPadding.left() - st::newGroupPadding.right() - st::rbDefFlat.textLeft, _aboutPublicHeight); | ||||
| 	if (rtl()) aboutPublic.setX(width() - aboutPublic.x() - aboutPublic.width()); | ||||
| 	QRect aboutPublic = rtlrect(st::newGroupPadding.left() + st::rbDefFlat.textLeft, _public.y() + _public.height(), width() - st::newGroupPadding.left() - st::newGroupPadding.right() - st::rbDefFlat.textLeft, _aboutPublicHeight, width()); | ||||
| 	_aboutPublic.draw(p, aboutPublic.x(), aboutPublic.y(), aboutPublic.width()); | ||||
| 
 | ||||
| 	QRect aboutPrivate(st::newGroupPadding.left() + st::rbDefFlat.textLeft, _private.y() + _private.height(), width() - st::newGroupPadding.left() - st::newGroupPadding.right() - st::rbDefFlat.textLeft, _aboutPublicHeight); | ||||
| 	if (rtl()) aboutPrivate.setX(width() - aboutPrivate.x() - aboutPrivate.width()); | ||||
| 	QRect aboutPrivate = rtlrect(st::newGroupPadding.left() + st::rbDefFlat.textLeft, _private.y() + _private.height(), width() - st::newGroupPadding.left() - st::newGroupPadding.right() - st::rbDefFlat.textLeft, _aboutPublicHeight, width()); | ||||
| 	_aboutPrivate.draw(p, aboutPrivate.x(), aboutPrivate.y(), aboutPrivate.width()); | ||||
| 
 | ||||
| 	QRect aboutComments = rtlrect(st::newGroupPadding.left() + st::rbDefFlat.textLeft, _comments.y() + _comments.height(), width() - st::newGroupPadding.left() - st::newGroupPadding.right() - st::rbDefFlat.textLeft, _aboutPublicHeight, width()); | ||||
| 	_aboutComments.draw(p, aboutComments.x(), aboutComments.y(), aboutComments.width()); | ||||
| 
 | ||||
| 	p.setPen(st::black); | ||||
| 	p.setFont(st::newGroupLinkFont); | ||||
| 	p.drawTextLeft(st::newGroupPadding.left(), _link.y() - st::newGroupLinkPadding.top() + st::newGroupLinkTop, width(), lang(lng_create_group_link)); | ||||
| 
 | ||||
| 	if (!_link.isHidden()) { | ||||
| 	if (_link.isHidden()) { | ||||
| 		QTextOption option(style::al_left); | ||||
| 		option.setWrapMode(QTextOption::WrapAnywhere); | ||||
| 		p.setFont(_linkOver ? st::newGroupLink.font->underline() : st::newGroupLink.font); | ||||
| 		p.setPen(st::btnDefLink.color); | ||||
| 		p.drawText(_invitationLink, _channel->invitationUrl, option); | ||||
| 		if (!_goodTextLink.isEmpty() && a_goodOpacity.current() > 0) { | ||||
| 			p.setOpacity(a_goodOpacity.current()); | ||||
| 			p.setPen(st::setGoodColor->p); | ||||
| 			p.setFont(st::setErrFont->f); | ||||
| 			p.drawTextRight(st::newGroupPadding.right(), _link.y() - st::newGroupLinkPadding.top() + st::newGroupLinkTop + st::newGroupLinkFont->ascent - st::setErrFont->ascent, width(), _goodTextLink); | ||||
| 			p.setOpacity(1); | ||||
| 		} | ||||
| 	} else { | ||||
| 		p.setFont(st::newGroupLink.font); | ||||
| 		p.setPen(st::newGroupLink.phColor); | ||||
| 		p.drawText(QRect(_link.x() + st::newGroupLink.textMrg.left(), _link.y() + st::newGroupLink.textMrg.top(), _link.width(), _link.height() - st::newGroupLink.textMrg.top() - st::newGroupLink.textMrg.bottom()), _linkPlaceholder, style::al_left); | ||||
|  | @ -1833,20 +1845,63 @@ void SetupChannelBox::paintEvent(QPaintEvent *e) { | |||
| void SetupChannelBox::resizeEvent(QResizeEvent *e) { | ||||
| 	_public.moveToLeft(st::newGroupPadding.left(), st::newGroupPadding.top(), width()); | ||||
| 	_private.moveToLeft(st::newGroupPadding.left(), _public.y() + _public.height() + _aboutPublicHeight + st::newGroupSkip, width()); | ||||
| 	_comments.moveToLeft(st::newGroupPadding.left(), _private.y() + _private.height() + _aboutPrivate.countHeight(_aboutPublicWidth) + st::newGroupSkip, width()); | ||||
| 
 | ||||
| 	_link.setGeometry(st::newGroupLinkPadding.left(), st::newGroupPadding.top() + _public.height() + _aboutPublicHeight + st::newGroupSkip + _private.height() + _aboutPrivate.countHeight(_aboutPublicWidth) + st::newGroupPadding.bottom() + st::newGroupLinkPadding.top(), width() - st::newGroupPadding.left() - st::newGroupPadding.right(), _link.height()); | ||||
| 	_link.setGeometry(st::newGroupLinkPadding.left(), _comments.y() + _comments.height() + _aboutComments.countHeight(_aboutPublicWidth) + st::newGroupPadding.bottom() + st::newGroupLinkPadding.top(), width() - st::newGroupPadding.left() - st::newGroupPadding.right(), _link.height()); | ||||
| 	_invitationLink = QRect(_link.x(), _link.y() + (_link.height() / 2) - st::newGroupLinkFont->height, _link.width(), 2 * st::newGroupLinkFont->height); | ||||
| 
 | ||||
| 	int32 buttonTop = _link.y() + _link.height() + st::newGroupLinkPadding.bottom(); | ||||
| 	_skip.moveToLeft(0, buttonTop, width()); | ||||
| 	_save.moveToRight(0, buttonTop, width()); | ||||
| } | ||||
| 
 | ||||
| void SetupChannelBox::mouseMoveEvent(QMouseEvent *e) { | ||||
| 	updateSelected(e->globalPos()); | ||||
| } | ||||
| 
 | ||||
| void SetupChannelBox::mousePressEvent(QMouseEvent *e) { | ||||
| 	mouseMoveEvent(e); | ||||
| 	if (_linkOver) { | ||||
| 		App::app()->clipboard()->setText(_channel->invitationUrl); | ||||
| 		_goodTextLink = lang(lng_create_channel_link_copied); | ||||
| 		a_goodOpacity = anim::fvalue(1, 0); | ||||
| 		a_good.start(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void SetupChannelBox::updateSelected(const QPoint &cursorGlobalPosition) { | ||||
| 	QPoint p(mapFromGlobal(cursorGlobalPosition)); | ||||
| 
 | ||||
| 	bool linkOver = _invitationLink.contains(p); | ||||
| 	if (linkOver != _linkOver) { | ||||
| 		_linkOver = linkOver; | ||||
| 		update(); | ||||
| 		setCursor(_linkOver ? style::cur_pointer : style::cur_default); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| bool SetupChannelBox::goodAnimStep(float64 ms) { | ||||
| 	float dt = ms / st::newGroupLinkFadeDuration; | ||||
| 	bool res = true; | ||||
| 	if (dt >= 1) { | ||||
| 		res = false; | ||||
| 		a_goodOpacity.finish(); | ||||
| 	} else { | ||||
| 		a_goodOpacity.update(dt, anim::linear); | ||||
| 	} | ||||
| 	update(); | ||||
| 	return res; | ||||
| } | ||||
| 
 | ||||
| void SetupChannelBox::closePressed() { | ||||
| 	App::wnd()->showLayer(new ContactsBox(_channel), true); | ||||
| } | ||||
| 
 | ||||
| void SetupChannelBox::onSave() { | ||||
| 	if (!_public.checked()) { | ||||
| 		if (_comments.checked()) { | ||||
| 			MTP::send(MTPchannels_ToggleComments(_channel->inputChannel, MTP_bool(true))); | ||||
| 		} | ||||
| 		onClose(); | ||||
| 	} | ||||
| 
 | ||||
|  | @ -1859,8 +1914,11 @@ void SetupChannelBox::onSave() { | |||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	if (_comments.checked()) { | ||||
| 		MTP::send(MTPchannels_ToggleComments(_channel->inputChannel, MTP_bool(true)), RPCResponseHandler(), 0, 5); | ||||
| 	} | ||||
| 	_sentUsername = link; | ||||
| 	_saveRequestId = MTP::send(MTPmessages_UpdateChannelUsername(_channel->inputChat, MTP_string(_sentUsername)), rpcDone(&SetupChannelBox::onUpdateDone), rpcFail(&SetupChannelBox::onUpdateFail)); | ||||
| 	_saveRequestId = MTP::send(MTPchannels_UpdateUsername(_channel->inputChannel, MTP_string(_sentUsername)), rpcDone(&SetupChannelBox::onUpdateDone), rpcFail(&SetupChannelBox::onUpdateFail)); | ||||
| } | ||||
| 
 | ||||
| void SetupChannelBox::onChange() { | ||||
|  | @ -1907,7 +1965,7 @@ void SetupChannelBox::onCheck() { | |||
| 	QString link = _link.text().trimmed(); | ||||
| 	if (link.size() >= MinUsernameLength) { | ||||
| 		_checkUsername = link; | ||||
| 		_checkRequestId = MTP::send(MTPmessages_CheckChannelUsername(_channel->inputChat, MTP_string(link)), rpcDone(&SetupChannelBox::onCheckDone), rpcFail(&SetupChannelBox::onCheckFail)); | ||||
| 		_checkRequestId = MTP::send(MTPchannels_CheckUsername(_channel->inputChannel, MTP_string(link)), rpcDone(&SetupChannelBox::onCheckDone), rpcFail(&SetupChannelBox::onCheckFail)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -1917,6 +1975,7 @@ void SetupChannelBox::onPrivacyChange() { | |||
| 		_link.setFocus(); | ||||
| 	} else { | ||||
| 		_link.hide(); | ||||
| 		setFocus(); | ||||
| 	} | ||||
| 	update(); | ||||
| } | ||||
|  |  | |||
|  | @ -317,11 +317,17 @@ public: | |||
| 	void keyPressEvent(QKeyEvent *e); | ||||
| 	void paintEvent(QPaintEvent *e); | ||||
| 	void resizeEvent(QResizeEvent *e); | ||||
| 	void mouseMoveEvent(QMouseEvent *e); | ||||
| 	void mousePressEvent(QMouseEvent *e); | ||||
| 
 | ||||
| 	void closePressed(); | ||||
| 
 | ||||
| 	void setInnerFocus() { | ||||
| 		_link.setFocus(); | ||||
| 		if (_link.isHidden()) { | ||||
| 			setFocus(); | ||||
| 		} else { | ||||
| 			_link.setFocus(); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| public slots: | ||||
|  | @ -340,13 +346,19 @@ protected: | |||
| 
 | ||||
| private: | ||||
| 
 | ||||
| 	void updateSelected(const QPoint &cursorGlobalPosition); | ||||
| 	bool goodAnimStep(float64 ms); | ||||
| 
 | ||||
| 	ChannelData *_channel; | ||||
| 
 | ||||
| 	FlatRadiobutton _public, _private; | ||||
| 	FlatCheckbox _comments; | ||||
| 	int32 _aboutPublicWidth, _aboutPublicHeight; | ||||
| 	Text _aboutPublic, _aboutPrivate; | ||||
| 	Text _aboutPublic, _aboutPrivate, _aboutComments; | ||||
| 	QString _linkPlaceholder; | ||||
| 	UsernameInput _link; | ||||
| 	QRect _invitationLink; | ||||
| 	bool _linkOver; | ||||
| 	FlatButton _save, _skip; | ||||
| 
 | ||||
| 	void onUpdateDone(const MTPBool &result); | ||||
|  | @ -358,5 +370,9 @@ private: | |||
| 	mtpRequestId _saveRequestId, _checkRequestId; | ||||
| 	QString _sentUsername, _checkUsername, _errorText, _goodText; | ||||
| 
 | ||||
| 	QString _goodTextLink; | ||||
| 	anim::fvalue a_goodOpacity; | ||||
| 	Animation a_good; | ||||
| 
 | ||||
| 	QTimer _checkTimer; | ||||
| }; | ||||
|  |  | |||
|  | @ -123,6 +123,8 @@ enum { | |||
| 	MaxUsernameLength = 32, | ||||
| 	UsernameCheckTimeout = 200, | ||||
| 
 | ||||
| 	MaxChannelDescription = 255, | ||||
| 
 | ||||
| 	MaxMessageSize = 4096, | ||||
| 	MaxHttpRedirects = 5, // when getting external data/images
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -1805,7 +1805,7 @@ void DialogsWidget::loadDialogs() { | |||
| 	int32 loadCount = _dialogsOffset ? DialogsPerPage : DialogsFirstLoad; | ||||
| 	_dialogsRequest = MTP::send(MTPmessages_GetDialogs(MTP_int(_dialogsOffset), MTP_int(loadCount)), rpcDone(&DialogsWidget::dialogsReceived), rpcFail(&DialogsWidget::dialogsFailed), 0, _channelDialogsRequest ? 0 : 5); | ||||
| 	if (!_channelDialogsRequest) { | ||||
| 		_channelDialogsRequest = MTP::send(MTPmessages_GetChannelDialogs(MTP_int(0), MTP_int(DialogsPerPage)), rpcDone(&DialogsWidget::dialogsReceived), rpcFail(&DialogsWidget::dialogsFailed)); | ||||
| 		_channelDialogsRequest = MTP::send(MTPchannels_GetDialogs(MTP_int(0), MTP_int(DialogsPerPage)), rpcDone(&DialogsWidget::dialogsReceived), rpcFail(&DialogsWidget::dialogsFailed)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org | |||
| #include "window.h" | ||||
| 
 | ||||
| FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(v, parent), | ||||
| _minHeight(-1), _maxHeight(-1), _ctrlEnterSubmit(true), | ||||
| _minHeight(-1), _maxHeight(-1), _maxLength(-1), _ctrlEnterSubmit(true), | ||||
| _ph(pholder), _oldtext(v), _phVisible(!v.length()), | ||||
| a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c), | ||||
| _st(st), _undoAvailable(false), _redoAvailable(false), _inDrop(false), _fakeMargin(0), | ||||
|  | @ -65,6 +65,10 @@ _touchPress(false), _touchRightButton(false), _touchMove(false), _replacingEmoji | |||
| 	if (App::wnd()) connect(this, SIGNAL(selectionChanged()), App::wnd(), SLOT(updateGlobalMenu())); | ||||
| } | ||||
| 
 | ||||
| void FlatTextarea::setMaxLength(int32 maxLength) { | ||||
| 	_maxLength = maxLength; | ||||
| } | ||||
| 
 | ||||
| void FlatTextarea::setMinHeight(int32 minHeight) { | ||||
| 	_minHeight = minHeight; | ||||
| 	heightAutoupdated(); | ||||
|  | @ -658,6 +662,30 @@ void FlatTextarea::processDocumentContentsChange(int position, int charsAdded) { | |||
| void FlatTextarea::onDocumentContentsChange(int position, int charsRemoved, int charsAdded) { | ||||
| 	if (_replacingEmojis) return; | ||||
| 
 | ||||
| 	_replacingEmojis = true; | ||||
| 	if (_maxLength >= 0) { | ||||
| 		QTextCursor c(document()->docHandle(), 0); | ||||
| 		c.movePosition(QTextCursor::End); | ||||
| 		int32 fullSize = c.position(), toRemove = fullSize - _maxLength; | ||||
| 		if (toRemove > 0) { | ||||
| 			if (toRemove > charsAdded) { | ||||
| 				if (charsAdded) { | ||||
| 					c.setPosition(position); | ||||
| 					c.setPosition((position + charsAdded), QTextCursor::KeepAnchor); | ||||
| 					c.removeSelectedText(); | ||||
| 				} | ||||
| 				c.setPosition(fullSize - (toRemove - charsAdded)); | ||||
| 				c.setPosition(fullSize, QTextCursor::KeepAnchor); | ||||
| 				c.removeSelectedText(); | ||||
| 			} else { | ||||
| 				c.setPosition(position + (charsAdded - toRemove)); | ||||
| 				c.setPosition(position + charsAdded, QTextCursor::KeepAnchor); | ||||
| 				c.removeSelectedText(); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	_replacingEmojis = false; | ||||
| 
 | ||||
| 	if (!_links.isEmpty()) { | ||||
| 		bool changed = false; | ||||
| 		for (LinkRanges::iterator i = _links.begin(); i != _links.end();) { | ||||
|  | @ -688,6 +716,7 @@ void FlatTextarea::onDocumentContentsChange(int position, int charsRemoved, int | |||
| 
 | ||||
| 	//	_insertions.push_back(Insertion(position, charsAdded));
 | ||||
| 	_replacingEmojis = true; | ||||
| 
 | ||||
| 	QSizeF s = document()->pageSize(); | ||||
| 	processDocumentContentsChange(position, charsAdded); | ||||
| 	if (document()->pageSize() != s) { | ||||
|  |  | |||
|  | @ -39,6 +39,7 @@ public: | |||
| 	void mousePressEvent(QMouseEvent *e); | ||||
| 	void dropEvent(QDropEvent *e); | ||||
| 
 | ||||
| 	void setMaxLength(int32 maxLength); | ||||
| 	void setMinHeight(int32 minHeight); | ||||
| 	void setMaxHeight(int32 maxHeight); | ||||
| 
 | ||||
|  | @ -107,6 +108,7 @@ private: | |||
| 	bool heightAutoupdated(); | ||||
| 
 | ||||
| 	int32 _minHeight, _maxHeight; // < 0 - no autosize
 | ||||
| 	int32 _maxLength; | ||||
| 	bool _ctrlEnterSubmit; | ||||
| 
 | ||||
| 	QString _ph, _phelided, _oldtext; | ||||
|  |  | |||
|  | @ -733,7 +733,7 @@ public: | |||
| 		return _from->isChannel(); | ||||
| 	} | ||||
| 	virtual bool needCheck() const { | ||||
| 		return out() && (!fromChannel() || id <= 0); | ||||
| 		return out(); | ||||
| 	} | ||||
| 	virtual bool hasPoint(int32 x, int32 y) const { | ||||
| 		return false; | ||||
|  |  | |||
|  | @ -3404,7 +3404,7 @@ void HistoryWidget::firstLoadMessages() { | |||
| 		from = _showAtMsgId; | ||||
| 	} | ||||
| 	if (_peer->isChannel()) { | ||||
| 		_firstLoadRequest = MTP::send(MTPmessages_GetImportantHistory(_peer->input, MTP_int(from), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 		_firstLoadRequest = MTP::send(MTPchannels_GetImportantHistory(_peer->asChannel()->inputChannel, MTP_int(from), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 	} else { | ||||
| 		_firstLoadRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(from), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 	} | ||||
|  | @ -3416,7 +3416,7 @@ void HistoryWidget::loadMessages() { | |||
| 	MsgId min = _history->minMsgId(); | ||||
| 	int32 offset = 0, loadCount = min ? MessagesPerPage : MessagesFirstLoad; | ||||
| 	if (_peer->isChannel()) { | ||||
| 		_preloadRequest = MTP::send(MTPmessages_GetImportantHistory(_peer->input, MTP_int(min), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 		_preloadRequest = MTP::send(MTPchannels_GetImportantHistory(_peer->asChannel()->inputChannel, MTP_int(min), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 	} else { | ||||
| 		_preloadRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(min), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 	} | ||||
|  | @ -3430,7 +3430,7 @@ void HistoryWidget::loadMessagesDown() { | |||
| 
 | ||||
| 	int32 loadCount = MessagesPerPage, offset = -loadCount; | ||||
| 	if (_peer->isChannel()) { | ||||
| 		_preloadDownRequest = MTP::send(MTPmessages_GetImportantHistory(_peer->input, MTP_int(max + 1), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 		_preloadDownRequest = MTP::send(MTPchannels_GetImportantHistory(_peer->asChannel()->inputChannel, MTP_int(max + 1), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 	} else { | ||||
| 		_preloadDownRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(max + 1), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 	} | ||||
|  | @ -3458,7 +3458,7 @@ void HistoryWidget::delayedShowAt(MsgId showAtMsgId) { | |||
| 		offset = -loadCount / 2; | ||||
| 	} | ||||
| 	if (_peer->isChannel()) { | ||||
| 		_delayedShowAtRequest = MTP::send(MTPmessages_GetImportantHistory(_peer->input, MTP_int(from), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 		_delayedShowAtRequest = MTP::send(MTPchannels_GetImportantHistory(_peer->asChannel()->inputChannel, MTP_int(from), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 	} else { | ||||
| 		_delayedShowAtRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(from), MTP_int(offset), MTP_int(loadCount), MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::messagesReceived, _peer), rpcFail(&HistoryWidget::messagesFailed)); | ||||
| 	} | ||||
|  | @ -3588,7 +3588,7 @@ void HistoryWidget::onBotStart() { | |||
| 		sendBotCommand(qsl("/start"), 0); | ||||
| 	} else { | ||||
| 		uint64 randomId = MTP::nonce<uint64>(); | ||||
| 		MTP::send(MTPmessages_StartBot(_peer->asUser()->inputUser, MTP_inputChatEmpty(), MTP_long(randomId), MTP_string(token)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _peer->asUser())); | ||||
| 		MTP::send(MTPmessages_StartBot(_peer->asUser()->inputUser, MTP_int(0), MTP_long(randomId), MTP_string(token)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _peer->asUser())); | ||||
| 
 | ||||
| 		_peer->asUser()->botInfo->startToken = QString(); | ||||
| 		if (_keyboard.hasMarkup()) { | ||||
|  |  | |||
|  | @ -2924,7 +2924,7 @@ namespace Local { | |||
| 			chat->invitationUrl = invitationUrl; | ||||
| 
 | ||||
| 			chat->input = MTP_inputPeerChat(MTP_int(peerToChat(chat->id))); | ||||
| 			chat->inputChat = MTP_inputChat(MTP_int(peerToChat(chat->id))); | ||||
| 			chat->inputChat = MTP_int(peerToChat(chat->id)); | ||||
| 
 | ||||
| 			chat->photo = photoLoc.isNull() ? ImagePtr(chatDefPhoto(chat->colorIndex)) : ImagePtr(photoLoc); | ||||
| 		} else if (result->isChannel()) { | ||||
|  | @ -2945,7 +2945,7 @@ namespace Local { | |||
| 			channel->invitationUrl = invitationUrl; | ||||
| 
 | ||||
| 			channel->input = MTP_inputPeerChannel(MTP_int(peerToChannel(channel->id)), MTP_long(access)); | ||||
| 			channel->inputChat = MTP_inputChannel(MTP_int(peerToChannel(channel->id)), MTP_long(access)); | ||||
| 			channel->inputChannel = MTP_inputChannel(MTP_int(peerToChannel(channel->id)), MTP_long(access)); | ||||
| 
 | ||||
| 			channel->photo = photoLoc.isNull() ? ImagePtr(chatDefPhoto(channel->colorIndex)) : ImagePtr(photoLoc); | ||||
| 		} | ||||
|  |  | |||
|  | @ -794,7 +794,7 @@ void MainWidget::deleteHistoryPart(PeerData *peer, const MTPmessages_AffectedHis | |||
| 
 | ||||
| void MainWidget::deleteMessages(PeerData *peer, const QVector<MTPint> &ids) { | ||||
| 	if (peer->isChannel()) { | ||||
| 		MTP::send(MTPmessages_DeleteChannelMessages(peer->asChannel()->input, MTP_vector<MTPint>(ids)), rpcDone(&MainWidget::messagesAffected, peer)); | ||||
| 		MTP::send(MTPchannels_DeleteMessages(peer->asChannel()->inputChannel, MTP_vector<MTPint>(ids)), rpcDone(&MainWidget::messagesAffected, peer)); | ||||
| 	} else { | ||||
| 		MTP::send(MTPmessages_DeleteMessages(MTP_vector<MTPint>(ids)), rpcDone(&MainWidget::messagesAffected, peer)); | ||||
| 	} | ||||
|  | @ -832,17 +832,22 @@ void MainWidget::removeContact(UserData *user) { | |||
| } | ||||
| 
 | ||||
| void MainWidget::addParticipants(PeerData *chatOrChannel, const QVector<UserData*> &users) { | ||||
| 	for (QVector<UserData*>::const_iterator i = users.cbegin(), e = users.cend(); i != e; ++i) { | ||||
| 		if (chatOrChannel->isChat()) { | ||||
| 	if (chatOrChannel->isChat()) { | ||||
| 		for (QVector<UserData*>::const_iterator i = users.cbegin(), e = users.cend(); i != e; ++i) { | ||||
| 			MTP::send(MTPmessages_AddChatUser(chatOrChannel->asChat()->inputChat, (*i)->inputUser, MTP_int(ForwardOnAdd)), rpcDone(&MainWidget::sentUpdatesReceived), rpcFail(&MainWidget::addParticipantFail, *i), 0, 5); | ||||
| 		} else if (chatOrChannel->isChannel()) { | ||||
| 			MTP::send(MTPmessages_AddChatUser(chatOrChannel->asChannel()->inputChat, (*i)->inputUser, MTP_int(0)), rpcDone(&MainWidget::sentUpdatesReceived), rpcFail(&MainWidget::addParticipantFail, *i), 0, 5); | ||||
| 		} | ||||
| 	} else if (chatOrChannel->isChannel()) { | ||||
| 		QVector<MTPInputUser> inputUsers; | ||||
| 		inputUsers.reserve(users.size()); | ||||
| 		for (QVector<UserData*>::const_iterator i = users.cbegin(), e = users.cend(); i != e; ++i) { | ||||
| 			inputUsers.push_back((*i)->inputUser); | ||||
| 		} | ||||
| 		MTP::send(MTPchannels_InviteToChannel(chatOrChannel->asChannel()->inputChannel, MTP_vector<MTPInputUser>(inputUsers)), rpcDone(&MainWidget::sentUpdatesReceived), rpcFail(&MainWidget::addParticipantsFail), 0, 5); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| bool MainWidget::addParticipantFail(UserData *user, const RPCError &error) { | ||||
| 	if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false; | ||||
| 	if (mtpIsFlood(error)) return false; | ||||
| 
 | ||||
| 	QString text = lang(lng_failed_add_participant); | ||||
| 	if (error.type() == "USER_LEFT_CHAT") { // trying to return banned user to his group
 | ||||
|  | @ -857,6 +862,20 @@ bool MainWidget::addParticipantFail(UserData *user, const RPCError &error) { | |||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| bool MainWidget::addParticipantsFail(const RPCError &error) { | ||||
| 	if (mtpIsFlood(error)) return false; | ||||
| 
 | ||||
| 	QString text = lang(lng_failed_add_participant); | ||||
| 	if (error.type() == "USER_LEFT_CHAT") { // trying to return banned user to his group
 | ||||
| 	} else if (error.type() == "USER_NOT_MUTUAL_CONTACT") { // trying to return user who does not have me in contacts
 | ||||
| 		text = lang(lng_failed_add_not_mutual); | ||||
| 	} else if (error.type() == "PEER_FLOOD") { | ||||
| 		text = lng_cant_invite_not_contact(lt_more_info, textcmdLink(qsl("https://telegram.org/faq?_hash=can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info))); | ||||
| 	} | ||||
| 	App::wnd()->showLayer(new ConfirmBox(text, true)); | ||||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| void MainWidget::kickParticipant(ChatData *chat, UserData *user) { | ||||
| 	MTP::send(MTPmessages_DeleteChatUser(chat->inputChat, user->inputUser), rpcDone(&MainWidget::sentUpdatesReceived), rpcFail(&MainWidget::kickParticipantFail, chat)); | ||||
| 	App::wnd()->hideLayer(); | ||||
|  | @ -872,7 +891,7 @@ bool MainWidget::kickParticipantFail(ChatData *chat, const RPCError &error) { | |||
| 
 | ||||
| void MainWidget::checkPeerHistory(PeerData *peer) { | ||||
| 	if (peer->isChannel()) { | ||||
| 		MTP::send(MTPmessages_GetImportantHistory(peer->input, MTP_int(0), MTP_int(0), MTP_int(1), MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::checkedHistory, peer)); | ||||
| 		MTP::send(MTPchannels_GetImportantHistory(peer->asChannel()->inputChannel, MTP_int(0), MTP_int(0), MTP_int(1), MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::checkedHistory, peer)); | ||||
| 	} else { | ||||
| 		MTP::send(MTPmessages_GetHistory(peer->input, MTP_int(0), MTP_int(0), MTP_int(1), MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::checkedHistory, peer)); | ||||
| 	} | ||||
|  | @ -1516,9 +1535,9 @@ void MainWidget::photosLoaded(History *h, const MTPmessages_Messages &msgs, mtpR | |||
| void MainWidget::sendReadRequest(PeerData *peer, MsgId upTo) { | ||||
| 	if (!MTP::authedId()) return; | ||||
| 	if (peer->isChannel()) { | ||||
| 		_readRequests.insert(peer, MTP::send(MTPmessages_ReadChannelHistory(peer->input, MTP_int(upTo)), rpcDone(&MainWidget::channelWasRead, peer), rpcFail(&MainWidget::readRequestFail, peer))); | ||||
| 		_readRequests.insert(peer, qMakePair(MTP::send(MTPchannels_ReadHistory(peer->asChannel()->inputChannel, MTP_int(upTo)), rpcDone(&MainWidget::channelWasRead, peer), rpcFail(&MainWidget::readRequestFail, peer)), upTo)); | ||||
| 	} else { | ||||
| 		_readRequests.insert(peer, MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(upTo), MTP_int(0)), rpcDone(&MainWidget::partWasRead, peer), rpcFail(&MainWidget::readRequestFail, peer))); | ||||
| 		_readRequests.insert(peer, qMakePair(MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(upTo), MTP_int(0)), rpcDone(&MainWidget::partWasRead, peer), rpcFail(&MainWidget::readRequestFail, peer)), upTo)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -1531,10 +1550,10 @@ void MainWidget::partWasRead(PeerData *peer, const MTPmessages_AffectedHistory & | |||
| 	ptsUpdated(d.vpts.v, d.vpts_count.v); | ||||
|      | ||||
| 	int32 offset = d.voffset.v; | ||||
| 	if (!MTP::authedId() || offset <= 0 || true) { | ||||
| 	if (!MTP::authedId() || offset <= 0) { | ||||
| 		readRequestDone(peer); | ||||
|     } else { | ||||
| //        _readRequests[peer] = MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(upTo), MTP_int(offset)), rpcDone(&MainWidget::partWasRead, peer));
 | ||||
|         _readRequests[peer].first = MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(_readRequests[peer].second), MTP_int(offset)), rpcDone(&MainWidget::partWasRead, peer)); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -3117,7 +3136,7 @@ void MainWidget::getChannelDifference(ChannelData *channel, GetChannelDifference | |||
| 
 | ||||
| 	LOG(("Getting channel difference for %1").arg(channel->pts())); | ||||
| 	channel->ptsSetRequesting(true); | ||||
| 	MTP::send(MTPupdates_GetChannelDifference(channel->input, MTP_channelMessagesFilterCollapsed(), MTP_int(channel->pts()), MTP_int(MTPChannelGetDifferenceLimit)), rpcDone(&MainWidget::gotChannelDifference, channel), rpcFail(&MainWidget::failChannelDifference, channel)); | ||||
| 	MTP::send(MTPupdates_GetChannelDifference(channel->inputChannel, MTP_channelMessagesFilterCollapsed(), MTP_int(channel->pts()), MTP_int(MTPChannelGetDifferenceLimit)), rpcDone(&MainWidget::gotChannelDifference, channel), rpcFail(&MainWidget::failChannelDifference, channel)); | ||||
| } | ||||
| 
 | ||||
| void MainWidget::mtpPing() { | ||||
|  | @ -3298,7 +3317,7 @@ void MainWidget::onInviteImport() { | |||
| 	if (_inviteHash.isEmpty()) return; | ||||
| 	if (_inviteHash.at(0) == '/') { | ||||
| 		PeerId id = _inviteHash.midRef(1).toULongLong(); | ||||
| 		MTP::send(MTPmessages_AddChatUser(MTP_inputChat(MTP_int(peerToChat(id))), App::self()->inputUser, MTP_int(ForwardOnAdd)), rpcDone(&MainWidget::inviteImportDone), rpcFail(&MainWidget::inviteImportFail), 0, 5); | ||||
| 		MTP::send(MTPmessages_AddChatUser(MTP_int(peerToChat(id)), App::self()->inputUser, MTP_int(ForwardOnAdd)), rpcDone(&MainWidget::inviteImportDone), rpcFail(&MainWidget::inviteImportFail), 0, 5); | ||||
| 	} else { | ||||
| 		MTP::send(MTPmessages_ImportChatInvite(MTP_string(_inviteHash)), rpcDone(&MainWidget::inviteImportDone), rpcFail(&MainWidget::inviteImportFail)); | ||||
| 	} | ||||
|  | @ -4120,18 +4139,17 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { | |||
| 
 | ||||
| 	case mtpc_updateReadChannelInbox: { | ||||
| 		const MTPDupdateReadChannelInbox &d(update.c_updateReadChannelInbox()); | ||||
| 		App::feedInboxRead(peerFromMTP(d.vpeer), d.vmax_id.v); | ||||
| 		App::feedInboxRead(peerFromChannel(d.vchannel_id.v), d.vmax_id.v); | ||||
| 	} break; | ||||
| 
 | ||||
| 	case mtpc_updateDeleteChannelMessages: { | ||||
| 		const MTPDupdateDeleteChannelMessages &d(update.c_updateDeleteChannelMessages()); | ||||
| 		PeerId peer = peerFromMTP(d.vpeer); | ||||
| 		if (ChannelData *channel = App::channelLoaded(peerToChannel(peer))) { | ||||
| 		if (ChannelData *channel = App::channelLoaded(d.vchannel_id.v)) { | ||||
| 			if (!channel->ptsUpdated(d.vpts.v, d.vpts_count.v, update)) { | ||||
| 				return; | ||||
| 			} | ||||
| 		} | ||||
| 		App::feedWereDeleted(peerToChannel(peer), d.vmessages.c_vector().v); | ||||
| 		App::feedWereDeleted(d.vchannel_id.v, d.vmessages.c_vector().v); | ||||
| 		history.peerMessagesUpdated(); | ||||
| 	} break; | ||||
| 
 | ||||
|  | @ -4154,10 +4172,8 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { | |||
| 
 | ||||
| 	case mtpc_updateChannelMessageViews: { | ||||
| 		const MTPDupdateChannelMessageViews &d(update.c_updateChannelMessageViews()); | ||||
| 		if (HistoryItem *item = App::histItemById(peerToChannel(peerFromMTP(d.vpeer)), d.vid.v)) { | ||||
| 			if (item->from()->id == peerFromMTP(d.vpeer) && item->channelId() != NoChannel) { | ||||
| 				item->setViewsCount(d.vviews.v); | ||||
| 			} | ||||
| 		if (HistoryItem *item = App::histItemById(d.vchannel_id.v, d.vid.v)) { | ||||
| 			item->setViewsCount(d.vviews.v); | ||||
| 		} | ||||
| 	} break; | ||||
| 
 | ||||
|  |  | |||
|  | @ -293,6 +293,7 @@ public: | |||
| 
 | ||||
| 	void addParticipants(PeerData *chatOrChannel, const QVector<UserData*> &users); | ||||
| 	bool addParticipantFail(UserData *user, const RPCError &e); | ||||
| 	bool addParticipantsFail(const RPCError &e); // for multi invite in channels
 | ||||
| 
 | ||||
| 	void kickParticipant(ChatData *chat, UserData *user); | ||||
| 	bool kickParticipantFail(ChatData *chat, const RPCError &e); | ||||
|  | @ -572,7 +573,7 @@ private: | |||
| 	QSet<PeerData*> updateNotifySettingPeers; | ||||
| 	SingleTimer updateNotifySettingTimer; | ||||
|      | ||||
|     typedef QMap<PeerData*, mtpRequestId> ReadRequests; | ||||
|     typedef QMap<PeerData*, QPair<mtpRequestId, MsgId> > ReadRequests; | ||||
|     ReadRequests _readRequests; | ||||
| 	typedef QMap<PeerData*, MsgId> ReadRequestsPending; | ||||
| 	ReadRequestsPending _readRequestsPending; | ||||
|  |  | |||
|  | @ -54,14 +54,16 @@ enum { | |||
| 	MTPDstickerSet_flag_official = (1 << 2), | ||||
| 	MTPDstickerSet_flag_NOT_LOADED = (1 << 31), // client side flag for not yet loaded set
 | ||||
| 
 | ||||
| 	MTPDchannel_flag_is_admin = (1 << 0), | ||||
| 	MTPDchannel_flag_is_broadcast = (1 << 1), | ||||
| 	MTPDchannel_flag_is_public = (1 << 2), | ||||
| 	MTPDchannel_flag_left = (1 << 3), | ||||
| 	MTPDchannel_flag_kicked = (1 << 4), | ||||
| 	MTPDchannel_flag_am_admin = (1 << 0), | ||||
| 	MTPDchannel_flag_was_kicked = (1 << 1), | ||||
| 	MTPDchannel_flag_have_left = (1 << 2), | ||||
| 	MTPDchannel_flag_am_publisher = (1 << 3), | ||||
| 	MTPDchannel_flag_am_moderator = (1 << 4), | ||||
| 	MTPDchannel_flag_is_broadcast = (1 << 5), | ||||
| 
 | ||||
| 	MTPDchat_flag_left = (1 << 3), | ||||
| 	MTPDchat_flag_kicked = (1 << 4), | ||||
| 	MTPDchat_flag_creator = (1 << 0), | ||||
| 	MTPDchat_flag_kicked = (1 << 1), | ||||
| 	MTPDchat_flag_left = (1 << 2), | ||||
| 
 | ||||
| 	MTPupdates_ChannelDifference_flag_final = (1 << 0), | ||||
| 
 | ||||
|  |  | |||
|  | @ -366,7 +366,7 @@ static const mtpTypeId mtpLayers[] = { | |||
| 	mtpc_invokeWithLayer17, | ||||
| 	mtpc_invokeWithLayer18, | ||||
| }, mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]); | ||||
| static const mtpPrime mtpCurrentLayer = 40; | ||||
| static const mtpPrime mtpCurrentLayer = 38; | ||||
| 
 | ||||
| template <typename bareT> | ||||
| class MTPBoxed : public bareT { | ||||
|  |  | |||
|  | @ -1253,7 +1253,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				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("  access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 3: to.add("  title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 4: to.add("  username: "); ++stages.back(); if (flag & MTPDchannel::flag_username) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; | ||||
| 				case 4: to.add("  username: "); ++stages.back(); if (flag & MTPDchannel::flag_username) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; | ||||
| 				case 5: to.add("  photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 6: 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("  version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
|  | @ -1361,21 +1361,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channelParticipants: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channelParticipants"); | ||||
| 					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("  channel_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("  self_participant: "); ++stages.back(); if (flag & MTPDchannelParticipants::flag_self_participant) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; | ||||
| 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_chatPhotoEmpty: | ||||
| 				to.add("{ chatPhotoEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
|  | @ -2847,7 +2832,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					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 0: to.add("  channel_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("  max_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; | ||||
| 				} | ||||
|  | @ -2861,7 +2846,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					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 0: to.add("  channel_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("  messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); 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; | ||||
|  | @ -2877,7 +2862,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					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 0: to.add("  channel_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("  views: "); ++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; | ||||
|  | @ -4571,21 +4556,8 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_inputChatEmpty: | ||||
| 				to.add("{ inputChatEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_inputChat: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ inputChat"); | ||||
| 					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; | ||||
| 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||
| 				} | ||||
| 			case mtpc_inputChannelEmpty: | ||||
| 				to.add("{ inputChannelEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_inputChannel: | ||||
|  | @ -4602,6 +4574,36 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_contacts_resolvedPeer: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ contacts_resolvedPeer"); | ||||
| 					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("  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_channelParticipants: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channelParticipants"); | ||||
| 					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("  channel_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("  self_participant: "); ++stages.back(); if (flag & MTPDchannelParticipants::flag_self_participant) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; | ||||
| 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_messageRange: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
|  | @ -4711,21 +4713,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				to.add("{ channelMessagesFilterCollapsed }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_contacts_resolvedPeer: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ contacts_resolvedPeer"); | ||||
| 					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("  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_channelParticipant: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
|  | @ -4756,11 +4743,11 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channelParticipantPublisher: | ||||
| 			case mtpc_channelParticipantEditor: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channelParticipantPublisher"); | ||||
| 					to.add("{ channelParticipantEditor"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
|  | @ -4771,6 +4758,21 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channelParticipantKicked: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channelParticipantKicked"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  user_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("  kicked_by: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 2: to.add("  date: "); ++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_channelParticipantCreator: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
|  | @ -4792,6 +4794,10 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				to.add("{ channelParticipantsAdmins }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channelParticipantsKicked: | ||||
| 				to.add("{ channelParticipantsKicked }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channelRoleEmpty: | ||||
| 				to.add("{ channelRoleEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
|  | @ -4800,15 +4806,15 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				to.add("{ channelRoleModerator }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channelRolePublisher: | ||||
| 				to.add("{ channelRolePublisher }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			case mtpc_channelRoleEditor: | ||||
| 				to.add("{ channelRoleEditor }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_messages_channelParticipants: | ||||
| 			case mtpc_channels_channelParticipants: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_channelParticipants"); | ||||
| 					to.add("{ channels_channelParticipants"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
|  | @ -4819,6 +4825,20 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channels_channelParticipant: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_channelParticipant"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  participant: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: 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_req_pq: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
|  | @ -5291,91 +5311,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_messages_readChannelHistory: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_readChannelHistory"); | ||||
| 					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("  max_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_messages_incrementMessagesViews: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_incrementMessagesViews"); | ||||
| 					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("  id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); 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_editChatAbout: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_editChatAbout"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  about: "); ++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_editChatAdmin: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_editChatAdmin"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 2: to.add("  role: "); ++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_checkChannelUsername: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_checkChannelUsername"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  username: "); ++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_updateChannelUsername: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_updateChannelUsername"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  username: "); ++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_upload_saveFilePart: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
|  | @ -5420,6 +5355,77 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channels_readHistory: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_readHistory"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  max_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_channels_editAbout: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_editAbout"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  about: "); ++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_channels_editAdmin: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_editAdmin"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 2: to.add("  role: "); ++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_channels_checkUsername: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_checkUsername"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  username: "); ++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_channels_updateUsername: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_updateUsername"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  username: "); ++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_invokeAfterMsg: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
|  | @ -5876,6 +5882,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				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("  id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 2: to.add("  increment: "); ++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; | ||||
|  | @ -5959,15 +5966,15 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_messages_getImportantHistory: | ||||
| 			case mtpc_channels_getImportantHistory: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_getImportantHistory"); | ||||
| 					to.add("{ channels_getImportantHistory"); | ||||
| 					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 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  offset_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("  add_offset: "); ++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; | ||||
|  | @ -5977,15 +5984,15 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_messages_getChannelMessages: | ||||
| 			case mtpc_channels_getMessages: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_getChannelMessages"); | ||||
| 					to.add("{ channels_getMessages"); | ||||
| 					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 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); 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; | ||||
| 				} | ||||
|  | @ -6005,11 +6012,11 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_messages_getChannelDialogs: | ||||
| 			case mtpc_channels_getDialogs: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_getChannelDialogs"); | ||||
| 					to.add("{ channels_getDialogs"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
|  | @ -6074,15 +6081,15 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_messages_deleteChannelMessages: | ||||
| 			case mtpc_channels_deleteMessages: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_deleteChannelMessages"); | ||||
| 					to.add("{ channels_deleteMessages"); | ||||
| 					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 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); 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; | ||||
| 				} | ||||
|  | @ -6163,7 +6170,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				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("  title: "); ++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; | ||||
| 				} | ||||
|  | @ -6177,7 +6184,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				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("  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; | ||||
| 				} | ||||
|  | @ -6191,7 +6198,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				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("  user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 2: to.add("  fwd_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; | ||||
|  | @ -6206,7 +6213,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				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("  user_id: "); ++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; | ||||
| 				} | ||||
|  | @ -6279,18 +6286,18 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  bot: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: 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 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; | ||||
| 				case 3: to.add("  start_param: "); ++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_createChannel: | ||||
| 			case mtpc_channels_createChannel: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_createChannel"); | ||||
| 					to.add("{ channels_createChannel"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
|  | @ -6302,20 +6309,116 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_messages_toggleChannelComments: | ||||
| 			case mtpc_channels_editTitle: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_toggleChannelComments"); | ||||
| 					to.add("{ channels_editTitle"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 0: to.add("  channel: "); ++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; | ||||
| 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channels_editPhoto: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_editPhoto"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++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_channels_toggleComments: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_toggleComments"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  enabled: "); ++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_channels_joinChannel: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_joinChannel"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++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_channels_leaveChannel: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_leaveChannel"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++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_channels_inviteToChannel: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_inviteToChannel"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: 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_channels_kickFromChannel: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_kickFromChannel"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 2: to.add("  kicked: "); ++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_channels_deleteChannel: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_deleteChannel"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++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_getChats: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
|  | @ -6324,6 +6427,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); 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_channels_getChannels: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_getChannels"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  id: "); ++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; | ||||
| 				} | ||||
|  | @ -6337,7 +6453,20 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				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; | ||||
| 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channels_getFullChannel: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_getFullChannel"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++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; | ||||
|  | @ -6506,7 +6635,20 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				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; | ||||
| 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channels_exportInvite: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_exportInvite"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++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; | ||||
|  | @ -6537,22 +6679,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_messages_getChannelParticipants: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ messages_getChannelParticipants"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  filter: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 2: to.add("  offset: "); ++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_updates_getState: | ||||
| 				to.add("{ updates_getState }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); | ||||
| 			break; | ||||
|  | @ -6580,7 +6706,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 					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 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  filter: "); ++stages.back(); types.push_back(0); 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("  limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
|  | @ -6706,6 +6832,36 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP | |||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_channels_getParticipants: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_getParticipants"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  filter: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 2: to.add("  offset: "); ++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_channels_getParticipant: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
| 				} else { | ||||
| 					to.add("{ channels_getParticipant"); | ||||
| 					to.add("\n").addSpaces(lev); | ||||
| 				} | ||||
| 				switch (stage) { | ||||
| 				case 0: to.add("  channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				case 1: to.add("  user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; | ||||
| 				default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; | ||||
| 				} | ||||
| 			break; | ||||
| 
 | ||||
| 			case mtpc_rpc_result: | ||||
| 				if (stage) { | ||||
| 					to.add(",\n").addSpaces(lev); | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -218,17 +218,16 @@ userStatusLastMonth#77ebc742 = UserStatus; | |||
| chatEmpty#9ba2d800 id:int = Chat; | ||||
| chat#7312bc48 flags:# id:int title:string photo:ChatPhoto participants_count:int date:int version:int = Chat; | ||||
| chatForbidden#7328bdb id:int title:string = Chat; | ||||
| channel#1bcc63f2 flags:# id:int access_hash:long title:string username:flags.2?string photo:ChatPhoto date:int version:int = Chat; | ||||
| channel#678e9587 flags:# id:int access_hash:long title:string username:flags.6?string photo:ChatPhoto date:int version:int = Chat; | ||||
| channelForbidden#2d85832c id:int access_hash:long title:string = Chat; | ||||
| 
 | ||||
| chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> = ChatFull; | ||||
| channelFull#b28da8f8 id:int participants:ChatParticipants about:string read_inbox_max_id:int unread_count:int unread_important_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite = ChatFull; | ||||
| channelFull#36949a50 id:int participants:ChannelParticipants about:string read_inbox_max_id:int unread_count:int unread_important_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite = ChatFull; | ||||
| 
 | ||||
| chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; | ||||
| 
 | ||||
| chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; | ||||
| chatParticipants#7841b415 chat_id:int admin_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants; | ||||
| channelParticipants#b561ad0c flags:# channel_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; | ||||
| 
 | ||||
| chatPhotoEmpty#37c1011c = ChatPhoto; | ||||
| chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; | ||||
|  | @ -382,9 +381,9 @@ updateChannelTooLong#60946422 channel_id:int = Update; | |||
| updateChannel#b6d45656 channel_id:int = Update; | ||||
| updateChannelGroup#c36c1e3c channel_id:int group:MessageGroup = Update; | ||||
| updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; | ||||
| updateReadChannelInbox#87b87b7d peer:Peer max_id:int = Update; | ||||
| updateDeleteChannelMessages#11da3046 peer:Peer messages:Vector<int> pts:int pts_count:int = Update; | ||||
| updateChannelMessageViews#f3349b09 peer:Peer id:int views:int = Update; | ||||
| updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; | ||||
| updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update; | ||||
| updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; | ||||
| 
 | ||||
| updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; | ||||
| 
 | ||||
|  | @ -584,9 +583,12 @@ messageEntityCode#28a20571 offset:int length:int = MessageEntity; | |||
| messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; | ||||
| messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; | ||||
| 
 | ||||
| inputChatEmpty#d9ff343c = InputChat; | ||||
| inputChat#43a5b9c3 chat_id:int = InputChat; | ||||
| inputChannel#30c6ce73 channel_id:int access_hash:long = InputChat; | ||||
| inputChannelEmpty#ee8c1e86 = InputChannel; | ||||
| inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; | ||||
| 
 | ||||
| contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer; | ||||
| 
 | ||||
| channelParticipants#57d3e762 flags:# channel_id:int self_participant:flags.0?ChannelParticipant = ChannelParticipants; | ||||
| 
 | ||||
| messageRange#ae30253 min_id:int max_id:int = MessageRange; | ||||
| 
 | ||||
|  | @ -600,21 +602,23 @@ channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; | |||
| channelMessagesFilter#cd77d957 flags:# ranges:Vector<MessageRange> = ChannelMessagesFilter; | ||||
| channelMessagesFilterCollapsed#fa01232e = ChannelMessagesFilter; | ||||
| 
 | ||||
| contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer; | ||||
| 
 | ||||
| channelParticipant#506116ea user_id:int inviter_id:int date:int = ChannelParticipant; | ||||
| channelParticipantModerator#91057fef user_id:int inviter_id:int date:int = ChannelParticipant; | ||||
| channelParticipantPublisher#375d616 user_id:int inviter_id:int date:int = ChannelParticipant; | ||||
| channelParticipantEditor#98192d61 user_id:int inviter_id:int date:int = ChannelParticipant; | ||||
| channelParticipantKicked#8cc5e69a user_id:int kicked_by:int date:int = ChannelParticipant; | ||||
| channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; | ||||
| 
 | ||||
| channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; | ||||
| channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; | ||||
| channelParticipantsKicked#3c37bb7a = ChannelParticipantsFilter; | ||||
| 
 | ||||
| channelRoleEmpty#b285a0c6 = ChannelParticipantRole; | ||||
| channelRoleModerator#9618d975 = ChannelParticipantRole; | ||||
| channelRolePublisher#515b5530 = ChannelParticipantRole; | ||||
| channelRoleEditor#820bfe8c = ChannelParticipantRole; | ||||
| 
 | ||||
| messages.channelParticipants#d6891de1 count:int participants:Vector<ChannelParticipant> users:Vector<User> = messages.ChannelParticipants; | ||||
| channels.channelParticipants#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants; | ||||
| 
 | ||||
| channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector<User> = channels.ChannelParticipant; | ||||
| 
 | ||||
| ---functions--- | ||||
| 
 | ||||
|  | @ -695,12 +699,12 @@ messages.sendMessage#fa88427a flags:# peer:InputPeer reply_to_msg_id:flags.0?int | |||
| 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#708e0195 flags:# from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer = Updates; | ||||
| messages.reportSpam#cf1592db peer:InputPeer = Bool; | ||||
| messages.getChats#27ae65b id:Vector<InputChat> = messages.Chats; | ||||
| messages.getFullChat#36a4dfe chat_id:InputChat = messages.ChatFull; | ||||
| messages.editChatTitle#6699d506 chat_id:InputChat title:string = Updates; | ||||
| messages.editChatPhoto#dd75758d chat_id:InputChat photo:InputChatPhoto = Updates; | ||||
| messages.addChatUser#819183f4 chat_id:InputChat user_id:InputUser fwd_limit:int = Updates; | ||||
| messages.deleteChatUser#9392c06f chat_id:InputChat user_id:InputUser = Updates; | ||||
| messages.getChats#3c6aa187 id:Vector<int> = messages.Chats; | ||||
| messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; | ||||
| messages.editChatTitle#dc452855 chat_id:int title:string = Updates; | ||||
| messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; | ||||
| messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; | ||||
| messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; | ||||
| messages.createChat#9cb126e users:Vector<InputUser> title:string = 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; | ||||
|  | @ -718,31 +722,18 @@ messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages | |||
| messages.getStickers#ae22e045 emoticon:string hash:string = messages.Stickers; | ||||
| messages.getAllStickers#aa3bc868 hash:string = messages.AllStickers; | ||||
| messages.getWebPagePreview#25223e24 message:string = MessageMedia; | ||||
| messages.exportChatInvite#c26902ba chat_id:InputChat = ExportedChatInvite; | ||||
| messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; | ||||
| messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; | ||||
| messages.importChatInvite#6c50051c hash:string = Updates; | ||||
| messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; | ||||
| messages.installStickerSet#7b30c3a6 stickerset:InputStickerSet disabled:Bool = Bool; | ||||
| messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; | ||||
| messages.startBot#f4cc052d bot:InputUser chat_id:InputChat random_id:long start_param:string = Updates; | ||||
| messages.getChannelDialogs#92689583 offset:int limit:int = messages.Dialogs; | ||||
| messages.getImportantHistory#24af43a5 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; | ||||
| messages.readChannelHistory#36a1210e peer:InputPeer max_id:int = Bool; | ||||
| messages.createChannel#7f44d2c3 flags:# title:string about:string users:Vector<InputUser> = Updates; | ||||
| messages.toggleChannelComments#b405b8af chat_id:InputChat enabled:Bool = Updates; | ||||
| messages.deleteChannelMessages#9995a84f peer:InputPeer id:Vector<int> = messages.AffectedMessages; | ||||
| messages.getChannelMessages#5f46b265 peer:InputPeer id:Vector<int> = messages.Messages; | ||||
| messages.incrementMessagesViews#91ffd479 peer:InputPeer id:Vector<int> = Bool; | ||||
| messages.getMessagesViews#9abfbbe1 peer:InputPeer id:Vector<int> = Vector<int>; | ||||
| messages.editChatAbout#8a969b93 chat_id:InputChat about:string = Bool; | ||||
| messages.getChannelParticipants#38a1db31 chat_id:InputChat filter:ChannelParticipantsFilter offset:int limit:int = messages.ChannelParticipants; | ||||
| messages.editChatAdmin#62394070 chat_id:InputChat user_id:InputUser role:ChannelParticipantRole = Bool; | ||||
| messages.checkChannelUsername#e6d2d8f4 chat_id:InputChat username:string = Bool; | ||||
| messages.updateChannelUsername#ce2e9587 chat_id:InputChat username:string = Bool; | ||||
| messages.startBot#1b3e0ffc bot:InputUser chat_id:int random_id:long start_param:string = Updates; | ||||
| messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>; | ||||
| 
 | ||||
| updates.getState#edd4882a = updates.State; | ||||
| updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; | ||||
| updates.getChannelDifference#248af4f5 peer:InputPeer filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; | ||||
| updates.getChannelDifference#bb32d7c0 channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; | ||||
| 
 | ||||
| photos.updateProfilePhoto#eef579a0 id:InputPhoto crop:InputPhotoCrop = UserProfilePhoto; | ||||
| photos.uploadProfilePhoto#d50f9c88 file:InputFile caption:string geo_point:InputGeoPoint crop:InputPhotoCrop = photos.Photo; | ||||
|  | @ -760,3 +751,27 @@ help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool; | |||
| help.getInviteText#a4a95186 lang_code:string = help.InviteText; | ||||
| help.getSupport#9cdf08cd = help.Support; | ||||
| help.getAppChangelog#5bab7fb2 device_model:string system_version:string app_version:string lang_code:string = help.AppChangelog; | ||||
| 
 | ||||
| channels.getDialogs#a9d3d249 offset:int limit:int = messages.Dialogs; | ||||
| channels.getImportantHistory#ddb929cb channel:InputChannel offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; | ||||
| channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; | ||||
| channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages; | ||||
| channels.getMessages#93d7b347 channel:InputChannel id:Vector<int> = messages.Messages; | ||||
| channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants; | ||||
| channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; | ||||
| channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats; | ||||
| channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; | ||||
| channels.createChannel#5521d844 flags:# title:string about:string users:Vector<InputUser> = Updates; | ||||
| channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; | ||||
| channels.editAdmin#52b16962 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Bool; | ||||
| channels.editTitle#566decd0 channel:InputChannel title:string = Updates; | ||||
| channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; | ||||
| channels.toggleComments#aaa29e88 channel:InputChannel enabled:Bool = Updates; | ||||
| channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; | ||||
| channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; | ||||
| channels.joinChannel#24b524c5 channel:InputChannel = Updates; | ||||
| channels.leaveChannel#f836aa95 channel:InputChannel = Updates; | ||||
| channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates; | ||||
| channels.kickFromChannel#a672de14 channel:InputChannel user_id:InputUser kicked:Bool = Updates; | ||||
| channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; | ||||
| channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; | ||||
|  |  | |||
|  | @ -104,10 +104,9 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee | |||
| 		if (chatPhoto && chatPhoto->date) { | ||||
| 			_photoLink = TextLinkPtr(new PhotoLink(chatPhoto, _peer)); | ||||
| 		} | ||||
| 		if (_peerChannel->photoId == UnknownPeerPhotoId) { | ||||
| 		if (_peerChannel->photoId == UnknownPeerPhotoId || (_peerChannel->invitationUrl.isEmpty() && _peerChannel->adminned)) { | ||||
| 			App::api()->requestFullPeer(_peer); | ||||
| 		} | ||||
| //		MTP::send(MTPmessages_UpdateChannelUsername(_peerChannel->inputChat, MTP_string("tdesktop_channel")));
 | ||||
| 	} | ||||
| 
 | ||||
| 	// profile
 | ||||
|  | @ -382,7 +381,11 @@ void ProfileInner::onCreateInvitationLink() { | |||
| 
 | ||||
| void ProfileInner::onCreateInvitationLinkSure() { | ||||
| 	if (!_peerChat && !_peerChannel) return; | ||||
| 	MTP::send(MTPmessages_ExportChatInvite(_peerChat ? _peerChat->inputChat : _peerChannel->inputChat), rpcDone(&ProfileInner::chatInviteDone)); | ||||
| 	if (_peerChat) { | ||||
| 		MTP::send(MTPmessages_ExportChatInvite(_peerChat->inputChat), rpcDone(&ProfileInner::chatInviteDone)); | ||||
| 	} else if (_peerChannel) { | ||||
| 		MTP::send(MTPchannels_ExportInvite(_peerChannel->inputChannel), rpcDone(&ProfileInner::chatInviteDone)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void ProfileInner::chatInviteDone(const MTPExportedChatInvite &result) { | ||||
|  |  | |||
|  | @ -345,11 +345,11 @@ public: | |||
| class ChatData : public PeerData { | ||||
| public: | ||||
| 
 | ||||
| 	ChatData(const PeerId &id) : PeerData(id), inputChat(MTP_inputChat(MTP_int(bareId()))), count(0), date(0), version(0), admin(0), inviterForSpamReport(0), left(false), forbidden(true), botStatus(0) { | ||||
| 	ChatData(const PeerId &id) : PeerData(id), inputChat(MTP_int(bareId())), count(0), date(0), version(0), admin(0), inviterForSpamReport(0), left(false), forbidden(true), botStatus(0) { | ||||
| 	} | ||||
| 	void setPhoto(const MTPChatPhoto &photo, const PhotoId &phId = UnknownPeerPhotoId); | ||||
| 
 | ||||
| 	MTPInputChat inputChat; | ||||
| 	MTPint inputChat; | ||||
| 
 | ||||
| 	int32 count; | ||||
| 	int32 date; | ||||
|  | @ -415,7 +415,7 @@ private: | |||
| class ChannelData : public PeerData { | ||||
| public: | ||||
| 
 | ||||
| 	ChannelData(const PeerId &id) : PeerData(id), access(0), inputChat(MTP_inputChannel(MTP_int(bareId()), MTP_long(0))), date(0), version(0), isBroadcast(false), isPublic(false), adminned(false), left(false), forbidden(true), botStatus(-1) { | ||||
| 	ChannelData(const PeerId &id) : PeerData(id), access(0), inputChannel(MTP_inputChannel(MTP_int(bareId()), MTP_long(0))), date(0), version(0), isBroadcast(false), isPublic(false), adminned(false), left(false), forbidden(true), botStatus(-1) { | ||||
| 		setName(QString(), QString()); | ||||
| 	} | ||||
| 	void setPhoto(const MTPChatPhoto &photo, const PhotoId &phId = UnknownPeerPhotoId); | ||||
|  | @ -423,7 +423,7 @@ public: | |||
| 
 | ||||
| 	uint64 access; | ||||
| 
 | ||||
| 	MTPInputChat inputChat; | ||||
| 	MTPinputChannel inputChannel; | ||||
| 
 | ||||
| 	QString username; | ||||
| 	int32 date; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue