diff --git a/Telegram/Resources/scheme.tl b/Telegram/Resources/scheme.tl index 6db5b301f46b07..5d1104105daf15 100644 --- a/Telegram/Resources/scheme.tl +++ b/Telegram/Resources/scheme.tl @@ -166,7 +166,7 @@ inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#922aec1 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#b6f74335 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; -inputMediaInvoice#92153685 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string start_param:string = InputMedia; +inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; inputMediaGeoLive#7b1a118f geo_point:InputGeoPoint period:int = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; @@ -219,7 +219,7 @@ userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; -channel#cb44b1c flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights = Chat; +channel#450b7115 flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; @@ -236,7 +236,7 @@ chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; -message#90dddc11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string = Message; +message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; @@ -461,7 +461,7 @@ upload.fileCdnRedirect#ea52fe5a dc_id:int file_token:bytes encryption_key:bytes dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int = DcOption; -config#9c840964 flags:# phonecalls_enabled:flags.1?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int disabled_features:Vector = Config; +config#9c840964 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; @@ -710,7 +710,7 @@ messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_off exportedMessageLink#1f486803 link:string = ExportedMessageLink; -messageFwdHeader#fadff4ac flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string = MessageFwdHeader; +messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; @@ -823,7 +823,7 @@ dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; -invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true currency:string prices:Vector = Invoice; +invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; @@ -935,6 +935,8 @@ recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; help.recentMeUrls#e0310d7 urls:Vector chats:Vector users:Vector = help.RecentMeUrls; +inputSingleMedia#5eaa7809 media:InputMedia random_id:long = InputSingleMedia; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1019,7 +1021,7 @@ messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; -messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; +messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; @@ -1100,6 +1102,8 @@ messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; messages.getRecentLocations#249431e2 peer:InputPeer limit:int = messages.Messages; +messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector = Updates; +messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -1192,4 +1196,4 @@ langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; -// LAYER 72 +// LAYER 73 diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 64c8eaf2f2bba1..9346d6c92b51b7 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -1893,7 +1893,8 @@ void ApiWrap::applyUpdatesNoPtsCheck(const MTPUpdates &updates) { d.has_entities() ? d.ventities : MTPnullEntities, MTPint(), MTPint(), - MTPstring()), NewMessageUnread); + MTPstring(), + MTPlong()), NewMessageUnread); } break; case mtpc_updateShortChatMessage: { @@ -1914,7 +1915,8 @@ void ApiWrap::applyUpdatesNoPtsCheck(const MTPUpdates &updates) { d.has_entities() ? d.ventities : MTPnullEntities, MTPint(), MTPint(), - MTPstring()), NewMessageUnread); + MTPstring(), + MTPlong()), NewMessageUnread); } break; case mtpc_updateShortSentMessage: { diff --git a/Telegram/SourceFiles/history/history_admin_log_item.cpp b/Telegram/SourceFiles/history/history_admin_log_item.cpp index b852139c77c322..e5fadfdabf875d 100644 --- a/Telegram/SourceFiles/history/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/history_admin_log_item.cpp @@ -50,13 +50,44 @@ MTPMessage PrepareLogMessage(const MTPMessage &message, MsgId newId, int32 newDa case mtpc_messageEmpty: return MTP_messageEmpty(MTP_int(newId)); case mtpc_messageService: { auto &data = message.c_messageService(); - auto flags = data.vflags.v & ~(MTPDmessageService::Flag::f_out | MTPDmessageService::Flag::f_post/* | MTPDmessageService::Flag::f_reply_to_msg_id*/); - return MTP_messageService(MTP_flags(flags), MTP_int(newId), data.vfrom_id, data.vto_id, data.vreply_to_msg_id, MTP_int(newDate), data.vaction); + auto removeFlags = MTPDmessageService::Flag::f_out + | MTPDmessageService::Flag::f_post + /* | MTPDmessageService::Flag::f_reply_to_msg_id*/; + auto flags = data.vflags.v & ~removeFlags; + return MTP_messageService( + MTP_flags(flags), + MTP_int(newId), + data.vfrom_id, + data.vto_id, + data.vreply_to_msg_id, + MTP_int(newDate), + data.vaction); } break; case mtpc_message: { auto &data = message.c_message(); - auto flags = data.vflags.v & ~(MTPDmessage::Flag::f_out | MTPDmessage::Flag::f_post | MTPDmessage::Flag::f_reply_to_msg_id | MTPDmessage::Flag::f_edit_date); - return MTP_message(MTP_flags(flags), MTP_int(newId), data.vfrom_id, data.vto_id, data.vfwd_from, data.vvia_bot_id, data.vreply_to_msg_id, MTP_int(newDate), data.vmessage, data.vmedia, data.vreply_markup, data.ventities, data.vviews, data.vedit_date, MTP_string("")); + auto removeFlags = MTPDmessage::Flag::f_out + | MTPDmessage::Flag::f_post + | MTPDmessage::Flag::f_reply_to_msg_id + | MTPDmessage::Flag::f_edit_date + | MTPDmessage::Flag::f_grouped_id; + auto flags = data.vflags.v & ~removeFlags; + return MTP_message( + MTP_flags(flags), + MTP_int(newId), + data.vfrom_id, + data.vto_id, + data.vfwd_from, + data.vvia_bot_id, + data.vreply_to_msg_id, + MTP_int(newDate), + data.vmessage, + data.vmedia, + data.vreply_markup, + data.ventities, + data.vviews, + data.vedit_date, + MTP_string(""), + data.vgrouped_id); } break; } Unexpected("Type in PrepareLogMessage()"); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 03b1877ae38769..128d70be16d17a 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -3095,7 +3095,29 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const } auto messageFromId = channelPost ? 0 : Auth().userId(); auto messagePostAuthor = channelPost ? (Auth().user()->firstName + ' ' + Auth().user()->lastName) : QString(); - history->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(messageFromId), peerToMTP(peer), MTPnullFwdHeader, MTPint(), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint(), MTP_string(messagePostAuthor)), NewMessageUnread); + history->addNewMessage( + MTP_message( + MTP_flags(flags), + MTP_int(newId.msg), + MTP_int(messageFromId), + peerToMTP(peer), + MTPnullFwdHeader, + MTPint(), + MTP_int(replyToId()), + MTP_int(unixtime()), + MTP_string(""), + MTP_messageMediaContact( + MTP_string(phone), + MTP_string(fname), + MTP_string(lname), + MTP_int(userId)), + MTPnullMarkup, + MTPnullEntities, + MTP_int(1), + MTPint(), + MTP_string(messagePostAuthor), + MTPlong()), + NewMessageUnread); history->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), p->input, MTP_int(replyTo), MTP_inputMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, history->sendRequestId); App::historyRegRandom(randomId, newId); @@ -4368,15 +4390,59 @@ void HistoryWidget::sendFileConfirmed(const FileLoadResultPtr &file) { if (!file->caption.isEmpty()) { photoFlags |= MTPDmessageMediaPhoto::Flag::f_caption; } - auto photo = MTP_messageMediaPhoto(MTP_flags(photoFlags), file->photo, MTP_string(file->caption), MTPint()); - h->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(messageFromId), peerToMTP(file->to.peer), MTPnullFwdHeader, MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), photo, MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint(), MTP_string(messagePostAuthor)), NewMessageUnread); + auto photo = MTP_messageMediaPhoto( + MTP_flags(photoFlags), + file->photo, + MTP_string(file->caption), + MTPint()); + h->addNewMessage( + MTP_message( + MTP_flags(flags), + MTP_int(newId.msg), + MTP_int(messageFromId), + peerToMTP(file->to.peer), + MTPnullFwdHeader, + MTPint(), + MTP_int(file->to.replyTo), + MTP_int(unixtime()), + MTP_string(""), + photo, + MTPnullMarkup, + MTPnullEntities, + MTP_int(1), + MTPint(), + MTP_string(messagePostAuthor), + MTPlong()), + NewMessageUnread); } else if (file->type == SendMediaType::File) { auto documentFlags = MTPDmessageMediaDocument::Flag::f_document | 0; if (!file->caption.isEmpty()) { documentFlags |= MTPDmessageMediaDocument::Flag::f_caption; } - auto document = MTP_messageMediaDocument(MTP_flags(documentFlags), file->document, MTP_string(file->caption), MTPint()); - h->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(messageFromId), peerToMTP(file->to.peer), MTPnullFwdHeader, MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), document, MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint(), MTP_string(messagePostAuthor)), NewMessageUnread); + auto document = MTP_messageMediaDocument( + MTP_flags(documentFlags), + file->document, + MTP_string(file->caption), + MTPint()); + h->addNewMessage( + MTP_message( + MTP_flags(flags), + MTP_int(newId.msg), + MTP_int(messageFromId), + peerToMTP(file->to.peer), + MTPnullFwdHeader, + MTPint(), + MTP_int(file->to.replyTo), + MTP_int(unixtime()), + MTP_string(""), + document, + MTPnullMarkup, + MTPnullEntities, + MTP_int(1), + MTPint(), + MTP_string(messagePostAuthor), + MTPlong()), + NewMessageUnread); } else if (file->type == SendMediaType::Audio) { if (!h->peer->isChannel()) { flags |= MTPDmessage::Flag::f_media_unread; @@ -4385,8 +4451,30 @@ void HistoryWidget::sendFileConfirmed(const FileLoadResultPtr &file) { if (!file->caption.isEmpty()) { documentFlags |= MTPDmessageMediaDocument::Flag::f_caption; } - auto document = MTP_messageMediaDocument(MTP_flags(documentFlags), file->document, MTP_string(file->caption), MTPint()); - h->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(messageFromId), peerToMTP(file->to.peer), MTPnullFwdHeader, MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), document, MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint(), MTP_string(messagePostAuthor)), NewMessageUnread); + auto document = MTP_messageMediaDocument( + MTP_flags(documentFlags), + file->document, + MTP_string(file->caption), + MTPint()); + h->addNewMessage( + MTP_message( + MTP_flags(flags), + MTP_int(newId.msg), + MTP_int(messageFromId), + peerToMTP(file->to.peer), + MTPnullFwdHeader, + MTPint(), + MTP_int(file->to.replyTo), + MTP_int(unixtime()), + MTP_string(""), + document, + MTPnullMarkup, + MTPnullEntities, + MTP_int(1), + MTPint(), + MTP_string(messagePostAuthor), + MTPlong()), + NewMessageUnread); } if (_peer && file->to.peer == _peer->id) { @@ -4415,8 +4503,25 @@ void HistoryWidget::onPhotoUploaded(const FullMsgId &newId, bool silent, const M sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } auto caption = item->getMedia() ? item->getMedia()->getCaption() : TextWithEntities(); - auto media = MTP_inputMediaUploadedPhoto(MTP_flags(0), file, MTP_string(caption.text), MTPVector(), MTP_int(0)); - hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), item->history()->peer->input, MTP_int(replyTo), media, MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); + auto media = MTP_inputMediaUploadedPhoto( + MTP_flags(0), + file, + MTP_string(caption.text), + MTPVector(), + MTP_int(0)); + hist->sendRequestId = MTP::send( + MTPmessages_SendMedia( + MTP_flags(sendFlags), + item->history()->peer->input, + MTP_int(replyTo), + media, + MTP_long(randomId), + MTPnullMarkup), + App::main()->rpcDone(&MainWidget::sentUpdatesReceived), + App::main()->rpcFail(&MainWidget::sendMessageFail), + 0, + 0, + hist->sendRequestId); } } @@ -4448,7 +4553,19 @@ void HistoryWidget::onDocumentUploaded(const FullMsgId &newId, bool silent, cons MTP_string(caption.text), MTPVector(), MTP_int(0)); - hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), item->history()->peer->input, MTP_int(replyTo), media, MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); + hist->sendRequestId = MTP::send( + MTPmessages_SendMedia( + MTP_flags(sendFlags), + item->history()->peer->input, + MTP_int(replyTo), + media, + MTP_long(randomId), + MTPnullMarkup), + App::main()->rpcDone(&MainWidget::sentUpdatesReceived), + App::main()->rpcFail(&MainWidget::sendMessageFail), + 0, + 0, + hist->sendRequestId); } } } @@ -4472,8 +4589,28 @@ void HistoryWidget::onThumbDocumentUploaded(const FullMsgId &newId, bool silent, sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } auto caption = media ? media->getCaption() : TextWithEntities(); - auto media = MTP_inputMediaUploadedDocument(MTP_flags(MTPDinputMediaUploadedDocument::Flag::f_thumb), file, thumb, MTP_string(document->mimeString()), composeDocumentAttributes(document), MTP_string(caption.text), MTPVector(), MTP_int(0)); - hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), item->history()->peer->input, MTP_int(replyTo), media, MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); + auto media = MTP_inputMediaUploadedDocument( + MTP_flags(MTPDinputMediaUploadedDocument::Flag::f_thumb), + file, + thumb, + MTP_string(document->mimeString()), + composeDocumentAttributes(document), + MTP_string(caption.text), + MTPVector(), + MTP_int(0)); + hist->sendRequestId = MTP::send( + MTPmessages_SendMedia( + MTP_flags(sendFlags), + item->history()->peer->input, + MTP_int(replyTo), + media, + MTP_long(randomId), + MTPnullMarkup), + App::main()->rpcDone(&MainWidget::sentUpdatesReceived), + App::main()->rpcFail(&MainWidget::sendMessageFail), + 0, + 0, + hist->sendRequestId); } } } diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_send_data.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_send_data.cpp index d220e7abd2fe26..9824e003b49f97 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_send_data.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_send_data.cpp @@ -43,7 +43,25 @@ UserId viaBotId, MsgId replyToId, const QString &postAuthor, const MTPReplyMarku if (!fields.entities.v.isEmpty()) { flags |= MTPDmessage::Flag::f_entities; } - history->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(msgId), MTP_int(fromId), peerToMTP(history->peer->id), MTPnullFwdHeader, MTP_int(viaBotId), MTP_int(replyToId), mtpDate, fields.text, fields.media, markup, fields.entities, MTP_int(1), MTPint(), MTP_string(postAuthor)), NewMessageUnread); + history->addNewMessage( + MTP_message( + MTP_flags(flags), + MTP_int(msgId), + MTP_int(fromId), + peerToMTP(history->peer->id), + MTPnullFwdHeader, + MTP_int(viaBotId), + MTP_int(replyToId), + mtpDate, + fields.text, + fields.media, + markup, + fields.entities, + MTP_int(1), + MTPint(), + MTP_string(postAuthor), + MTPlong()), + NewMessageUnread); } QString SendDataCommon::getErrorOnSend(const Result *owner, History *history) const { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 796c3ea381f2c8..bd92d782390b8f 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1566,7 +1566,25 @@ void MainWidget::sendMessage(const MessageToSend &message) { } auto messageFromId = channelPost ? 0 : Auth().userId(); auto messagePostAuthor = channelPost ? (Auth().user()->firstName + ' ' + Auth().user()->lastName) : QString(); - lastMessage = history->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(messageFromId), peerToMTP(history->peer->id), MTPnullFwdHeader, MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities, MTP_int(1), MTPint(), MTP_string(messagePostAuthor)), NewMessageUnread); + lastMessage = history->addNewMessage( + MTP_message( + MTP_flags(flags), + MTP_int(newId.msg), + MTP_int(messageFromId), + peerToMTP(history->peer->id), + MTPnullFwdHeader, + MTPint(), + MTP_int(replyTo), + MTP_int(unixtime()), + msgText, + media, + MTPnullMarkup, + localEntities, + MTP_int(1), + MTPint(), + MTP_string(messagePostAuthor), + MTPlong()), + NewMessageUnread); history->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_flags(sendFlags), history->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, sentEntities), rpcDone(&MainWidget::sentUpdatesReceived, randomId), rpcFail(&MainWidget::sendMessageFail), 0, 0, history->sendRequestId); } @@ -2148,7 +2166,24 @@ void MainWidget::insertCheckedServiceNotification(const TextWithEntities &messag HistoryItem *item = nullptr; while (TextUtilities::CutPart(sending, left, MaxMessageSize)) { auto localEntities = TextUtilities::EntitiesToMTP(sending.entities); - item = App::histories().addNewMessage(MTP_message(MTP_flags(flags), MTP_int(clientMsgId()), MTP_int(ServiceUserId), MTP_peerUser(MTP_int(Auth().userId())), MTPnullFwdHeader, MTPint(), MTPint(), MTP_int(date), MTP_string(sending.text), media, MTPnullMarkup, localEntities, MTPint(), MTPint(), MTPstring()), NewMessageUnread); + item = App::histories().addNewMessage( + MTP_message( + MTP_flags(flags), + MTP_int(clientMsgId()), + MTP_int(ServiceUserId), + MTP_peerUser(MTP_int(Auth().userId())), + MTPnullFwdHeader, + MTPint(), + MTPint(), + MTP_int(date), + MTP_string(sending.text), + media, + MTPnullMarkup, + localEntities, + MTPint(), + MTPint(), + MTPstring(), + MTPlong()), NewMessageUnread); } if (item) { _history->peerMessagesUpdated(item->history()->peer->id); diff --git a/Telegram/SourceFiles/mtproto/type_utils.cpp b/Telegram/SourceFiles/mtproto/type_utils.cpp index 021ffaf4c5c6c6..3fb39a1f808704 100644 --- a/Telegram/SourceFiles/mtproto/type_utils.cpp +++ b/Telegram/SourceFiles/mtproto/type_utils.cpp @@ -20,6 +20,16 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #include "mtproto/type_utils.h" -const MTPReplyMarkup MTPnullMarkup = MTP_replyKeyboardMarkup(MTP_flags(0), MTP_vector(0)); +const MTPReplyMarkup MTPnullMarkup = MTP_replyKeyboardMarkup( + MTP_flags(0), + MTP_vector(0)); const MTPVector MTPnullEntities = MTP_vector(0); -const MTPMessageFwdHeader MTPnullFwdHeader = MTP_messageFwdHeader(MTP_flags(0), MTPint(), MTPint(), MTPint(), MTPint(), MTPstring()); +const MTPMessageFwdHeader MTPnullFwdHeader = MTP_messageFwdHeader( + MTP_flags(0), + MTPint(), + MTPint(), + MTPint(), + MTPint(), + MTPstring(), + MTPPeer(), + MTPint());