Move get_premium_limit_keys to Premium.h.

This commit is contained in:
levlam 2022-05-24 01:21:03 +03:00
parent 2c44f8c273
commit 7313ad311b
4 changed files with 44 additions and 9 deletions

View File

@ -406,6 +406,7 @@ set(TDLIB_SOURCE
td/telegram/PhotoSize.cpp
td/telegram/PhotoSizeSource.cpp
td/telegram/PollManager.cpp
td/telegram/Premium.cpp
td/telegram/QueryCombiner.cpp
td/telegram/RecentDialogList.cpp
td/telegram/ReplyMarkup.cpp
@ -639,6 +640,7 @@ set(TDLIB_SOURCE
td/telegram/PhotoSizeSource.h
td/telegram/PollId.h
td/telegram/PollManager.h
td/telegram/Premium.h
td/telegram/PrivacyManager.h
td/telegram/PtsManager.h
td/telegram/PublicDialogType.h

View File

@ -22,6 +22,7 @@
#include "td/telegram/net/NetType.h"
#include "td/telegram/net/PublicRsaKeyShared.h"
#include "td/telegram/net/Session.h"
#include "td/telegram/Premium.h"
#include "td/telegram/StateManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/TdDb.h"
@ -1181,15 +1182,7 @@ void ConfigManager::get_premium_features(Promise<td_api::object_ptr<td_api::prem
}
}
const vector<Slice> limit_keys{"channels_limit",
"saved_gifs_limit",
"stickers_faved_limit",
"dialog_filters_limit",
"dialog_filters_chats_limit",
"dialogs_pinned_limit",
"dialogs_folder_pinned_limit",
"channels_public_limit",
"caption_length_limit"};
auto &limit_keys = get_premium_limit_keys();
vector<td_api::object_ptr<td_api::premiumLimit>> limits;
for (auto key : limit_keys) {
int32 default_limit = static_cast<int32>(G()->shared_config().get_option_integer(PSLICE() << key << "_default"));

24
td/telegram/Premium.cpp Normal file
View File

@ -0,0 +1,24 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/Premium.h"
namespace td {
const vector<Slice> &get_premium_limit_keys() {
static const vector<Slice> limit_keys{"channels_limit",
"saved_gifs_limit",
"stickers_faved_limit",
"dialog_filters_limit",
"dialog_filters_chats_limit",
"dialogs_pinned_limit",
"dialogs_folder_pinned_limit",
"channels_public_limit",
"caption_length_limit"};
return limit_keys;
}
} // namespace td

16
td/telegram/Premium.h Normal file
View File

@ -0,0 +1,16 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/utils/common.h"
#include "td/utils/Slice.h"
namespace td {
const vector<Slice> &get_premium_limit_keys();
} // namespace td