mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 22:46:10 +00:00
Move sendMessage and sendInlineResult to ApiWrap.
This commit is contained in:
@@ -2403,7 +2403,7 @@ bool DialogsInner::chooseHashtag() {
|
||||
_mouseSelection = true;
|
||||
updateSelected();
|
||||
} else {
|
||||
saveRecentHashtags('#' + hashtag->tag);
|
||||
Local::saveRecentSearchHashtags('#' + hashtag->tag);
|
||||
emit completeHashtag(hashtag->tag);
|
||||
}
|
||||
return true;
|
||||
@@ -2456,7 +2456,7 @@ bool DialogsInner::chooseRow() {
|
||||
const auto chosen = computeChosenRow();
|
||||
if (chosen.key) {
|
||||
if (IsServerMsgId(chosen.message.fullId.msg)) {
|
||||
saveRecentHashtags(_filter);
|
||||
Local::saveRecentSearchHashtags(_filter);
|
||||
}
|
||||
const auto openSearchResult = !App::main()->selectingPeer(true)
|
||||
&& (_state == State::Filtered)
|
||||
@@ -2485,38 +2485,6 @@ bool DialogsInner::chooseRow() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void DialogsInner::saveRecentHashtags(const QString &text) {
|
||||
auto found = false;
|
||||
QRegularExpressionMatch m;
|
||||
auto recent = cRecentSearchHashtags();
|
||||
for (int32 i = 0, next = 0; (m = TextUtilities::RegExpHashtag().match(text, i)).hasMatch(); i = next) {
|
||||
i = m.capturedStart();
|
||||
next = m.capturedEnd();
|
||||
if (m.hasMatch()) {
|
||||
if (!m.capturedRef(1).isEmpty()) {
|
||||
++i;
|
||||
}
|
||||
if (!m.capturedRef(2).isEmpty()) {
|
||||
--next;
|
||||
}
|
||||
}
|
||||
const auto tag = text.mid(i + 1, next - i - 1);
|
||||
if (TextUtilities::RegExpHashtagExclude().match(tag).hasMatch()) {
|
||||
continue;
|
||||
}
|
||||
if (!found && cRecentWriteHashtags().isEmpty() && cRecentSearchHashtags().isEmpty()) {
|
||||
Local::readRecentHashtagsAndBots();
|
||||
recent = cRecentSearchHashtags();
|
||||
}
|
||||
found = true;
|
||||
Stickers::IncrementRecentHashtag(recent, tag);
|
||||
}
|
||||
if (found) {
|
||||
cSetRecentSearchHashtags(recent);
|
||||
Local::writeRecentHashtagsAndBots();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogsInner::destroyData() {
|
||||
_selected = nullptr;
|
||||
_hashtagSelected = -1;
|
||||
|
Reference in New Issue
Block a user