mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Update API scheme to layer 150.
This commit is contained in:
@@ -45,6 +45,8 @@ void ConfirmPhone::resolve(
|
||||
return 0;
|
||||
}, [&](const MTPDauth_sentCodeTypeSms &data) {
|
||||
return data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeFragmentSms &data) {
|
||||
return data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeCall &data) {
|
||||
return data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeFlashCall &) {
|
||||
|
||||
@@ -592,8 +592,10 @@ void GroupInfoBox::createGroup(
|
||||
return;
|
||||
}
|
||||
_creationRequestId = _api.request(MTPmessages_CreateChat(
|
||||
MTP_flags(0),
|
||||
MTP_vector<TLUsers>(inputs),
|
||||
MTP_string(title)
|
||||
MTP_string(title),
|
||||
MTPint() // ttl_period
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
auto image = _photo->takeResultImage();
|
||||
const auto navigation = _navigation;
|
||||
@@ -683,7 +685,8 @@ void GroupInfoBox::createChannel(
|
||||
MTP_string(title),
|
||||
MTP_string(description),
|
||||
MTPInputGeoPoint(), // geo_point
|
||||
MTPstring() // address
|
||||
MTPstring(), // address
|
||||
MTPint() // ttl_period
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_navigation->session().api().applyUpdates(result);
|
||||
|
||||
|
||||
@@ -229,6 +229,9 @@ void ChangePhone::EnterPhone::sendPhoneDone(
|
||||
}, [&](const MTPDauth_sentCodeTypeSms &typeData) {
|
||||
codeLength = typeData.vlength().v;
|
||||
return true;
|
||||
}, [&](const MTPDauth_sentCodeTypeFragmentSms &typeData) {
|
||||
codeLength = typeData.vlength().v;
|
||||
return true;
|
||||
}, [&](const MTPDauth_sentCodeTypeCall &typeData) {
|
||||
codeLength = typeData.vlength().v;
|
||||
return true;
|
||||
|
||||
@@ -513,7 +513,8 @@ void EditForumTopicBox(
|
||||
MTP_int(rootId),
|
||||
MTP_string(title->getLastText().trimmed()),
|
||||
MTP_long(state->iconId.current()),
|
||||
MTPBool() // closed
|
||||
MTPBool(), // closed
|
||||
MTPBool() // hidden
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
api->applyUpdates(result);
|
||||
if (const auto strong = weak.data()) {
|
||||
|
||||
@@ -936,12 +936,14 @@ void ApplyChannelUpdate(
|
||||
| Flag::CanViewParticipants
|
||||
| Flag::CanSetStickers
|
||||
| Flag::PreHistoryHidden
|
||||
| Flag::AntiSpam
|
||||
| Flag::Location;
|
||||
channel->setFlags((channel->flags() & ~mask)
|
||||
| (update.is_can_set_username() ? Flag::CanSetUsername : Flag())
|
||||
| (update.is_can_view_participants() ? Flag::CanViewParticipants : Flag())
|
||||
| (update.is_can_set_stickers() ? Flag::CanSetStickers : Flag())
|
||||
| (update.is_hidden_prehistory() ? Flag::PreHistoryHidden : Flag())
|
||||
| (update.is_antispam() ? Flag::AntiSpam : Flag())
|
||||
| (update.vlocation() ? Flag::Location : Flag()));
|
||||
channel->setUserpicPhoto(update.vchat_photo());
|
||||
if (const auto migratedFrom = update.vmigrated_from_chat_id()) {
|
||||
|
||||
@@ -57,6 +57,7 @@ enum class ChannelDataFlag {
|
||||
JoinToWrite = (1 << 21),
|
||||
RequestToJoin = (1 << 22),
|
||||
Forum = (1 << 23),
|
||||
AntiSpam = (1 << 24),
|
||||
};
|
||||
inline constexpr bool is_flag_type(ChannelDataFlag) { return true; };
|
||||
using ChannelDataFlags = base::flags<ChannelDataFlag>;
|
||||
@@ -274,6 +275,9 @@ public:
|
||||
[[nodiscard]] bool requestToJoin() const {
|
||||
return flags() & Flag::RequestToJoin;
|
||||
}
|
||||
[[nodiscard]] bool antiSpamMode() const {
|
||||
return flags() & Flag::AntiSpam;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto adminRights() const {
|
||||
return _adminRights.current();
|
||||
|
||||
@@ -386,7 +386,8 @@ void ForumTopic::setClosedAndSave(bool closed) {
|
||||
MTP_int(_rootId),
|
||||
MTPstring(), // title
|
||||
MTPlong(), // icon_emoji_id
|
||||
MTP_bool(closed)
|
||||
MTP_bool(closed),
|
||||
MTPBool() // hidden
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
api->applyUpdates(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
|
||||
@@ -314,14 +314,17 @@ void Step::fillSentCodeData(const MTPDauth_sentCode &data) {
|
||||
const auto bad = [](const char *type) {
|
||||
LOG(("API Error: Should not be '%1'.").arg(type));
|
||||
};
|
||||
getData()->codeByTelegram = false;
|
||||
getData()->codeByFragmentUrl = QString();
|
||||
data.vtype().match([&](const MTPDauth_sentCodeTypeApp &data) {
|
||||
getData()->codeByTelegram = true;
|
||||
getData()->codeLength = data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeSms &data) {
|
||||
getData()->codeByTelegram = false;
|
||||
getData()->codeLength = data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeFragmentSms &data) {
|
||||
getData()->codeByFragmentUrl = qs(data.vurl());
|
||||
getData()->codeLength = data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeCall &data) {
|
||||
getData()->codeByTelegram = false;
|
||||
getData()->codeLength = data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeFlashCall &) {
|
||||
bad("FlashCall");
|
||||
|
||||
@@ -55,6 +55,7 @@ struct Data {
|
||||
|
||||
int codeLength = 5;
|
||||
bool codeByTelegram = false;
|
||||
QString codeByFragmentUrl;
|
||||
|
||||
Core::CloudPasswordState pwdState;
|
||||
|
||||
|
||||
@@ -2174,6 +2174,7 @@ void FormController::startPhoneVerification(not_null<Value*> value) {
|
||||
const auto timeout = data.vtimeout();
|
||||
value->verification.requestId = 0;
|
||||
value->verification.phoneCodeHash = qs(data.vphone_code_hash());
|
||||
value->verification.fragmentUrl = QString();
|
||||
const auto bad = [](const char *type) {
|
||||
LOG(("API Error: Should not be '%1' "
|
||||
"in FormController::startPhoneVerification.").arg(type));
|
||||
@@ -2206,6 +2207,10 @@ void FormController::startPhoneVerification(not_null<Value*> value) {
|
||||
timeout.value_or(60),
|
||||
});
|
||||
}
|
||||
}, [&](const MTPDauth_sentCodeTypeFragmentSms &data) {
|
||||
value->verification.codeLength = data.vlength().v;
|
||||
value->verification.fragmentUrl = qs(data.vurl());
|
||||
value->verification.call = nullptr;
|
||||
}, [&](const MTPDauth_sentCodeTypeFlashCall &) {
|
||||
bad("FlashCall");
|
||||
}, [&](const MTPDauth_sentCodeTypeMissedCall &) {
|
||||
|
||||
@@ -188,6 +188,7 @@ struct Verification {
|
||||
mtpRequestId requestId = 0;
|
||||
QString phoneCodeHash;
|
||||
int codeLength = 0;
|
||||
QString fragmentUrl;
|
||||
std::unique_ptr<Ui::SentCodeCall> call;
|
||||
|
||||
QString error;
|
||||
|
||||
Reference in New Issue
Block a user