fixed entities, version 0.8.53.dev

This commit is contained in:
John Preston 2015-08-28 19:30:32 +03:00
parent 9a51e2c7e3
commit 77b0ca2220
4 changed files with 13 additions and 11 deletions

View file

@ -188,7 +188,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
"lng_settings_show_preview" = "Show message preview";
"lng_settings_use_windows" = "Use Windows notifications";
"lng_settings_sound_notify" = "Play sound";
"lng_settings_include_muted" = "Include muted chats in the unread badge";
"lng_settings_include_muted" = "Include muted chats in unread count";
"lng_notification_preview" = "You have a new message";

View file

@ -674,7 +674,7 @@ void Application::checkMapVersion() {
if (Local::oldMapVersion()) {
QString versionFeatures;
if (cDevVersion() && Local::oldMapVersion() < 8053) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Include muted chats in the unread badge setting\n\xe2\x80\x94 Shared links overview and search in shared media");// .replace('@', qsl("@") + QChar(0x200D));
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Include muted chats in unread count in Settings\n\xe2\x80\x94 Shared links overview and search in shared media");// .replace('@', qsl("@") + QChar(0x200D));
} else if (!cDevVersion() && Local::oldMapVersion() < 8052) {
versionFeatures = lang(lng_new_version_minor).trimmed();
}

View file

@ -554,15 +554,16 @@ public:
start = src.constData();
end = start + src.size();
while (start != end && chIsTrimmed(*start, rich)) {
++start;
ptr = start;
while (ptr != end && chIsTrimmed(*ptr, rich)) {
++ptr;
}
while (start != end && chIsTrimmed(*(end - 1), rich)) {
while (ptr != end && chIsTrimmed(*(end - 1), rich)) {
--end;
}
_t->_text.resize(0);
_t->_text.reserve(end - start);
_t->_text.reserve(end - ptr);
diacs = 0;
sumWidth = 0;
@ -575,7 +576,7 @@ public:
lastSpace = true;
waitingLink = lnkRanges.cbegin();
linksEnd = lnkRanges.cend();
for (ptr = start; ptr <= end; ++ptr) {
for (; ptr <= end; ++ptr) {
if (!checkWaitedLink()) {
break;
}

View file

@ -1002,7 +1002,7 @@ void MainWidget::sendPreparedText(History *hist, const QString &text, MsgId repl
App::historyRegSentText(randomId, sendingText);
MTPstring msgText(MTP_string(sendingText));
int32 flags = newMessageFlags(hist->peer); // unread, out
int32 flags = newMessageFlags(hist->peer) | MTPDmessage::flag_entities; // unread, out
int32 sendFlags = 0;
if (replyTo) {
flags |= MTPDmessage::flag_reply_to_msg_id;
@ -1016,7 +1016,7 @@ void MainWidget::sendPreparedText(History *hist, const QString &text, MsgId repl
media = MTP_messageMediaWebPage(MTP_webPagePending(MTP_long(page->id), MTP_int(page->pendingTill)));
}
MTPVector<MTPMessageEntity> localEntities = linksToMTP(textParseLinks(sendingText, itemTextParseOptions(hist, App::self()).flags));
hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(hist->peer->id), MTPint(), MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, MTPnullEntities));
hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(hist->peer->id), MTPint(), MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities));
hist->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_int(sendFlags), hist->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, localEntities), App::main()->rpcDone(&MainWidget::sentDataReceived, randomId), RPCFailHandlerPtr(), 0, 0, hist->sendRequestId);
}
@ -1744,11 +1744,12 @@ void MainWidget::dialogsCancelled() {
}
void MainWidget::serviceNotification(const QString &msg, const MTPMessageMedia &media, bool unread) {
int32 flags = unread ? MTPDmessage_flag_unread : 0;
int32 flags = (unread ? MTPDmessage_flag_unread : 0) | MTPDmessage::flag_entities;
QString sendingText, leftText = msg;
HistoryItem *item = 0;
while (textSplit(sendingText, leftText, MaxMessageSize)) {
item = App::histories().addToBack(MTP_message(MTP_int(flags), MTP_int(clientMsgId()), MTP_int(ServiceUserId), MTP_peerUser(MTP_int(MTP::authedId())), MTPint(), MTPint(), MTPint(), MTP_int(unixtime()), MTP_string(sendingText), media, MTPnullMarkup, MTPnullEntities), unread ? 1 : 2);
MTPVector<MTPMessageEntity> localEntities = linksToMTP(textParseLinks(sendingText, _historyTextOptions.flags));
item = App::histories().addToBack(MTP_message(MTP_int(flags), MTP_int(clientMsgId()), MTP_int(ServiceUserId), MTP_peerUser(MTP_int(MTP::authedId())), MTPint(), MTPint(), MTPint(), MTP_int(unixtime()), MTP_string(sendingText), media, MTPnullMarkup, localEntities), unread ? 1 : 2);
}
if (item) {
history.peerMessagesUpdated(item->history()->peer->id);