2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Move sendMessage and sendInlineResult to ApiWrap.

This commit is contained in:
John Preston
2018-06-26 16:34:38 +01:00
parent ff53404d5b
commit 33095966af
14 changed files with 362 additions and 331 deletions

View File

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

View File

@@ -63,11 +63,9 @@ public:
void refresh(bool toTop = false);
bool chooseRow();
void saveRecentHashtags(const QString &text);
void destroyData();
Dialogs::RowDescriptor chatListEntryBefore(
const Dialogs::RowDescriptor &which) const;
Dialogs::RowDescriptor chatListEntryAfter(

View File

@@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_connecting_widget.h"
#include "profile/profile_channel_controllers.h"
#include "storage/storage_media_prepare.h"
#include "storage/localstorage.h"
#include "data/data_session.h"
#include "styles/style_dialogs.h"
#include "styles/style_window.h"
@@ -637,7 +638,7 @@ void DialogsWidget::searchMessages(
_searchTimer.stop();
onSearchMessages();
_inner->saveRecentHashtags(query);
Local::saveRecentSearchHashtags(query);
}
}