2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

API scheme updated to layer 73.

This commit is contained in:
John Preston
2017-12-03 18:38:05 +04:00
parent 5eeb8143b6
commit 1d85c8a6b6
7 changed files with 268 additions and 31 deletions

View File

@@ -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);