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

Method sendCreateTopicRequest

Telegram/SourceFiles/data/data_histories.cpp:1057–1085  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1055}
1056
1057void Histories::sendCreateTopicRequest(
1058 not_null<History*> history,
1059 MsgId rootId) {
1060 const auto forum = history->asForum();
1061 Assert(forum != nullptr);
1062 const auto topic = forum->topicFor(rootId);
1063 Assert(topic != nullptr);
1064 const auto randomId = base::RandomValue<uint64>();
1065 session().data().registerMessageRandomId(
1066 randomId,
1067 { history->peer->id, rootId });
1068 const auto api = &session().api();
1069 using Flag = MTPmessages_CreateForumTopic::Flag;
1070 api->request(MTPmessages_CreateForumTopic(
1071 MTP_flags(Flag::f_icon_color
1072 | (topic->iconId() ? Flag::f_icon_emoji_id : Flag())
1073 | (history->peer->isBot() ? Flag::f_title_missing : Flag())),
1074 history->peer->input(),
1075 MTP_string(topic->title()),
1076 MTP_int(topic->colorId()),
1077 MTP_long(topic->iconId()),
1078 MTP_long(randomId),
1079 MTPInputPeer() // send_as
1080 )).done([=](const MTPUpdates &result) {
1081 api->applyUpdates(result, randomId);
1082 }).fail([=](const MTP::Error &error) {
1083 api->sendMessageFail(error, history->peer, randomId);
1084 }).send();
1085}
1086
1087bool Histories::isCreatingTopic(
1088 not_null<History*> history,

Callers

nothing calls this directly

Calls 15

MTP_flagsFunction · 0.85
MTP_stringFunction · 0.85
MTP_longFunction · 0.85
asForumMethod · 0.80
topicForMethod · 0.80
apiMethod · 0.80
iconIdMethod · 0.80
colorIdMethod · 0.80
sendMessageFailMethod · 0.80
FlagEnum · 0.70
MTP_intFunction · 0.70

Tested by

no test coverage detected