MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / SetChatLinkDraft

Function SetChatLinkDraft

Telegram/SourceFiles/data/data_drafts.cpp:160–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160void SetChatLinkDraft(not_null<PeerData*> peer, TextWithEntities draft) {
161 static const auto kInlineStart = QRegularExpression("^@[a-zA-Z0-9_]");
162 if (kInlineStart.match(draft.text).hasMatch()) {
163 draft = TextWithEntities().append(' ').append(std::move(draft));
164 }
165
166 const auto textWithTags = TextWithTags{
167 draft.text,
168 TextUtilities::ConvertEntitiesToTextTags(draft.entities)
169 };
170 const auto cursor = MessageCursor{
171 int(textWithTags.text.size()),
172 int(textWithTags.text.size()),
173 Ui::kQFixedMax
174 };
175 const auto history = peer->owner().history(peer->id);
176 const auto topicRootId = MsgId();
177 const auto monoforumPeerId = PeerId();
178 history->setLocalDraft(std::make_unique<Draft>(
179 textWithTags,
180 FullReplyTo{
181 .topicRootId = topicRootId,
182 .monoforumPeerId = monoforumPeerId,
183 },
184 SuggestOptions(),
185 cursor,
186 WebPageDraft()));
187 history->clearLocalEditDraft(topicRootId, monoforumPeerId);
188 history->session().changes().entryUpdated(
189 history,
190 EntryUpdate::Flag::LocalDraftSet);
191}
192
193} // namespace Data

Callers 2

showPeerByLinkMethod · 0.85

Calls 14

TextWithEntitiesClass · 0.85
PeerIdClass · 0.85
SuggestOptionsClass · 0.85
setLocalDraftMethod · 0.80
clearLocalEditDraftMethod · 0.80
entryUpdatedMethod · 0.80
MsgIdClass · 0.70
WebPageDraftClass · 0.70
appendMethod · 0.45
sizeMethod · 0.45
historyMethod · 0.45
ownerMethod · 0.45

Tested by

no test coverage detected